# system simulated
system = System(funcmem = SimpleMemory(in_addr_map = False),
+ funcbus = NoncoherentBus(),
physmem = SimpleMemory(latency = "100ns"))
def make_level(spec, prototypes, attach_obj, attach_port):
parent.cpu = objs
for t in objs:
t.test = getattr(attach_obj, attach_port)
- t.functional = system.funcmem.port
+ t.functional = system.funcbus.slave
make_level(treespec, prototypes, system.physmem, "port")
+# connect reference memory to funcbus
+system.funcbus.master = system.funcmem.port
+
# -----------------------
# run simulation
# -----------------------
system = System(cpu = cpus,
funcmem = SimpleMemory(in_addr_map = False),
+ funcbus = NoncoherentBus(),
physmem = SimpleMemory())
if options.num_dmas > 0:
# Tie the cpu memtester ports to the correct system ports
#
cpu.test = system.ruby._cpu_ruby_ports[i].slave
- cpu.functional = system.funcmem.port
+ cpu.functional = system.funcbus.slave
#
# Since the memtester is incredibly bursty, increase the deadlock
# Tie the dma memtester ports to the correct functional port
# Note that the test port has already been connected to the dma_sequencer
#
- dma.functional = system.funcmem.port
+ dma.functional = system.funcbus.slave
+
+# connect reference memory to funcbus
+system.funcbus.master = system.funcmem.port
# -----------------------
# run simulation
class SimpleMemory(AbstractMemory):
type = 'SimpleMemory'
- port = VectorSlavePort("Slave ports")
+ port = SlavePort("Slave ports")
latency = Param.Latency('30ns', "Request to response latency")
latency_var = Param.Latency('0ns', "Request to response latency variance")
SimpleMemory::SimpleMemory(const Params* p) :
AbstractMemory(p),
- lat(p->latency), lat_var(p->latency_var)
+ port(name() + ".port", *this), lat(p->latency), lat_var(p->latency_var)
{
- for (size_t i = 0; i < p->port_port_connection_count; ++i) {
- ports.push_back(new MemoryPort(csprintf("%s-port-%d", name(), i),
- *this));
- }
}
void
SimpleMemory::init()
{
- for (vector<MemoryPort*>::iterator p = ports.begin(); p != ports.end();
- ++p) {
- if (!(*p)->isConnected()) {
- fatal("SimpleMemory port %s is unconnected!\n", (*p)->name());
- } else {
- (*p)->sendRangeChange();
- }
+ // allow unconnected memories as this is used in several ruby
+ // systems at the moment
+ if (port.isConnected()) {
+ port.sendRangeChange();
}
}
if (if_name != "port") {
return MemObject::getSlavePort(if_name, idx);
} else {
- if (idx >= static_cast<int>(ports.size())) {
- fatal("SimpleMemory::getSlavePort: unknown index %d\n", idx);
- }
-
- return *ports[idx];
+ return port;
}
}
unsigned int
SimpleMemory::drain(Event *de)
{
- int count = 0;
- for (vector<MemoryPort*>::iterator p = ports.begin(); p != ports.end();
- ++p) {
- count += (*p)->drain(de);
- }
+ int count = port.drain(de);
if (count)
changeState(Draining);
#include "params/SimpleMemory.hh"
/**
- * The simple memory is a basic multi-ported memory with an infinite
- * throughput and a fixed latency, potentially with a variance added
- * to it. It uses a SimpleTimingPort to implement the timing accesses.
+ * The simple memory is a basic single-ported memory controller with
+ * an infinite throughput and a fixed latency, potentially with a
+ * variance added to it. It uses a SimpleTimingPort to implement the
+ * timing accesses.
*/
class SimpleMemory : public AbstractMemory
{
};
- std::vector<MemoryPort*> ports;
+ MemoryPort port;
Tick lat;
Tick lat_var;
# system simulated
system = System(cpu = cpus,
funcmem = SimpleMemory(in_addr_map = False),
+ funcbus = NoncoherentBus(),
physmem = SimpleMemory())
Ruby.create_system(options, system)
# physmem, respectively
#
cpus[i].test = ruby_port.slave
- cpus[i].functional = system.funcmem.port
+ cpus[i].functional = system.funcbus.slave
#
# Since the memtester is incredibly bursty, increase the deadlock
#
ruby_port.access_phys_mem = False
+# connect reference memory to funcbus
+system.funcmem.port = system.funcbus.master
+
# -----------------------
# run simulation
# -----------------------
# system simulated
system = System(cpu = cpus, funcmem = SimpleMemory(in_addr_map = False),
+ funcbus = NoncoherentBus(),
physmem = SimpleMemory(),
membus = CoherentBus(clock="500GHz", width=16))
cpu.l1c = L1(size = '32kB', assoc = 4)
cpu.l1c.cpu_side = cpu.test
cpu.l1c.mem_side = system.toL2Bus.slave
- system.funcmem.port = cpu.functional
+ system.funcbus.slave = cpu.functional
system.system_port = system.membus.slave
+# connect reference memory to funcbus
+system.funcmem.port = system.funcbus.master
+
# connect memory to membus
system.physmem.port = system.membus.master