mem-ruby: Use runtime protocol instead of #defines

This removes two #defines: PARTIAL_FUNC_READS and PROTOCOL_<protocol>.
Instead, update the code to use the runtime information about which
protocol we are using.

Change-Id: Icb6f10fc2d3fd59128c62f9f6e37b52ef2581b61
Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
This commit is contained in:
Jason Lowe-Power
2024-10-24 13:54:25 -07:00
committed by Bobby R. Bruce
parent b7ce3040de
commit 9a904478eb
4 changed files with 25 additions and 15 deletions

View File

@@ -504,9 +504,17 @@ RubySystem::resetStats()
ClockedObject::resetStats(); ClockedObject::resetStats();
} }
#ifndef PARTIAL_FUNC_READS
bool bool
RubySystem::functionalRead(PacketPtr pkt) RubySystem::functionalRead(PacketPtr pkt) {
if (protocolInfo->getPartialFuncReads()) {
return partialFunctionalRead(pkt);
} else {
return simpleFunctionalRead(pkt);
}
}
bool
RubySystem::simpleFunctionalRead(PacketPtr pkt)
{ {
Addr address(pkt->getAddr()); Addr address(pkt->getAddr());
Addr line_address = makeLineAddress(address, m_block_size_bits); Addr line_address = makeLineAddress(address, m_block_size_bits);
@@ -645,9 +653,9 @@ RubySystem::functionalRead(PacketPtr pkt)
return false; return false;
} }
#else
bool bool
RubySystem::functionalRead(PacketPtr pkt) RubySystem::partialFunctionalRead(PacketPtr pkt)
{ {
Addr address(pkt->getAddr()); Addr address(pkt->getAddr());
Addr line_address = makeLineAddress(address, m_block_size_bits); Addr line_address = makeLineAddress(address, m_block_size_bits);
@@ -742,7 +750,6 @@ RubySystem::functionalRead(PacketPtr pkt)
return bytes.isFull(); return bytes.isFull();
} }
#endif
// The function searches through all the buffers that exist in different // The function searches through all the buffers that exist in different
// cache, directory and memory controllers, and in the network components // cache, directory and memory controllers, and in the network components

View File

@@ -137,6 +137,12 @@ class RubySystem : public ClockedObject
uint64_t uncompressed_trace_size); uint64_t uncompressed_trace_size);
void processRubyEvent(); void processRubyEvent();
// Called from `functionalRead` depending on if the protocol needs
// partial functional reads.
bool simpleFunctionalRead(PacketPtr pkt);
bool partialFunctionalRead(PacketPtr pkt);
private: private:
// configuration parameters // configuration parameters
bool m_randomization; bool m_randomization;

View File

@@ -43,11 +43,6 @@ Import('*')
if not env['CONF']['RUBY']: if not env['CONF']['RUBY']:
Return() Return()
env.Append(CPPDEFINES=['PROTOCOL_' + env['CONF']['PROTOCOL']])
if env['CONF']['NEED_PARTIAL_FUNC_READS']:
env.Append(CPPDEFINES=['PARTIAL_FUNC_READS'])
if env['CONF']['BUILD_GPU']: if env['CONF']['BUILD_GPU']:
SimObject('GPUCoalescer.py', sim_objects=['RubyGPUCoalescer']) SimObject('GPUCoalescer.py', sim_objects=['RubyGPUCoalescer'])
SimObject('RubySystem.py', sim_objects=['RubySystem']) SimObject('RubySystem.py', sim_objects=['RubySystem'])

View File

@@ -963,11 +963,13 @@ Sequencer::makeRequest(PacketPtr pkt)
if (pkt->isWrite()) { if (pkt->isWrite()) {
DPRINTF(RubySequencer, "Issuing SC\n"); DPRINTF(RubySequencer, "Issuing SC\n");
primary_type = RubyRequestType_Store_Conditional; primary_type = RubyRequestType_Store_Conditional;
#if defined (PROTOCOL_MESI_Three_Level) || defined (PROTOCOL_MESI_Three_Level_HTM) const ProtocolInfo &protocol_info =
secondary_type = RubyRequestType_Store_Conditional; m_ruby_system->getProtocolInfo();
#else if (protocol_info.getUseSecondaryStoreConditional()) {
secondary_type = RubyRequestType_ST; secondary_type = RubyRequestType_Store_Conditional;
#endif } else {
secondary_type = RubyRequestType_ST;
}
} else { } else {
DPRINTF(RubySequencer, "Issuing LL\n"); DPRINTF(RubySequencer, "Issuing LL\n");
assert(pkt->isRead()); assert(pkt->isRead());