From: Tiago Muck Date: Thu, 2 May 2019 23:36:45 +0000 (-0500) Subject: mem-ruby: Allow MessageBuffer functional reads X-Git-Tag: v20.0.0.0~173 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cbb14a63631d8729f82db0f5a1df2d8b9ab8e449;p=gem5.git mem-ruby: Allow MessageBuffer functional reads Valid lines withing unhandled messages may need to be checked when the line is in a transient state. Change-Id: I433e9bb960680348c25bf19ace2d405109380241 Signed-off-by: Tiago Mück Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22019 Tested-by: kokoro Reviewed-by: Bradford Beckmann Maintainer: Jason Lowe-Power --- diff --git a/src/mem/ruby/network/MessageBuffer.cc b/src/mem/ruby/network/MessageBuffer.cc index f8cab3ceb..f5562dc6b 100644 --- a/src/mem/ruby/network/MessageBuffer.cc +++ b/src/mem/ruby/network/MessageBuffer.cc @@ -1,4 +1,16 @@ /* + * Copyright (c) 2019 ARM Limited + * All rights reserved. + * + * The license below extends only to copyright in the software and shall + * not be construed as granting a license to any other intellectual + * property including but not limited to intellectual property relating + * to a hardware implementation of the functionality of the software + * licensed hereunder. You may use the software subject to the license + * terms below provided that you ensure that this notice is replicated + * unmodified and in its entirety in all distributions of the software, + * modified or unmodified, in source code or in binary form. + * * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood * All rights reserved. * @@ -438,17 +450,21 @@ MessageBuffer::regStats() } uint32_t -MessageBuffer::functionalWrite(Packet *pkt) +MessageBuffer::functionalAccess(Packet *pkt, bool is_read) { - uint32_t num_functional_writes = 0; + DPRINTF(RubyQueue, "functional %s for %#x\n", + is_read ? "read" : "write", pkt->getAddr()); + + uint32_t num_functional_accesses = 0; // Check the priority heap and write any messages that may // correspond to the address in the packet. for (unsigned int i = 0; i < m_prio_heap.size(); ++i) { Message *msg = m_prio_heap[i].get(); - if (msg->functionalWrite(pkt)) { - num_functional_writes++; - } + if (is_read && msg->functionalRead(pkt)) + return 1; + else if (!is_read && msg->functionalWrite(pkt)) + num_functional_accesses++; } // Check the stall queue and write any messages that may @@ -461,13 +477,14 @@ MessageBuffer::functionalWrite(Packet *pkt) it != (map_iter->second).end(); ++it) { Message *msg = (*it).get(); - if (msg->functionalWrite(pkt)) { - num_functional_writes++; - } + if (is_read && msg->functionalRead(pkt)) + return 1; + else if (!is_read && msg->functionalWrite(pkt)) + num_functional_accesses++; } } - return num_functional_writes; + return num_functional_accesses; } MessageBuffer * diff --git a/src/mem/ruby/network/MessageBuffer.hh b/src/mem/ruby/network/MessageBuffer.hh index f92d56501..0e11529bb 100644 --- a/src/mem/ruby/network/MessageBuffer.hh +++ b/src/mem/ruby/network/MessageBuffer.hh @@ -1,4 +1,16 @@ /* + * Copyright (c) 2019 ARM Limited + * All rights reserved. + * + * The license below extends only to copyright in the software and shall + * not be construed as granting a license to any other intellectual + * property including but not limited to intellectual property relating + * to a hardware implementation of the functionality of the software + * licensed hereunder. You may use the software subject to the license + * terms below provided that you ensure that this notice is replicated + * unmodified and in its entirety in all distributions of the software, + * modified or unmodified, in source code or in binary form. + * * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood * All rights reserved. * @@ -133,12 +145,25 @@ class MessageBuffer : public SimObject // Function for figuring out if any of the messages in the buffer need // to be updated with the data from the packet. // Return value indicates the number of messages that were updated. - // This required for debugging the code. - uint32_t functionalWrite(Packet *pkt); + uint32_t functionalWrite(Packet *pkt) + { + return functionalAccess(pkt, false); + } + + // Function for figuring if message in the buffer has valid data for + // the packet. + // Returns true only if a message was found with valid data and the + // read was performed. + bool functionalRead(Packet *pkt) + { + return functionalAccess(pkt, true) == 1; + } private: void reanalyzeList(std::list &, Tick); + uint32_t functionalAccess(Packet *pkt, bool is_read); + private: // Data Members (m_ prefix) //! Consumer to signal a wakeup(), can be NULL