changeset 898047a3672c in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=898047a3672c
description:
ruby: Ruby changes required to use the python config system
This patch includes the necessary changes to connect ruby objects using
the python configuration system. Mainly it consists of removing
unnecessary ruby object pointers and connecting the necessary object
pointers using the generated param objects. This patch includes the
slicc changes necessary to connect generated ruby objects together using
the python configuraiton system.
diffstat:
26 files changed, 744 insertions(+), 131 deletions(-)
configs/example/memtest-ruby.py | 50 ++-
src/mem/protocol/MOESI_hammer-cache.sm | 39 +-
src/mem/protocol/MOESI_hammer-dir.sm | 39 +-
src/mem/protocol/RubySlicc_Types.sm | 26 +
src/mem/ruby/SConscript | 1
src/mem/ruby/slicc_interface/AbstractCacheEntry.hh | 12
src/mem/ruby/slicc_interface/AbstractEntry.cc | 38 ++
src/mem/ruby/slicc_interface/AbstractEntry.hh | 73 +++++
src/mem/ruby/slicc_interface/SConscript | 1
src/mem/ruby/system/Cache.py | 1
src/mem/ruby/system/CacheMemory.cc | 35 +-
src/mem/ruby/system/CacheMemory.hh | 7
src/mem/ruby/system/DirectoryMemory.cc | 3
src/mem/ruby/system/DirectoryMemory.hh | 3
src/mem/ruby/system/DirectoryMemory.py | 1
src/mem/ruby/system/RubyPort.cc | 275 +++++++++++++++++++-
src/mem/ruby/system/RubyPort.hh | 90 ++++++
src/mem/ruby/system/Sequencer.hh | 3
src/mem/ruby/system/Sequencer.py | 3
src/mem/slicc/ast/FormalParamAST.py | 3
src/mem/slicc/ast/MethodCallExprAST.py | 46 +++
src/mem/slicc/ast/StaticCastAST.py | 54 +++
src/mem/slicc/ast/__init__.py | 1
src/mem/slicc/parser.py | 9
src/mem/slicc/symbols/StateMachine.py | 58 +++-
src/mem/slicc/symbols/Type.py | 4
diffs (truncated from 1395 to 300 lines):
diff -r 5a61a8a9009a -r 898047a3672c configs/example/memtest-ruby.py
--- a/configs/example/memtest-ruby.py Fri Jan 29 20:29:18 2010 -0800
+++ b/configs/example/memtest-ruby.py Fri Jan 29 20:29:19 2010 -0800
@@ -102,8 +102,6 @@
# consistent with the NetDest list. Therefore the l1 controller nodes must be
# listed before the directory nodes and directory nodes before dma nodes, etc.
#
-
-# net_nodes = []
l1_cntrl_nodes = []
dir_cntrl_nodes = []
@@ -112,23 +110,43 @@
# controller constructors are called before the network constructor
#
for (i, cpu) in enumerate(cpus):
- l1_cntrl = L1Cache_Controller()
- cpu_seq = RubySequencer(controller = l1_cntrl,
- icache = L1Cache(controller = l1_cntrl),
- dcache = L1Cache(controller = l1_cntrl))
- cpu.controller = l1_cntrl
- cpu.sequencer = cpu_seq
+ #
+ # First create the Ruby objects associated with this cpu
+ # Eventually this code should go in a python file specific to the
+ # MOESI_hammer protocol
+ #
+
+ l1i_cache = L1Cache()
+ l1d_cache = L1Cache()
+ l2_cache = L2Cache()
+
+ cpu_seq = RubySequencer(icache = l1i_cache,
+ dcache = l1d_cache,
+ funcmem_port = system.physmem.port)
+
+ l1_cntrl = L1Cache_Controller(version = i,
+ sequencer = cpu_seq,
+ L1IcacheMemory = l1i_cache,
+ L1DcacheMemory = l1d_cache,
+ L2cacheMemory = l2_cache)
+
+ dir_cntrl = Directory_Controller(version = i,
+ directory = RubyDirectoryMemory(),
+ memBuffer = RubyMemoryControl())
+
+ #
+ # As noted above: Two independent list are track to maintain the order of
+ # nodes/controllers assumed by the ruby network
+ #
+ l1_cntrl_nodes.append(l1_cntrl)
+ dir_cntrl_nodes.append(dir_cntrl)
+
+ #
+ # Finally tie the memtester ports to the correct system ports
+ #
cpu.test = cpu_seq.port
- cpu_seq.funcmem_port = system.physmem.port
cpu.functional = system.funcmem.port
- dir_cntrl = Directory_Controller(version = i,
- directory = RubyDirectoryMemory(),
- memory_control = RubyMemoryControl())
-
- # net_nodes += [l1_cntrl, dir_cntrl]
- l1_cntrl_nodes.append(l1_cntrl)
- dir_cntrl_nodes.append(dir_cntrl)
#
# Important: the topology constructor must be called before the network
diff -r 5a61a8a9009a -r 898047a3672c src/mem/protocol/MOESI_hammer-cache.sm
--- a/src/mem/protocol/MOESI_hammer-cache.sm Fri Jan 29 20:29:18 2010 -0800
+++ b/src/mem/protocol/MOESI_hammer-cache.sm Fri Jan 29 20:29:19 2010 -0800
@@ -34,7 +34,11 @@
*/
machine(L1Cache, "AMD Hammer-like protocol")
-: int cache_response_latency = 12,
+: Sequencer * sequencer,
+ CacheMemory * L1IcacheMemory,
+ CacheMemory * L1DcacheMemory,
+ CacheMemory * L2cacheMemory,
+ int cache_response_latency = 12,
int issue_latency = 2
{
@@ -104,7 +108,6 @@
// STRUCTURE DEFINITIONS
MessageBuffer mandatoryQueue, ordered="false";
- Sequencer sequencer, factory='RubySystem::getSequencer(m_cfg["sequencer"])';
// CacheEntry
structure(Entry, desc="...", interface="AbstractCacheEntry") {
@@ -122,17 +125,6 @@
bool Sharers, desc="On a GetS, did we find any other sharers in
the system";
}
- external_type(CacheMemory) {
- bool cacheAvail(Address);
- Address cacheProbe(Address);
- void allocate(Address, Entry);
- void deallocate(Address);
- Entry lookup(Address);
- void changePermission(Address, AccessPermission);
- bool isTagPresent(Address);
- void profileMiss(CacheMsg);
- }
-
external_type(TBETable) {
TBE lookup(Address);
void allocate(Address);
@@ -141,17 +133,14 @@
}
TBETable TBEs, template_hack="<L1Cache_TBE>";
- CacheMemory L1IcacheMemory, factory='RubySystem::getCache(m_cfg["icache"])';
- CacheMemory L1DcacheMemory, factory='RubySystem::getCache(m_cfg["dcache"])';
- CacheMemory L2cacheMemory, factory='RubySystem::getCache(m_cfg["l2cache"])';
Entry getCacheEntry(Address addr), return_by_ref="yes" {
if (L2cacheMemory.isTagPresent(addr)) {
- return L2cacheMemory[addr];
+ return static_cast(Entry, L2cacheMemory[addr]);
} else if (L1DcacheMemory.isTagPresent(addr)) {
- return L1DcacheMemory[addr];
+ return static_cast(Entry, L1DcacheMemory[addr]);
} else {
- return L1IcacheMemory[addr];
+ return static_cast(Entry, L1IcacheMemory[addr]);
}
}
@@ -670,17 +659,21 @@
action(ss_copyFromL1toL2, "\s", desc="Copy data block from L1 (I or D) to
L2") {
if (L1DcacheMemory.isTagPresent(address)) {
- L2cacheMemory[address] := L1DcacheMemory[address];
+ static_cast(Entry, L2cacheMemory[address]).Dirty := static_cast(Entry,
L1DcacheMemory[address]).Dirty;
+ static_cast(Entry, L2cacheMemory[address]).DataBlk := static_cast(Entry,
L1DcacheMemory[address]).DataBlk;
} else {
- L2cacheMemory[address] := L1IcacheMemory[address];
+ static_cast(Entry, L2cacheMemory[address]).Dirty := static_cast(Entry,
L1IcacheMemory[address]).Dirty;
+ static_cast(Entry, L2cacheMemory[address]).DataBlk := static_cast(Entry,
L1IcacheMemory[address]).DataBlk;
}
}
action(tt_copyFromL2toL1, "\t", desc="Copy data block from L2 to L1 (I or
D)") {
if (L1DcacheMemory.isTagPresent(address)) {
- L1DcacheMemory[address] := L2cacheMemory[address];
+ static_cast(Entry, L1DcacheMemory[address]).Dirty := static_cast(Entry,
L2cacheMemory[address]).Dirty;
+ static_cast(Entry, L1DcacheMemory[address]).DataBlk :=
static_cast(Entry, L2cacheMemory[address]).DataBlk;
} else {
- L1IcacheMemory[address] := L2cacheMemory[address];
+ static_cast(Entry, L1IcacheMemory[address]).Dirty := static_cast(Entry,
L2cacheMemory[address]).Dirty;
+ static_cast(Entry, L1IcacheMemory[address]).DataBlk :=
static_cast(Entry, L2cacheMemory[address]).DataBlk;
}
}
diff -r 5a61a8a9009a -r 898047a3672c src/mem/protocol/MOESI_hammer-dir.sm
--- a/src/mem/protocol/MOESI_hammer-dir.sm Fri Jan 29 20:29:18 2010 -0800
+++ b/src/mem/protocol/MOESI_hammer-dir.sm Fri Jan 29 20:29:19 2010 -0800
@@ -34,7 +34,9 @@
*/
machine(Directory, "AMD Hammer-like protocol")
-: int memory_controller_latency = 12
+: DirectoryMemory * directory,
+ MemoryControl * memBuffer,
+ int memory_controller_latency = 12
{
MessageBuffer forwardFromDir, network="To", virtual_network="2",
ordered="false";
@@ -108,20 +110,11 @@
// TYPES
// DirectoryEntry
- structure(Entry, desc="...") {
+ structure(Entry, desc="...", interface="AbstractEntry") {
State DirectoryState, desc="Directory state";
DataBlock DataBlk, desc="data for the block";
}
- external_type(DirectoryMemory) {
- Entry lookup(Address);
- bool isPresent(Address);
- }
-
- external_type(MemoryControl, inport="yes", outport="yes") {
-
- }
-
// TBE entries for DMA requests
structure(TBE, desc="TBE entries for outstanding DMA requests") {
Address PhysicalAddress, desc="physical address";
@@ -145,17 +138,17 @@
// ** OBJECTS **
- DirectoryMemory directory,
factory='RubySystem::getDirectory(m_cfg["directory_name"])';
+ TBETable TBEs, template_hack="<Directory_TBE>";
- MemoryControl memBuffer,
factory='RubySystem::getMemoryControl(m_cfg["memory_controller_name"])';
-
- TBETable TBEs, template_hack="<Directory_TBE>";
+ Entry getDirectoryEntry(Address addr), return_by_ref="yes" {
+ return static_cast(Entry, directory[addr]);
+ }
State getState(Address addr) {
if (TBEs.isPresent(addr)) {
return TBEs[addr].TBEState;
} else {
- return directory[addr].DirectoryState;
+ return getDirectoryEntry(addr).DirectoryState;
}
}
@@ -163,7 +156,7 @@
if (TBEs.isPresent(addr)) {
TBEs[addr].TBEState := state;
}
- directory[addr].DirectoryState := state;
+ getDirectoryEntry(addr).DirectoryState := state;
}
MessageBuffer triggerQueue, ordered="true";
@@ -454,7 +447,7 @@
out_msg.Sender := machineID;
out_msg.OriginalRequestorMachId := in_msg.Requestor;
out_msg.MessageSize := in_msg.MessageSize;
- out_msg.DataBlk := directory[address].DataBlk;
+ out_msg.DataBlk := getDirectoryEntry(address).DataBlk;
DEBUG_EXPR(out_msg);
}
}
@@ -468,7 +461,7 @@
out_msg.Sender := machineID;
out_msg.OriginalRequestorMachId := in_msg.Requestor;
out_msg.MessageSize := in_msg.MessageSize;
- out_msg.DataBlk := directory[address].DataBlk;
+ out_msg.DataBlk := getDirectoryEntry(address).DataBlk;
DEBUG_EXPR(out_msg);
}
}
@@ -564,15 +557,15 @@
peek(unblockNetwork_in, ResponseMsg) {
assert(in_msg.Dirty);
assert(in_msg.MessageSize == MessageSizeType:Writeback_Data);
- directory[address].DataBlk := in_msg.DataBlk;
+ getDirectoryEntry(address).DataBlk := in_msg.DataBlk;
DEBUG_EXPR(in_msg.Address);
DEBUG_EXPR(in_msg.DataBlk);
}
}
action(dwt_writeDmaDataFromTBE, "dwt", desc="DMA Write data to memory from
TBE") {
- directory[address].DataBlk := TBEs[address].DataBlk;
- directory[address].DataBlk.copyPartial(TBEs[address].DmaDataBlk,
addressOffset(TBEs[address].PhysicalAddress), TBEs[address].Len);
+ getDirectoryEntry(address).DataBlk := TBEs[address].DataBlk;
+ getDirectoryEntry(address).DataBlk.copyPartial(TBEs[address].DmaDataBlk,
addressOffset(TBEs[address].PhysicalAddress), TBEs[address].Len);
}
action(a_assertCacheData, "ac", desc="Assert that a cache provided the
data") {
@@ -610,7 +603,7 @@
// implementation. We include the data in the "dataless"
// message so we can assert the clean data matches the datablock
// in memory
- assert(directory[address].DataBlk == in_msg.DataBlk);
+ assert(getDirectoryEntry(address).DataBlk == in_msg.DataBlk);
}
}
diff -r 5a61a8a9009a -r 898047a3672c src/mem/protocol/RubySlicc_Types.sm
--- a/src/mem/protocol/RubySlicc_Types.sm Fri Jan 29 20:29:18 2010 -0800
+++ b/src/mem/protocol/RubySlicc_Types.sm Fri Jan 29 20:29:19 2010 -0800
@@ -98,6 +98,30 @@
void profileNack(Address, int, int, uint64);
}
+external_type(AbstractEntry, primitive="yes");
+
+external_type(DirectoryMemory) {
+ AbstractEntry lookup(Address);
+ bool isPresent(Address);
+}
+
+external_type(AbstractCacheEntry, primitive="yes");
+
+external_type(CacheMemory) {
+ bool cacheAvail(Address);
+ Address cacheProbe(Address);
+ void allocate(Address, AbstractCacheEntry);
+ void deallocate(Address);
+ AbstractCacheEntry lookup(Address);
+ void changePermission(Address, AccessPermission);
+ bool isTagPresent(Address);
+ void profileMiss(CacheMsg);
+}
+
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev