diff options
author | Joel Hestness <jthestness@gmail.com> | 2015-08-14 00:19:44 -0500 |
---|---|---|
committer | Joel Hestness <jthestness@gmail.com> | 2015-08-14 00:19:44 -0500 |
commit | 581bae9ecbafd5e94c5405ca925a55cc6e5d7488 (patch) | |
tree | c4e9136882984e561b7c1c618361e4262b482869 /src/mem/ruby/network/MessageBuffer.cc | |
parent | bf06911b3f6d992dc78489d66410f4580a17db7b (diff) | |
download | gem5-581bae9ecbafd5e94c5405ca925a55cc6e5d7488.tar.xz |
ruby: Expose MessageBuffers as SimObjects
Expose MessageBuffers from SLICC controllers as SimObjects that can be
manipulated in Python. This patch has numerous benefits:
1) First and foremost, it exposes MessageBuffers as SimObjects that can be
manipulated in Python code. This allows parameters to be set and checked in
Python code to avoid obfuscating parameters within protocol files. Further, now
as SimObjects, MessageBuffer parameters are printed to config output files as a
way to track parameters across simulations (e.g. buffer sizes)
2) Cleans up special-case code for responseFromMemory buffers, and aligns their
instantiation and use with mandatoryQueue buffers. These two special buffers
are the only MessageBuffers that are exposed to components outside of SLICC
controllers, and they're both slave ends of these buffers. They should be
exposed outside of SLICC in the same way, and this patch does it.
3) Distinguishes buffer-specific parameters from buffer-to-network parameters.
Specifically, buffer size, randomization, ordering, recycle latency, and ports
are all specific to a MessageBuffer, while the virtual network ID and type are
intrinsics of how the buffer is connected to network ports. The former are
specified in the Python object, while the latter are specified in the
controller *.sm files. Unlike buffer-specific parameters, which may need to
change depending on the simulated system structure, buffer-to-network
parameters can be specified statically for most or all different simulated
systems.
Diffstat (limited to 'src/mem/ruby/network/MessageBuffer.cc')
-rw-r--r-- | src/mem/ruby/network/MessageBuffer.cc | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/mem/ruby/network/MessageBuffer.cc b/src/mem/ruby/network/MessageBuffer.cc index 484d2876b..e9bbd0059 100644 --- a/src/mem/ruby/network/MessageBuffer.cc +++ b/src/mem/ruby/network/MessageBuffer.cc @@ -39,25 +39,23 @@ using namespace std; using m5::stl_helpers::operator<<; -MessageBuffer::MessageBuffer(const string &name) - : m_time_last_time_size_checked(0), m_time_last_time_enqueue(0), - m_time_last_time_pop(0), m_last_arrival_time(0) +MessageBuffer::MessageBuffer(const Params *p) + : SimObject(p), m_recycle_latency(p->recycle_latency), + m_max_size(p->buffer_size), m_time_last_time_size_checked(0), + m_time_last_time_enqueue(0), m_time_last_time_pop(0), + m_last_arrival_time(0), m_strict_fifo(p->ordered), + m_randomization(p->randomization) { m_msg_counter = 0; m_consumer = NULL; m_sender = NULL; m_receiver = NULL; - m_ordering_set = false; - m_strict_fifo = true; - m_max_size = 0; - m_randomization = true; m_size_last_time_size_checked = 0; m_size_at_cycle_start = 0; m_msgs_this_cycle = 0; m_not_avail_count = 0; m_priority_rank = 0; - m_name = name; m_stall_msg_map.clear(); m_input_link_id = 0; @@ -144,8 +142,6 @@ random_time() void MessageBuffer::enqueue(MsgPtr message, Cycles delta) { - assert(m_ordering_set); - // record current time incase we have a pop that also adjusts my size if (m_time_last_time_enqueue < m_sender->curCycle()) { m_msgs_this_cycle = 0; // first msg this cycle @@ -184,7 +180,7 @@ MessageBuffer::enqueue(MsgPtr message, Cycles delta) if (arrival_time < m_last_arrival_time) { panic("FIFO ordering violated: %s name: %s current time: %d " "delta: %d arrival_time: %d last arrival_time: %d\n", - *this, m_name, current_time, + *this, name(), current_time, delta * m_sender->clockPeriod(), arrival_time, m_last_arrival_time); } @@ -356,7 +352,7 @@ MessageBuffer::print(ostream& out) const vector<MsgPtr> copy(m_prio_heap); sort_heap(copy.begin(), copy.end(), greater<MsgPtr>()); - ccprintf(out, "%s] %s", copy, m_name); + ccprintf(out, "%s] %s", copy, name()); } bool @@ -424,3 +420,9 @@ MessageBuffer::functionalWrite(Packet *pkt) return num_functional_writes; } + +MessageBuffer * +MessageBufferParams::create() +{ + return new MessageBuffer(this); +} |