Ruby: pass Packet->Req->contextId() to Ruby.
authorLisa Hsu <Lisa.Hsu@amd.com>
Fri, 1 Apr 2011 00:17:47 +0000 (17:17 -0700)
committerLisa Hsu <Lisa.Hsu@amd.com>
Fri, 1 Apr 2011 00:17:47 +0000 (17:17 -0700)
It is useful for Ruby to understand from whence request packets came.
This has all request packets going into Ruby pass the contextId value, if
it exists.  This supplants the old libruby proc_id value passed around in
all the Messages, so I've also removed the unused unsigned proc_id; member
generated by SLICC for all Message types.

src/mem/protocol/RubySlicc_Types.sm
src/mem/ruby/slicc_interface/RubyRequest.hh
src/mem/ruby/system/Sequencer.cc
src/mem/slicc/symbols/Type.py

index 118cbc2f0430c2caa8746ea93e15c6ee50a88814..add3d979b3c12aec3fd990749e923169f3344fed 100644 (file)
@@ -117,6 +117,7 @@ structure(RubyRequest, desc="...", interface="Message", external="yes") {
   RubyAccessMode AccessMode, desc="user/supervisor access type";
   int Size,                  desc="size in bytes of access";
   PrefetchBit Prefetch,      desc="Is this a prefetch request";
+  int contextId,             desc="this goes away but must be replace with Nilay";
 }
 
 external_type(AbstractEntry, primitive="yes");
index 06ca0de1cf3707f95793db80352d012e3de3c600..8ac43a8e19c08f5a57f664802a9bf308dbd23f77 100644 (file)
@@ -52,7 +52,7 @@ class RubyRequest : public Message
     PrefetchBit m_Prefetch;
     uint8_t* data;
     PacketPtr pkt;
-    unsigned proc_id;
+    unsigned m_contextId;
 
     RubyRequest() {}
     RubyRequest(uint64_t _paddr, uint8_t* _data, int _len, uint64_t _pc,
@@ -67,7 +67,7 @@ class RubyRequest : public Message
           m_Prefetch(_pb),
           data(_data),
           pkt(_pkt),
-          proc_id(_proc_id)
+          m_contextId(_proc_id)
     {
       m_LineAddress = m_PhysicalAddress;
       m_LineAddress.makeLineAddress();
index 94ba6c2d344ed1758fdf3b8216f15d76bad617b6..94d41ffe460345ac9787d01b48541af629b74cc0 100644 (file)
@@ -671,11 +671,13 @@ Sequencer::issueRequest(const RubyRequest& request)
 
     Address line_addr(request.m_PhysicalAddress);
     line_addr.makeLineAddress();
+    int proc_id = request.pkt->req->hasContextId() ?
+        request.pkt->req->contextId() : -1;
     RubyRequest *msg = new RubyRequest(request.m_PhysicalAddress.getAddress(),
                                        request.data, request.m_Size,
                                        request.m_ProgramCounter.getAddress(),
                                        ctype, amtype, request.pkt,
-                                       PrefetchBit_No, request.proc_id);
+                                       PrefetchBit_No, proc_id);
 
     DPRINTFR(ProtocolTrace, "%7s %3s %10s%20s %6s>%-6s %s %s\n",
         g_eventQueue_ptr->getTime(), m_version, "Seq", "Begin", "", "",
index da9ecba3a026be16349135a853fb48e48eb18339..9aea286d79ea3e84d909f2d79be5cdce7df45057 100644 (file)
@@ -261,9 +261,6 @@ $klass ${{self.c_ident}}$parent
             for dm in self.data_members.values():
                 code('m_${{dm.ident}} = other.m_${{dm.ident}};')
 
-            if self.isMessage:
-                code('proc_id = other.proc_id;')
-
             code.dedent()
             code('}')
 
@@ -272,9 +269,6 @@ $klass ${{self.c_ident}}$parent
             params = [ 'const %s& local_%s' % (dm.type.c_ident, dm.ident) \
                        for dm in self.data_members.itervalues() ]
 
-            if self.isMessage:
-                params.append('const unsigned local_proc_id')
-            
             params = ', '.join(params)
             code('${{self.c_ident}}($params)')
 
@@ -289,9 +283,6 @@ $klass ${{self.c_ident}}$parent
                 if "nextLineCallHack" in dm:
                     code('m_${{dm.ident}}${{dm["nextLineCallHack"]}};')
 
-            if self.isMessage:
-                code('proc_id = local_proc_id;')
-            
             code.dedent()
             code('}')
 
@@ -377,9 +368,6 @@ set${{dm.ident}}(const ${{dm.type.c_ident}}& local_${{dm.ident}})
 
                 code('$const${{dm.type.c_ident}} m_${{dm.ident}}$init;')
 
-        if self.isMessage:
-            code('unsigned proc_id;')
-
         code.dedent()
         code('};')