Major changes to how SimObjects are created and initialized. Almost all
creation and initialization now happens in python. Parameter objects are generated and initialized by python. The .ini file is now solely for debugging purposes and is not used in construction of the objects in any way. --HG-- extra : convert_revision : 7e722873e417cb3d696f2e34c35ff488b7bff4ed
This commit is contained in:
@@ -37,26 +37,25 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/time.hh"
|
||||
#include "base/trace.hh"
|
||||
#include "dev/sparc/dtod.hh"
|
||||
#include "dev/platform.hh"
|
||||
#include "mem/packet_access.hh"
|
||||
#include "mem/port.hh"
|
||||
#include "sim/builder.hh"
|
||||
#include "sim/system.hh"
|
||||
|
||||
using namespace std;
|
||||
using namespace TheISA;
|
||||
|
||||
DumbTOD::DumbTOD(Params *p)
|
||||
DumbTOD::DumbTOD(const Params *p)
|
||||
: BasicPioDevice(p)
|
||||
{
|
||||
struct tm tm;
|
||||
struct tm tm = p->time;
|
||||
char *tz;
|
||||
|
||||
pioSize = 0x08;
|
||||
|
||||
parseTime(p->init_time, &tm);
|
||||
tz = getenv("TZ");
|
||||
setenv("TZ", "", 1);
|
||||
tzset();
|
||||
@@ -104,37 +103,8 @@ DumbTOD::unserialize(Checkpoint *cp, const std::string §ion)
|
||||
UNSERIALIZE_SCALAR(todTime);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_DECLARE_SIM_OBJECT_PARAMS(DumbTOD)
|
||||
|
||||
Param<Addr> pio_addr;
|
||||
Param<Tick> pio_latency;
|
||||
SimObjectParam<Platform *> platform;
|
||||
SimObjectParam<System *> system;
|
||||
VectorParam<int> time;
|
||||
|
||||
END_DECLARE_SIM_OBJECT_PARAMS(DumbTOD)
|
||||
|
||||
BEGIN_INIT_SIM_OBJECT_PARAMS(DumbTOD)
|
||||
|
||||
INIT_PARAM(pio_addr, "Device Address"),
|
||||
INIT_PARAM(pio_latency, "Programmed IO latency"),
|
||||
INIT_PARAM(platform, "platform"),
|
||||
INIT_PARAM(system, "system object"),
|
||||
INIT_PARAM(time, "")
|
||||
|
||||
END_INIT_SIM_OBJECT_PARAMS(DumbTOD)
|
||||
|
||||
CREATE_SIM_OBJECT(DumbTOD)
|
||||
DumbTOD *
|
||||
DumbTODParams::create()
|
||||
{
|
||||
DumbTOD::Params *p = new DumbTOD::Params;
|
||||
p->name =getInstanceName();
|
||||
p->pio_addr = pio_addr;
|
||||
p->pio_delay = pio_latency;
|
||||
p->platform = platform;
|
||||
p->system = system;
|
||||
p->init_time = time;
|
||||
return new DumbTOD(p);
|
||||
return new DumbTOD(this);
|
||||
}
|
||||
|
||||
REGISTER_SIM_OBJECT("DumbTOD", DumbTOD)
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
#include "base/range.hh"
|
||||
#include "dev/io_device.hh"
|
||||
|
||||
#include "params/DumbTOD.hh"
|
||||
|
||||
/**
|
||||
* DumbTOD simply returns some idea of time when read. Until we finish with
|
||||
@@ -52,15 +52,14 @@ class DumbTOD : public BasicPioDevice
|
||||
uint64_t todTime;
|
||||
|
||||
public:
|
||||
struct Params : public BasicPioDevice::Params
|
||||
{
|
||||
std::vector<int> init_time;
|
||||
};
|
||||
protected:
|
||||
const Params *params() const { return (const Params *)_params; }
|
||||
typedef DumbTODParams Params;
|
||||
DumbTOD(const Params *p);
|
||||
|
||||
public:
|
||||
DumbTOD(Params *p);
|
||||
const Params *
|
||||
params() const
|
||||
{
|
||||
return dynamic_cast<const Params *>(_params);
|
||||
}
|
||||
|
||||
virtual Tick read(PacketPtr pkt);
|
||||
virtual Tick write(PacketPtr pkt);
|
||||
|
||||
@@ -45,11 +45,10 @@
|
||||
#include "dev/platform.hh"
|
||||
#include "mem/port.hh"
|
||||
#include "mem/packet_access.hh"
|
||||
#include "sim/builder.hh"
|
||||
#include "sim/faults.hh"
|
||||
#include "sim/system.hh"
|
||||
|
||||
Iob::Iob(Params *p)
|
||||
Iob::Iob(const Params *p)
|
||||
: PioDevice(p), ic(p->platform->intrctrl)
|
||||
{
|
||||
iobManAddr = ULL(0x9800000000);
|
||||
@@ -372,31 +371,8 @@ Iob::unserialize(Checkpoint *cp, const std::string §ion)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
BEGIN_DECLARE_SIM_OBJECT_PARAMS(Iob)
|
||||
Param<Tick> pio_latency;
|
||||
SimObjectParam<Platform *> platform;
|
||||
SimObjectParam<System *> system;
|
||||
END_DECLARE_SIM_OBJECT_PARAMS(Iob)
|
||||
|
||||
BEGIN_INIT_SIM_OBJECT_PARAMS(Iob)
|
||||
|
||||
INIT_PARAM(pio_latency, "Programmed IO latency"),
|
||||
INIT_PARAM(platform, "platform"),
|
||||
INIT_PARAM(system, "system object")
|
||||
|
||||
END_INIT_SIM_OBJECT_PARAMS(Iob)
|
||||
|
||||
CREATE_SIM_OBJECT(Iob)
|
||||
Iob *
|
||||
IobParams::create()
|
||||
{
|
||||
Iob::Params *p = new Iob::Params;
|
||||
p->name = getInstanceName();
|
||||
p->pio_delay = pio_latency;
|
||||
p->platform = platform;
|
||||
p->system = system;
|
||||
return new Iob(p);
|
||||
return new Iob(this);
|
||||
}
|
||||
|
||||
REGISTER_SIM_OBJECT("Iob", Iob)
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "base/range.hh"
|
||||
#include "dev/io_device.hh"
|
||||
#include "dev/disk_image.hh"
|
||||
#include "params/Iob.hh"
|
||||
|
||||
class IntrControl;
|
||||
|
||||
@@ -123,24 +124,22 @@ class Iob : public PioDevice
|
||||
void readIob(PacketPtr pkt);
|
||||
void readJBus(PacketPtr pkt);
|
||||
|
||||
|
||||
public:
|
||||
struct Params : public PioDevice::Params
|
||||
typedef IobParams Params;
|
||||
Iob(const Params *p);
|
||||
|
||||
const Params *
|
||||
params() const
|
||||
{
|
||||
Tick pio_delay;
|
||||
};
|
||||
protected:
|
||||
const Params *params() const { return (const Params*)_params; }
|
||||
|
||||
public:
|
||||
Iob(Params *p);
|
||||
return dynamic_cast<const Params *>(_params);
|
||||
}
|
||||
|
||||
virtual Tick read(PacketPtr pkt);
|
||||
virtual Tick write(PacketPtr pkt);
|
||||
void generateIpi(Type type, int cpu_id, int vector);
|
||||
void receiveDeviceInterrupt(DeviceId devid);
|
||||
bool receiveJBusInterrupt(int cpu_id, int source, uint64_t d0, uint64_t d1);
|
||||
|
||||
bool receiveJBusInterrupt(int cpu_id, int source, uint64_t d0,
|
||||
uint64_t d1);
|
||||
|
||||
void addressRanges(AddrRangeList &range_list);
|
||||
|
||||
|
||||
@@ -40,11 +40,10 @@
|
||||
#include "dev/platform.hh"
|
||||
#include "mem/port.hh"
|
||||
#include "mem/packet_access.hh"
|
||||
#include "sim/builder.hh"
|
||||
#include "sim/byteswap.hh"
|
||||
#include "sim/system.hh"
|
||||
|
||||
MmDisk::MmDisk(Params *p)
|
||||
MmDisk::MmDisk(const Params *p)
|
||||
: BasicPioDevice(p), image(p->image), curSector((off_t)-1), dirty(false)
|
||||
{
|
||||
std::memset(&diskData, 0, SectorSize);
|
||||
@@ -173,39 +172,8 @@ MmDisk::serialize(std::ostream &os)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
BEGIN_DECLARE_SIM_OBJECT_PARAMS(MmDisk)
|
||||
Param<Addr> pio_addr;
|
||||
Param<Tick> pio_latency;
|
||||
Param<Addr> pio_size;
|
||||
SimObjectParam<Platform *> platform;
|
||||
SimObjectParam<System *> system;
|
||||
SimObjectParam<DiskImage *> image;
|
||||
END_DECLARE_SIM_OBJECT_PARAMS(MmDisk)
|
||||
|
||||
BEGIN_INIT_SIM_OBJECT_PARAMS(MmDisk)
|
||||
|
||||
INIT_PARAM(pio_addr, "Device Address"),
|
||||
INIT_PARAM(pio_latency, "Programmed IO latency"),
|
||||
INIT_PARAM(pio_size, "Size of address range"),
|
||||
INIT_PARAM(platform, "platform"),
|
||||
INIT_PARAM(system, "system object"),
|
||||
INIT_PARAM(image, "disk image")
|
||||
|
||||
END_INIT_SIM_OBJECT_PARAMS(MmDisk)
|
||||
|
||||
CREATE_SIM_OBJECT(MmDisk)
|
||||
MmDisk *
|
||||
MmDiskParams::create()
|
||||
{
|
||||
MmDisk::Params *p = new MmDisk::Params;
|
||||
p->name = getInstanceName();
|
||||
p->pio_addr = pio_addr;
|
||||
p->pio_delay = pio_latency;
|
||||
p->platform = platform;
|
||||
p->system = system;
|
||||
p->image = image;
|
||||
return new MmDisk(p);
|
||||
return new MmDisk(this);
|
||||
}
|
||||
|
||||
REGISTER_SIM_OBJECT("MmDisk", MmDisk)
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "base/range.hh"
|
||||
#include "dev/io_device.hh"
|
||||
#include "dev/disk_image.hh"
|
||||
#include "params/MmDisk.hh"
|
||||
|
||||
class MmDisk : public BasicPioDevice
|
||||
{
|
||||
@@ -49,15 +50,14 @@ class MmDisk : public BasicPioDevice
|
||||
uint8_t diskData[SectorSize];
|
||||
|
||||
public:
|
||||
struct Params : public BasicPioDevice::Params
|
||||
{
|
||||
DiskImage *image;
|
||||
};
|
||||
protected:
|
||||
const Params *params() const { return (const Params*)_params; }
|
||||
typedef MmDiskParams Params;
|
||||
MmDisk(const Params *p);
|
||||
|
||||
public:
|
||||
MmDisk(Params *p);
|
||||
const Params *
|
||||
params() const
|
||||
{
|
||||
return dynamic_cast<const Params *>(_params);
|
||||
}
|
||||
|
||||
virtual Tick read(PacketPtr pkt);
|
||||
virtual Tick write(PacketPtr pkt);
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "cpu/intr_control.hh"
|
||||
#include "dev/simconsole.hh"
|
||||
#include "dev/sparc/t1000.hh"
|
||||
#include "sim/builder.hh"
|
||||
#include "params/T1000.hh"
|
||||
#include "sim/system.hh"
|
||||
|
||||
using namespace std;
|
||||
@@ -101,23 +101,8 @@ T1000::calcConfigAddr(int bus, int dev, int func)
|
||||
M5_DUMMY_RETURN
|
||||
}
|
||||
|
||||
BEGIN_DECLARE_SIM_OBJECT_PARAMS(T1000)
|
||||
|
||||
SimObjectParam<System *> system;
|
||||
SimObjectParam<IntrControl *> intrctrl;
|
||||
|
||||
END_DECLARE_SIM_OBJECT_PARAMS(T1000)
|
||||
|
||||
BEGIN_INIT_SIM_OBJECT_PARAMS(T1000)
|
||||
|
||||
INIT_PARAM(system, "system"),
|
||||
INIT_PARAM(intrctrl, "interrupt controller")
|
||||
|
||||
END_INIT_SIM_OBJECT_PARAMS(T1000)
|
||||
|
||||
CREATE_SIM_OBJECT(T1000)
|
||||
T1000 *
|
||||
T1000Params::create()
|
||||
{
|
||||
return new T1000(getInstanceName(), system, intrctrl);
|
||||
return new T1000(name, system, intrctrl);
|
||||
}
|
||||
|
||||
REGISTER_SIM_OBJECT("T1000", T1000)
|
||||
|
||||
Reference in New Issue
Block a user