mem-ruby: MessageBuffer capacity check
authorTiago Muck <tiago.muck@arm.com>
Wed, 5 Jun 2019 20:34:13 +0000 (15:34 -0500)
committerTiago Mück <tiago.muck@arm.com>
Fri, 9 Oct 2020 00:07:27 +0000 (00:07 +0000)
Trip assert if call enqueue on a full message buffer.

Change-Id: I842183d8bf2c681787f1b6ac23c95825095ad05d
Signed-off-by: Tiago Mück <tiago.muck@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31254
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
src/mem/ruby/network/MessageBuffer.cc

index 3db8515a37d5800d14b91b43ca38d3e493db3200..fb1d734dce570bec27ffdba6c8ddbeaee1b96539 100644 (file)
@@ -225,6 +225,9 @@ MessageBuffer::enqueue(MsgPtr message, Tick current_time, Tick delta)
     // Increment the number of messages statistic
     m_buf_msgs++;
 
+    assert((m_max_size == 0) ||
+           ((m_prio_heap.size() + m_stall_map_size) <= m_max_size));
+
     DPRINTF(RubyQueue, "Enqueue arrival_time: %lld, Message: %s\n",
             arrival_time, *(message.get()));