ruby: Converted MOESI_hammer dma cntrl to new config system
This commit is contained in:
parent
3b290a35ac
commit
2a0555470c
5 changed files with 48 additions and 12 deletions
|
@ -104,6 +104,7 @@ class L2Cache(RubyCache):
|
||||||
#
|
#
|
||||||
l1_cntrl_nodes = []
|
l1_cntrl_nodes = []
|
||||||
dir_cntrl_nodes = []
|
dir_cntrl_nodes = []
|
||||||
|
dma_cntrl_nodes = []
|
||||||
|
|
||||||
#
|
#
|
||||||
# Must create the individual controllers before the network to ensure the
|
# Must create the individual controllers before the network to ensure the
|
||||||
|
@ -138,12 +139,15 @@ for (i, cpu) in enumerate(cpus):
|
||||||
directory = RubyDirectoryMemory(),
|
directory = RubyDirectoryMemory(),
|
||||||
memBuffer = RubyMemoryControl())
|
memBuffer = RubyMemoryControl())
|
||||||
|
|
||||||
|
dma_cntrl = DMA_Controller(version = i,
|
||||||
|
dma_sequencer = DMASequencer())
|
||||||
#
|
#
|
||||||
# As noted above: Two independent list are track to maintain the order of
|
# As noted above: Two independent list are track to maintain the order of
|
||||||
# nodes/controllers assumed by the ruby network
|
# nodes/controllers assumed by the ruby network
|
||||||
#
|
#
|
||||||
l1_cntrl_nodes.append(l1_cntrl)
|
l1_cntrl_nodes.append(l1_cntrl)
|
||||||
dir_cntrl_nodes.append(dir_cntrl)
|
dir_cntrl_nodes.append(dir_cntrl)
|
||||||
|
dma_cntrl_nodes.append(dma_cntrl)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Finally tie the memtester ports to the correct system ports
|
# Finally tie the memtester ports to the correct system ports
|
||||||
|
@ -157,7 +161,8 @@ for (i, cpu) in enumerate(cpus):
|
||||||
# constructor.
|
# constructor.
|
||||||
#
|
#
|
||||||
network = SimpleNetwork(topology = makeCrossbar(l1_cntrl_nodes + \
|
network = SimpleNetwork(topology = makeCrossbar(l1_cntrl_nodes + \
|
||||||
dir_cntrl_nodes))
|
dir_cntrl_nodes + \
|
||||||
|
dma_cntrl_nodes))
|
||||||
|
|
||||||
mem_size_mb = sum([int(dir_cntrl.directory.size_mb) \
|
mem_size_mb = sum([int(dir_cntrl.directory.size_mb) \
|
||||||
for dir_cntrl in dir_cntrl_nodes])
|
for dir_cntrl in dir_cntrl_nodes])
|
||||||
|
@ -166,7 +171,9 @@ system.ruby = RubySystem(clock = '1GHz',
|
||||||
network = network,
|
network = network,
|
||||||
profiler = RubyProfiler(),
|
profiler = RubyProfiler(),
|
||||||
tracer = RubyTracer(),
|
tracer = RubyTracer(),
|
||||||
debug = RubyDebug(),
|
debug = RubyDebug(filter_string = 'qQin',
|
||||||
|
verbosity_string = 'high',
|
||||||
|
protocol_trace = True),
|
||||||
mem_size_mb = mem_size_mb)
|
mem_size_mb = mem_size_mb)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,8 @@
|
||||||
|
|
||||||
|
|
||||||
machine(DMA, "DMA Controller")
|
machine(DMA, "DMA Controller")
|
||||||
: int request_latency = 6
|
: DMASequencer * dma_sequencer,
|
||||||
|
int request_latency = 6
|
||||||
{
|
{
|
||||||
|
|
||||||
MessageBuffer responseFromDir, network="From", virtual_network="4", ordered="true", no_vector="true";
|
MessageBuffer responseFromDir, network="From", virtual_network="4", ordered="true", no_vector="true";
|
||||||
|
@ -47,20 +48,14 @@ machine(DMA, "DMA Controller")
|
||||||
Ack, desc="DMA write to memory completed";
|
Ack, desc="DMA write to memory completed";
|
||||||
}
|
}
|
||||||
|
|
||||||
external_type(DMASequencer) {
|
|
||||||
void ackCallback();
|
|
||||||
void dataCallback(DataBlock);
|
|
||||||
}
|
|
||||||
|
|
||||||
MessageBuffer mandatoryQueue, ordered="false", no_vector="true";
|
MessageBuffer mandatoryQueue, ordered="false", no_vector="true";
|
||||||
DMASequencer dma_sequencer, factory='RubySystem::getDMASequencer(m_cfg["dma_sequencer"])', no_vector="true";
|
|
||||||
State cur_state, no_vector="true";
|
State cur_state, no_vector="true";
|
||||||
|
|
||||||
State getState(Address addr) {
|
State getState(Address addr) {
|
||||||
return cur_state;
|
return cur_state;
|
||||||
}
|
}
|
||||||
void setState(Address addr, State state) {
|
void setState(Address addr, State state) {
|
||||||
cur_state := state;
|
cur_state := state;
|
||||||
}
|
}
|
||||||
|
|
||||||
out_port(reqToDirectory_out, DMARequestMsg, reqToDirectory, desc="...");
|
out_port(reqToDirectory_out, DMARequestMsg, reqToDirectory, desc="...");
|
||||||
|
|
|
@ -122,6 +122,11 @@ external_type(MemoryControl, inport="yes", outport="yes") {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
external_type(DMASequencer) {
|
||||||
|
void ackCallback();
|
||||||
|
void dataCallback(DataBlock);
|
||||||
|
}
|
||||||
|
|
||||||
external_type(TimerTable, inport="yes") {
|
external_type(TimerTable, inport="yes") {
|
||||||
bool isReady();
|
bool isReady();
|
||||||
Address readyAddress();
|
Address readyAddress();
|
||||||
|
|
|
@ -8,6 +8,10 @@
|
||||||
#include "mem/protocol/SequencerRequestType.hh"
|
#include "mem/protocol/SequencerRequestType.hh"
|
||||||
#include "mem/ruby/system/System.hh"
|
#include "mem/ruby/system/System.hh"
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fix me: This code needs comments!
|
||||||
|
//
|
||||||
|
|
||||||
DMASequencer::DMASequencer(const Params *p)
|
DMASequencer::DMASequencer(const Params *p)
|
||||||
: RubyPort(p)
|
: RubyPort(p)
|
||||||
{
|
{
|
||||||
|
@ -15,6 +19,7 @@ DMASequencer::DMASequencer(const Params *p)
|
||||||
|
|
||||||
void DMASequencer::init()
|
void DMASequencer::init()
|
||||||
{
|
{
|
||||||
|
RubyPort::init();
|
||||||
m_is_busy = false;
|
m_is_busy = false;
|
||||||
m_data_block_mask = ~ (~0 << RubySystem::getBlockSizeBits());
|
m_data_block_mask = ~ (~0 << RubySystem::getBlockSizeBits());
|
||||||
}
|
}
|
||||||
|
@ -58,11 +63,16 @@ int64_t DMASequencer::makeRequest(const RubyRequest & request)
|
||||||
msg.getLineAddress() = line_address(msg.getPhysicalAddress());
|
msg.getLineAddress() = line_address(msg.getPhysicalAddress());
|
||||||
msg.getType() = write ? SequencerRequestType_ST : SequencerRequestType_LD;
|
msg.getType() = write ? SequencerRequestType_ST : SequencerRequestType_LD;
|
||||||
int offset = paddr & m_data_block_mask;
|
int offset = paddr & m_data_block_mask;
|
||||||
|
|
||||||
msg.getLen() = (offset + len) <= RubySystem::getBlockSizeBytes() ?
|
msg.getLen() = (offset + len) <= RubySystem::getBlockSizeBytes() ?
|
||||||
len :
|
len :
|
||||||
RubySystem::getBlockSizeBytes() - offset;
|
RubySystem::getBlockSizeBytes() - offset;
|
||||||
if (write)
|
|
||||||
|
if (write) {
|
||||||
msg.getDataBlk().setData(data, offset, msg.getLen());
|
msg.getDataBlk().setData(data, offset, msg.getLen());
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(m_mandatory_q_ptr != NULL);
|
||||||
m_mandatory_q_ptr->enqueue(msg);
|
m_mandatory_q_ptr->enqueue(msg);
|
||||||
active_request.bytes_issued += msg.getLen();
|
active_request.bytes_issued += msg.getLen();
|
||||||
|
|
||||||
|
@ -82,14 +92,18 @@ void DMASequencer::issueNext()
|
||||||
SequencerMsg msg;
|
SequencerMsg msg;
|
||||||
msg.getPhysicalAddress() = Address(active_request.start_paddr +
|
msg.getPhysicalAddress() = Address(active_request.start_paddr +
|
||||||
active_request.bytes_completed);
|
active_request.bytes_completed);
|
||||||
|
|
||||||
assert((msg.getPhysicalAddress().getAddress() & m_data_block_mask) == 0);
|
assert((msg.getPhysicalAddress().getAddress() & m_data_block_mask) == 0);
|
||||||
msg.getLineAddress() = line_address(msg.getPhysicalAddress());
|
msg.getLineAddress() = line_address(msg.getPhysicalAddress());
|
||||||
|
|
||||||
msg.getType() = (active_request.write ? SequencerRequestType_ST :
|
msg.getType() = (active_request.write ? SequencerRequestType_ST :
|
||||||
SequencerRequestType_LD);
|
SequencerRequestType_LD);
|
||||||
|
|
||||||
msg.getLen() = (active_request.len -
|
msg.getLen() = (active_request.len -
|
||||||
active_request.bytes_completed < RubySystem::getBlockSizeBytes() ?
|
active_request.bytes_completed < RubySystem::getBlockSizeBytes() ?
|
||||||
active_request.len - active_request.bytes_completed :
|
active_request.len - active_request.bytes_completed :
|
||||||
RubySystem::getBlockSizeBytes());
|
RubySystem::getBlockSizeBytes());
|
||||||
|
|
||||||
if (active_request.write) {
|
if (active_request.write) {
|
||||||
msg.getDataBlk().setData(&active_request.data[active_request.bytes_completed],
|
msg.getDataBlk().setData(&active_request.data[active_request.bytes_completed],
|
||||||
0, msg.getLen());
|
0, msg.getLen());
|
||||||
|
@ -97,6 +111,8 @@ void DMASequencer::issueNext()
|
||||||
} else {
|
} else {
|
||||||
msg.getType() = SequencerRequestType_LD;
|
msg.getType() = SequencerRequestType_LD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(m_mandatory_q_ptr != NULL);
|
||||||
m_mandatory_q_ptr->enqueue(msg);
|
m_mandatory_q_ptr->enqueue(msg);
|
||||||
active_request.bytes_issued += msg.getLen();
|
active_request.bytes_issued += msg.getLen();
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ python_class_map = {"int": "Int",
|
||||||
"Sequencer": "RubySequencer",
|
"Sequencer": "RubySequencer",
|
||||||
"DirectoryMemory": "RubyDirectoryMemory",
|
"DirectoryMemory": "RubyDirectoryMemory",
|
||||||
"MemoryControl": "RubyMemoryControl",
|
"MemoryControl": "RubyMemoryControl",
|
||||||
|
"DMASequencer": "DMASequencer"
|
||||||
}
|
}
|
||||||
|
|
||||||
class StateMachine(Symbol):
|
class StateMachine(Symbol):
|
||||||
|
@ -359,7 +360,7 @@ $c_ident::$c_ident(const Params *p)
|
||||||
#
|
#
|
||||||
contains_sequencer = False
|
contains_sequencer = False
|
||||||
for param in self.config_parameters:
|
for param in self.config_parameters:
|
||||||
if param.name == "sequencer":
|
if param.name == "sequencer" or param.name == "dma_sequencer":
|
||||||
contains_sequencer = True
|
contains_sequencer = True
|
||||||
if param.pointer:
|
if param.pointer:
|
||||||
code('m_${{param.name}}_ptr = p->${{param.name}};')
|
code('m_${{param.name}}_ptr = p->${{param.name}};')
|
||||||
|
@ -378,7 +379,19 @@ $c_ident::$c_ident(const Params *p)
|
||||||
code('''
|
code('''
|
||||||
m_sequencer_ptr->setController(this);
|
m_sequencer_ptr->setController(this);
|
||||||
''')
|
''')
|
||||||
|
#
|
||||||
|
# For the DMA controller, pass the sequencer a pointer to the
|
||||||
|
# controller.
|
||||||
|
#
|
||||||
|
if self.ident == "DMA":
|
||||||
|
if not contains_sequencer:
|
||||||
|
self.error("The DMA controller must include the sequencer " \
|
||||||
|
"configuration parameter")
|
||||||
|
|
||||||
|
code('''
|
||||||
|
m_dma_sequencer_ptr->setController(this);
|
||||||
|
''')
|
||||||
|
|
||||||
code('m_num_controllers++;')
|
code('m_num_controllers++;')
|
||||||
for var in self.objects:
|
for var in self.objects:
|
||||||
if var.ident.find("mandatoryQueue") >= 0:
|
if var.ident.find("mandatoryQueue") >= 0:
|
||||||
|
|
Loading…
Reference in a new issue