root.cc revision 4762:c94e103c83ad
12740SN/A/*
21046SN/A * Copyright (c) 2002-2005 The Regents of The University of Michigan
31046SN/A * All rights reserved.
41046SN/A *
51046SN/A * Redistribution and use in source and binary forms, with or without
61046SN/A * modification, are permitted provided that the following conditions are
71046SN/A * met: redistributions of source code must retain the above copyright
81046SN/A * notice, this list of conditions and the following disclaimer;
91046SN/A * redistributions in binary form must reproduce the above copyright
101046SN/A * notice, this list of conditions and the following disclaimer in the
111046SN/A * documentation and/or other materials provided with the distribution;
121046SN/A * neither the name of the copyright holders nor the names of its
131046SN/A * contributors may be used to endorse or promote products derived from
141046SN/A * this software without specific prior written permission.
151046SN/A *
161046SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
171046SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
181046SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
191046SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
201046SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
211046SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
221046SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
231046SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
241046SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
251046SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262665SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665SN/A *
282665SN/A * Authors: Nathan Binkert
291046SN/A *          Steve Reinhardt
303101Sstever@eecs.umich.edu */
311438SN/A
324762Snate@binkert.org#include <cstring>
334762Snate@binkert.org#include <fstream>
343102Sstever@eecs.umich.edu#include <list>
351438SN/A#include <string>
363102Sstever@eecs.umich.edu#include <vector>
373102Sstever@eecs.umich.edu
383102Sstever@eecs.umich.edu#include "base/misc.hh"
393102Sstever@eecs.umich.edu#include "params/Root.hh"
403102Sstever@eecs.umich.edu#include "sim/sim_object.hh"
413102Sstever@eecs.umich.edu
423102Sstever@eecs.umich.edu// Dummy Object
433102Sstever@eecs.umich.edustruct Root : public SimObject
443102Sstever@eecs.umich.edu{
453102Sstever@eecs.umich.edu    Root(RootParams *params) : SimObject(params) {}
463102Sstever@eecs.umich.edu};
473102Sstever@eecs.umich.edu
483102Sstever@eecs.umich.eduRoot *
493102Sstever@eecs.umich.eduRootParams::create()
503102Sstever@eecs.umich.edu{
513102Sstever@eecs.umich.edu    static bool created = false;
523102Sstever@eecs.umich.edu    if (created)
533102Sstever@eecs.umich.edu        panic("only one root object allowed!");
543102Sstever@eecs.umich.edu
553102Sstever@eecs.umich.edu    created = true;
563102Sstever@eecs.umich.edu
573102Sstever@eecs.umich.edu    return new Root(this);
583102Sstever@eecs.umich.edu}
593102Sstever@eecs.umich.edu