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();
}
#ifndef PARTIAL_FUNC_READS
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 line_address = makeLineAddress(address, m_block_size_bits);
@@ -645,9 +653,9 @@ RubySystem::functionalRead(PacketPtr pkt)
return false;
}
#else
bool
RubySystem::functionalRead(PacketPtr pkt)
RubySystem::partialFunctionalRead(PacketPtr pkt)
{
Addr address(pkt->getAddr());
Addr line_address = makeLineAddress(address, m_block_size_bits);
@@ -742,7 +750,6 @@ RubySystem::functionalRead(PacketPtr pkt)
return bytes.isFull();
}
#endif
// The function searches through all the buffers that exist in different
// 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);
void processRubyEvent();
// Called from `functionalRead` depending on if the protocol needs
// partial functional reads.
bool simpleFunctionalRead(PacketPtr pkt);
bool partialFunctionalRead(PacketPtr pkt);
private:
// configuration parameters
bool m_randomization;

View File

@@ -43,11 +43,6 @@ Import('*')
if not env['CONF']['RUBY']:
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']:
SimObject('GPUCoalescer.py', sim_objects=['RubyGPUCoalescer'])
SimObject('RubySystem.py', sim_objects=['RubySystem'])

View File

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