From abc76f20cb98c90e8dab416dd16dfd4a954013ba Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Mon, 23 Jul 2007 21:51:38 -0700 Subject: 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 --- src/dev/ns_gige.cc | 143 ++++------------------------------------------------- 1 file changed, 9 insertions(+), 134 deletions(-) (limited to 'src/dev/ns_gige.cc') diff --git a/src/dev/ns_gige.cc b/src/dev/ns_gige.cc index e9d9c419d..29af530e6 100644 --- a/src/dev/ns_gige.cc +++ b/src/dev/ns_gige.cc @@ -43,7 +43,8 @@ #include "dev/pciconfigall.hh" #include "mem/packet.hh" #include "mem/packet_access.hh" -#include "sim/builder.hh" +#include "params/NSGigE.hh" +#include "params/NSGigEInt.hh" #include "sim/debug.hh" #include "sim/host.hh" #include "sim/stats.hh" @@ -118,7 +119,7 @@ NSGigE::NSGigE(Params *p) regsReset(); - memcpy(&rom.perfectMatch, p->eaddr.bytes(), ETH_ADDR_LEN); + memcpy(&rom.perfectMatch, p->hardware_address.bytes(), ETH_ADDR_LEN); memset(&rxDesc32, 0, sizeof(rxDesc32)); memset(&txDesc32, 0, sizeof(txDesc32)); @@ -2773,23 +2774,10 @@ NSGigE::unserialize(Checkpoint *cp, const std::string §ion) } } -BEGIN_DECLARE_SIM_OBJECT_PARAMS(NSGigEInt) - - SimObjectParam peer; - SimObjectParam device; - -END_DECLARE_SIM_OBJECT_PARAMS(NSGigEInt) - -BEGIN_INIT_SIM_OBJECT_PARAMS(NSGigEInt) - - INIT_PARAM_DFLT(peer, "peer interface", NULL), - INIT_PARAM(device, "Ethernet device of this interface") - -END_INIT_SIM_OBJECT_PARAMS(NSGigEInt) - -CREATE_SIM_OBJECT(NSGigEInt) +NSGigEInt * +NSGigEIntParams::create() { - NSGigEInt *dev_int = new NSGigEInt(getInstanceName(), device); + NSGigEInt *dev_int = new NSGigEInt(name, device); EtherInt *p = (EtherInt *)peer; if (p) { @@ -2800,121 +2788,8 @@ CREATE_SIM_OBJECT(NSGigEInt) return dev_int; } -REGISTER_SIM_OBJECT("NSGigEInt", NSGigEInt) - - -BEGIN_DECLARE_SIM_OBJECT_PARAMS(NSGigE) - - SimObjectParam system; - SimObjectParam platform; - Param min_backoff_delay; - Param max_backoff_delay; - SimObjectParam configdata; - Param pci_bus; - Param pci_dev; - Param pci_func; - Param pio_latency; - Param config_latency; - - Param clock; - Param dma_desc_free; - Param dma_data_free; - Param dma_read_delay; - Param dma_write_delay; - Param dma_read_factor; - Param dma_write_factor; - Param dma_no_allocate; - Param intr_delay; - - Param rx_delay; - Param tx_delay; - Param rx_fifo_size; - Param tx_fifo_size; - - Param rx_filter; - Param hardware_address; - Param rx_thread; - Param tx_thread; - Param rss; - -END_DECLARE_SIM_OBJECT_PARAMS(NSGigE) - -BEGIN_INIT_SIM_OBJECT_PARAMS(NSGigE) - - INIT_PARAM(system, "System pointer"), - INIT_PARAM(platform, "Platform pointer"), - INIT_PARAM(min_backoff_delay, "Minimum delay after receving a nack packed"), - INIT_PARAM(max_backoff_delay, "Maximum delay after receving a nack packed"), - INIT_PARAM(configdata, "PCI Config data"), - INIT_PARAM(pci_bus, "PCI bus ID"), - INIT_PARAM(pci_dev, "PCI device number"), - INIT_PARAM(pci_func, "PCI function code"), - INIT_PARAM_DFLT(pio_latency, "Programmed IO latency in bus cycles", 1), - INIT_PARAM(config_latency, "Number of cycles for a config read or write"), - INIT_PARAM(clock, "State machine cycle time"), - - INIT_PARAM(dma_desc_free, "DMA of Descriptors is free"), - INIT_PARAM(dma_data_free, "DMA of Data is free"), - INIT_PARAM(dma_read_delay, "fixed delay for dma reads"), - INIT_PARAM(dma_write_delay, "fixed delay for dma writes"), - INIT_PARAM(dma_read_factor, "multiplier for dma reads"), - INIT_PARAM(dma_write_factor, "multiplier for dma writes"), - INIT_PARAM(dma_no_allocate, "Should DMA reads allocate cache lines"), - INIT_PARAM(intr_delay, "Interrupt Delay in microseconds"), - - INIT_PARAM(rx_delay, "Receive Delay"), - INIT_PARAM(tx_delay, "Transmit Delay"), - INIT_PARAM(rx_fifo_size, "max size in bytes of rxFifo"), - INIT_PARAM(tx_fifo_size, "max size in bytes of txFifo"), - - INIT_PARAM(rx_filter, "Enable Receive Filter"), - INIT_PARAM(hardware_address, "Ethernet Hardware Address"), - INIT_PARAM(rx_thread, ""), - INIT_PARAM(tx_thread, ""), - INIT_PARAM(rss, "") - -END_INIT_SIM_OBJECT_PARAMS(NSGigE) - - -CREATE_SIM_OBJECT(NSGigE) +NSGigE * +NSGigEParams::create() { - NSGigE::Params *params = new NSGigE::Params; - - params->name = getInstanceName(); - params->platform = platform; - params->system = system; - params->min_backoff_delay = min_backoff_delay; - params->max_backoff_delay = max_backoff_delay; - params->configData = configdata; - params->busNum = pci_bus; - params->deviceNum = pci_dev; - params->functionNum = pci_func; - params->pio_delay = pio_latency; - params->config_delay = config_latency; - - params->clock = clock; - params->dma_desc_free = dma_desc_free; - params->dma_data_free = dma_data_free; - params->dma_read_delay = dma_read_delay; - params->dma_write_delay = dma_write_delay; - params->dma_read_factor = dma_read_factor; - params->dma_write_factor = dma_write_factor; - params->dma_no_allocate = dma_no_allocate; - params->pio_delay = pio_latency; - params->intr_delay = intr_delay; - - params->rx_delay = rx_delay; - params->tx_delay = tx_delay; - params->rx_fifo_size = rx_fifo_size; - params->tx_fifo_size = tx_fifo_size; - - params->rx_filter = rx_filter; - params->eaddr = hardware_address; - params->rx_thread = rx_thread; - params->tx_thread = tx_thread; - params->rss = rss; - - return new NSGigE(params); + return new NSGigE(this); } - -REGISTER_SIM_OBJECT("NSGigE", NSGigE) -- cgit v1.2.3