summaryrefslogtreecommitdiff
path: root/src/mem
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem')
-rw-r--r--src/mem/ruby/common/Global.hh7
-rw-r--r--src/mem/ruby/network/garnet/BaseGarnetNetwork.cc2
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc6
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc8
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh29
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc38
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc4
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh2
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc6
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh9
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.cc4
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc30
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc12
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc15
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc31
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh18
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc8
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh4
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc11
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh17
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc6
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc27
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc6
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/Router.cc56
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/flit.cc6
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/flit.hh2
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc8
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh4
-rw-r--r--src/mem/ruby/network/orion/NetworkPower.cc6
-rw-r--r--src/mem/ruby/slicc_interface/Message.hh9
-rw-r--r--src/mem/ruby/slicc_interface/NetworkMessage.hh6
-rw-r--r--src/mem/ruby/slicc_interface/RubyRequest.hh17
-rw-r--r--src/mem/ruby/slicc_interface/RubySlicc_Util.hh5
-rw-r--r--src/mem/ruby/structures/Prefetcher.hh2
-rw-r--r--src/mem/ruby/system/DMASequencer.cc4
-rw-r--r--src/mem/ruby/system/Sequencer.cc2
-rw-r--r--src/mem/ruby/system/WireBuffer.cc2
-rw-r--r--src/mem/slicc/ast/EnqueueStatementAST.py3
-rw-r--r--src/mem/slicc/symbols/Type.py29
39 files changed, 235 insertions, 226 deletions
diff --git a/src/mem/ruby/common/Global.hh b/src/mem/ruby/common/Global.hh
index f76a1a26b..d6597be89 100644
--- a/src/mem/ruby/common/Global.hh
+++ b/src/mem/ruby/common/Global.hh
@@ -34,12 +34,5 @@
class RubySystem;
extern RubySystem* g_system_ptr;
-// FIXME: this is required by the contructor of Directory_Entry.hh.
-// It can't go into slicc_util.hh because it opens a can of ugly worms
-extern inline int max_tokens()
-{
- return 1024;
-}
-
#endif // __MEM_RUBY_COMMON_GLOBAL_HH__
diff --git a/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc b/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc
index 78b4b2d42..e3196a0e7 100644
--- a/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc
+++ b/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc
@@ -127,7 +127,7 @@ BaseGarnetNetwork::getFromNetQueue(NodeID id, bool ordered, int network_num,
void
BaseGarnetNetwork::clearStats()
{
- m_ruby_start = g_system_ptr->getTime();
+ m_ruby_start = curCycle();
}
Time
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
index c7ac85ad3..6404eb6ff 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
@@ -272,7 +272,7 @@ GarnetNetwork_d::printLinkStats(ostream& out) const
for (int i = 0; i < m_link_ptr_vector.size(); i++) {
average_link_utilization +=
(double(m_link_ptr_vector[i]->getLinkUtilization())) /
- (double(g_system_ptr->getTime()-m_ruby_start));
+ (double(curCycle() - m_ruby_start));
vector<int> vc_load = m_link_ptr_vector[i]->getVcLoad();
for (int j = 0; j < vc_load.size(); j++) {
@@ -290,8 +290,8 @@ GarnetNetwork_d::printLinkStats(ostream& out) const
if (!m_in_use[i/m_vcs_per_vnet])
continue;
- average_vc_load[i] = (double(average_vc_load[i]) /
- (double(g_system_ptr->getTime()) - m_ruby_start));
+ average_vc_load[i] = (double(average_vc_load[i])) /
+ (double(curCycle() - m_ruby_start));
out << "Average VC Load [" << i << "] = " << average_vc_load[i]
<< " flits/cycle " << endl;
}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc
index 62b8cd574..2671d781f 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc
@@ -53,7 +53,7 @@ InputUnit_d::InputUnit_d(int id, Router_d *router) : Consumer(router)
// Instantiating the virtual channels
m_vcs.resize(m_num_vcs);
for (int i=0; i < m_num_vcs; i++) {
- m_vcs[i] = new VirtualChannel_d(i);
+ m_vcs[i] = new VirtualChannel_d(i, m_router->curCycle());
}
}
@@ -67,7 +67,7 @@ void
InputUnit_d::wakeup()
{
flit_d *t_flit;
- if (m_in_link->isReady()) {
+ if (m_in_link->isReady(m_router->curCycle())) {
t_flit = m_in_link->consumeLink();
int vc = t_flit->get_vc();
@@ -79,9 +79,9 @@ InputUnit_d::wakeup()
// Do the route computation for this vc
m_router->route_req(t_flit, this, vc);
- m_vcs[vc]->set_enqueue_time(g_system_ptr->getTime());
+ m_vcs[vc]->set_enqueue_time(m_router->curCycle());
} else {
- t_flit->advance_stage(SA_);
+ t_flit->advance_stage(SA_, m_router->curCycle());
m_router->swarb_req();
}
// write flit into input buffer
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh
index 544c4271b..3ebf7c6e9 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh
@@ -56,9 +56,9 @@ class InputUnit_d : public Consumer
inline int get_inlink_id() { return m_in_link->get_id(); }
inline void
- set_vc_state(VC_state_type state, int vc)
+ set_vc_state(VC_state_type state, int vc, Time curTime)
{
- m_vcs[vc]->set_state(state);
+ m_vcs[vc]->set_state(state, curTime);
}
inline void
@@ -86,9 +86,9 @@ class InputUnit_d : public Consumer
}
inline void
- increment_credit(int in_vc, bool free_signal)
+ increment_credit(int in_vc, bool free_signal, Time curTime)
{
- flit_d *t_flit = new flit_d(in_vc, free_signal);
+ flit_d *t_flit = new flit_d(in_vc, free_signal, curTime);
creditQueue->insert(t_flit);
m_credit_link->scheduleEvent(1);
}
@@ -100,16 +100,16 @@ class InputUnit_d : public Consumer
}
inline void
- updateRoute(int vc, int outport)
+ updateRoute(int vc, int outport, Time curTime)
{
m_vcs[vc]->set_outport(outport);
- m_vcs[vc]->set_state(VC_AB_);
+ m_vcs[vc]->set_state(VC_AB_, curTime);
}
inline void
- grant_vc(int in_vc, int out_vc)
+ grant_vc(int in_vc, int out_vc, Time curTime)
{
- m_vcs[in_vc]->grant_vc(out_vc);
+ m_vcs[in_vc]->grant_vc(out_vc, curTime);
}
inline flit_d*
@@ -125,21 +125,22 @@ class InputUnit_d : public Consumer
}
inline bool
- need_stage(int vc, VC_state_type state, flit_stage stage)
+ need_stage(int vc, VC_state_type state, flit_stage stage, Time curTime)
{
- return m_vcs[vc]->need_stage(state, stage);
+ return m_vcs[vc]->need_stage(state, stage, curTime);
}
inline bool
- need_stage_nextcycle(int vc, VC_state_type state, flit_stage stage)
+ need_stage_nextcycle(int vc, VC_state_type state, flit_stage stage,
+ Time curTime)
{
- return m_vcs[vc]->need_stage_nextcycle(state, stage);
+ return m_vcs[vc]->need_stage_nextcycle(state, stage, curTime);
}
inline bool
- isReady(int invc)
+ isReady(int invc, Time curTime)
{
- return m_vcs[invc]->isReady();
+ return m_vcs[invc]->isReady(curTime);
}
inline int
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc
index 62bee1850..f0e117aad 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc
@@ -71,7 +71,7 @@ NetworkInterface_d::NetworkInterface_d(int id, int virtual_networks,
for (int i = 0; i < m_num_vcs; i++) {
m_out_vc_state.push_back(new OutVcState_d(i, m_net_ptr));
- m_out_vc_state[i]->setState(IDLE_, g_system_ptr->getTime());
+ m_out_vc_state[i]->setState(IDLE_, m_net_ptr->curCycle());
}
}
@@ -170,12 +170,15 @@ NetworkInterface_d::flitisizeMessage(MsgPtr msg_ptr, int vnet)
for (int i = 0; i < num_flits; i++) {
m_net_ptr->increment_injected_flits(vnet);
- flit_d *fl = new flit_d(i, vc, vnet, num_flits, new_msg_ptr);
- fl->set_delay(g_system_ptr->getTime() - msg_ptr->getTime());
+ flit_d *fl = new flit_d(i, vc, vnet, num_flits, new_msg_ptr,
+ m_net_ptr->curCycle());
+
+ fl->set_delay(m_net_ptr->curCycle() - msg_ptr->getTime());
m_ni_buffers[vc]->insert(fl);
}
- m_ni_enqueue_time[vc] = g_system_ptr->getTime();
- m_out_vc_state[vc]->setState(ACTIVE_, g_system_ptr->getTime());
+
+ m_ni_enqueue_time[vc] = m_net_ptr->curCycle();
+ m_out_vc_state[vc]->setState(ACTIVE_, m_net_ptr->curCycle());
}
return true ;
}
@@ -191,7 +194,7 @@ NetworkInterface_d::calculateVC(int vnet)
m_vc_allocator[vnet] = 0;
if (m_out_vc_state[(vnet*m_vc_per_vnet) + delta]->isInState(
- IDLE_, g_system_ptr->getTime())) {
+ IDLE_, m_net_ptr->curCycle())) {
return ((vnet*m_vc_per_vnet) + delta);
}
}
@@ -212,7 +215,7 @@ void
NetworkInterface_d::wakeup()
{
DPRINTF(RubyNetwork, "m_id: %d woke up at time: %lld",
- m_id, g_system_ptr->getTime());
+ m_id, m_net_ptr->curCycle());
MsgPtr msg_ptr;
@@ -234,7 +237,7 @@ NetworkInterface_d::wakeup()
/*********** Picking messages destined for this NI **********/
- if (inNetLink->isReady()) {
+ if (inNetLink->isReady(m_net_ptr->curCycle())) {
flit_d *t_flit = inNetLink->consumeLink();
bool free_signal = false;
if (t_flit->get_type() == TAIL_ || t_flit->get_type() == HEAD_TAIL_) {
@@ -245,13 +248,14 @@ NetworkInterface_d::wakeup()
}
// Simply send a credit back since we are not buffering
// this flit in the NI
- flit_d *credit_flit = new flit_d(t_flit->get_vc(), free_signal);
+ flit_d *credit_flit = new flit_d(t_flit->get_vc(), free_signal,
+ m_net_ptr->curCycle());
creditQueue->insert(credit_flit);
m_ni_credit_link->scheduleEvent(1);
int vnet = t_flit->get_vnet();
m_net_ptr->increment_received_flits(vnet);
- int network_delay = g_system_ptr->getTime() -
+ int network_delay = m_net_ptr->curCycle() -
t_flit->get_enqueue_time();
int queueing_delay = t_flit->get_delay();
m_net_ptr->increment_network_latency(network_delay, vnet);
@@ -261,12 +265,12 @@ NetworkInterface_d::wakeup()
/****************** Checking for credit link *******/
- if (m_credit_link->isReady()) {
+ if (m_credit_link->isReady(m_net_ptr->curCycle())) {
flit_d *t_flit = m_credit_link->consumeLink();
m_out_vc_state[t_flit->get_vc()]->increment_credit();
if (t_flit->is_free_signal()) {
m_out_vc_state[t_flit->get_vc()]->setState(IDLE_,
- g_system_ptr->getTime());
+ m_net_ptr->curCycle());
}
delete t_flit;
}
@@ -292,7 +296,9 @@ NetworkInterface_d::scheduleOutputLink()
vc = 0;
// model buffer backpressure
- if (m_ni_buffers[vc]->isReady() && m_out_vc_state[vc]->has_credits()) {
+ if (m_ni_buffers[vc]->isReady(m_net_ptr->curCycle()) &&
+ m_out_vc_state[vc]->has_credits()) {
+
bool is_candidate_vc = true;
int t_vnet = get_vnet(vc);
int vc_base = t_vnet * m_vc_per_vnet;
@@ -301,7 +307,7 @@ NetworkInterface_d::scheduleOutputLink()
for (int vc_offset = 0; vc_offset < m_vc_per_vnet;
vc_offset++) {
int t_vc = vc_base + vc_offset;
- if (m_ni_buffers[t_vc]->isReady()) {
+ if (m_ni_buffers[t_vc]->isReady(m_net_ptr->curCycle())) {
if (m_ni_enqueue_time[t_vc] < m_ni_enqueue_time[vc]) {
is_candidate_vc = false;
break;
@@ -315,7 +321,7 @@ NetworkInterface_d::scheduleOutputLink()
m_out_vc_state[vc]->decrement_credit();
// Just removing the flit
flit_d *t_flit = m_ni_buffers[vc]->getTopFlit();
- t_flit->set_time(g_system_ptr->getTime() + 1);
+ t_flit->set_time(m_net_ptr->curCycle() + 1);
outSrcQueue->insert(t_flit);
// schedule the out link
outNetLink->scheduleEvent(1);
@@ -350,7 +356,7 @@ NetworkInterface_d::checkReschedule()
}
}
for (int vc = 0; vc < m_num_vcs; vc++) {
- if (m_ni_buffers[vc]->isReadyForNext()) {
+ if (m_ni_buffers[vc]->isReadyForNext(m_net_ptr->curCycle())) {
scheduleEvent(1);
return;
}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc
index 6d12fc30e..80a050207 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc
@@ -66,9 +66,9 @@ NetworkLink_d::setSourceQueue(flitBuffer_d *srcQueue)
void
NetworkLink_d::wakeup()
{
- if (link_srcQueue->isReady()) {
+ if (link_srcQueue->isReady(curCycle())) {
flit_d *t_flit = link_srcQueue->getTopFlit();
- t_flit->set_time(g_system_ptr->getTime() + m_latency);
+ t_flit->set_time(curCycle() + m_latency);
linkBuffer->insert(t_flit);
link_consumer->scheduleEvent(m_latency);
m_link_utilized++;
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh
index f27e60757..c52c903e0 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh
@@ -62,7 +62,7 @@ class NetworkLink_d : public ClockedObject, public Consumer
double calculate_power();
- inline bool isReady() { return linkBuffer->isReady(); }
+ inline bool isReady(Time curTime) { return linkBuffer->isReady(curTime); }
inline flit_d* peekLink() { return linkBuffer->peekTopFlit(); }
inline flit_d* consumeLink() { return linkBuffer->getTopFlit(); }
void init_net_ptr(GarnetNetwork_d* net_ptr)
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc
index 33d1583e1..7422a5165 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc
@@ -66,7 +66,7 @@ OutputUnit_d::decrement_credit(int out_vc)
void
OutputUnit_d::wakeup()
{
- if (m_credit_link->isReady()) {
+ if (m_credit_link->isReady(m_router->curCycle())) {
flit_d *t_flit = m_credit_link->consumeLink();
int out_vc = t_flit->get_vc();
m_outvc_state[out_vc]->increment_credit();
@@ -75,7 +75,7 @@ OutputUnit_d::wakeup()
m_outvc_state[out_vc]->get_credit_count());
if (t_flit->is_free_signal())
- set_vc_state(IDLE_, out_vc);
+ set_vc_state(IDLE_, out_vc, m_router->curCycle());
delete t_flit;
}
@@ -102,7 +102,7 @@ OutputUnit_d::set_credit_link(CreditLink_d *credit_link)
void
OutputUnit_d::update_vc(int vc, int in_port, int in_vc)
{
- m_outvc_state[vc]->setState(ACTIVE_, g_system_ptr->getTime() + 1);
+ m_outvc_state[vc]->setState(ACTIVE_, m_router->curCycle() + 1);
m_outvc_state[vc]->set_inport(in_port);
m_outvc_state[vc]->set_invc(in_vc);
m_router->update_incredit(in_port, in_vc,
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh
index 750c71b32..4fa7dcb90 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh
@@ -69,16 +69,15 @@ class OutputUnit_d : public Consumer
}
inline void
- set_vc_state(VC_state_type state, int vc)
+ set_vc_state(VC_state_type state, int vc, Time curTime)
{
- m_outvc_state[vc]->setState(state, g_system_ptr->getTime() + 1);
+ m_outvc_state[vc]->setState(state, curTime + 1);
}
inline bool
- is_vc_idle(int vc)
+ is_vc_idle(int vc, Time curTime)
{
- return (m_outvc_state[vc]->isInState(IDLE_,
- g_system_ptr->getTime()));
+ return (m_outvc_state[vc]->isInState(IDLE_, curTime));
}
inline void
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.cc
index 35a9f06e1..e68c08613 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/RoutingUnit_d.cc
@@ -57,8 +57,8 @@ void
RoutingUnit_d::RC_stage(flit_d *t_flit, InputUnit_d *in_unit, int invc)
{
int outport = routeCompute(t_flit);
- in_unit->updateRoute(invc, outport);
- t_flit->advance_stage(VA_);
+ in_unit->updateRoute(invc, outport, m_router->curCycle());
+ t_flit->advance_stage(VA_, m_router->curCycle());
m_router->vcarb_req();
}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc
index 41ff8d482..ab3f4b761 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc
@@ -113,8 +113,10 @@ SWallocator_d::arbitrate_inports()
get_vnet(invc))))
continue;
- if (m_input_unit[inport]->need_stage(invc, ACTIVE_, SA_) &&
- m_input_unit[inport]->has_credits(invc)) {
+ if (m_input_unit[inport]->need_stage(invc, ACTIVE_, SA_,
+ m_router->curCycle()) &&
+ m_input_unit[inport]->has_credits(invc)) {
+
if (is_candidate_inport(inport, invc)) {
int outport = m_input_unit[inport]->get_route(invc);
m_local_arbiter_activity++;
@@ -137,7 +139,8 @@ SWallocator_d::is_candidate_inport(int inport, int invc)
if ((m_router->get_net_ptr())->isVNetOrdered(t_vnet)) {
for (int vc_offset = 0; vc_offset < m_vc_per_vnet; vc_offset++) {
int temp_vc = vc_base + vc_offset;
- if (m_input_unit[inport]->need_stage(temp_vc, ACTIVE_, SA_) &&
+ if (m_input_unit[inport]->need_stage(temp_vc, ACTIVE_, SA_,
+ m_router->curCycle()) &&
(m_input_unit[inport]->get_route(temp_vc) == outport) &&
(m_input_unit[inport]->get_enqueue_time(temp_vc) <
t_enqueue_time)) {
@@ -175,28 +178,34 @@ SWallocator_d::arbitrate_outports()
// remove flit from Input Unit
flit_d *t_flit = m_input_unit[inport]->getTopFlit(invc);
- t_flit->advance_stage(ST_);
+ t_flit->advance_stage(ST_, m_router->curCycle());
t_flit->set_vc(outvc);
t_flit->set_outport(outport);
- t_flit->set_time(g_system_ptr->getTime() + 1);
+ t_flit->set_time(m_router->curCycle() + 1);
m_output_unit[outport]->decrement_credit(outvc);
m_router->update_sw_winner(inport, t_flit);
m_global_arbiter_activity++;
if ((t_flit->get_type() == TAIL_) ||
t_flit->get_type() == HEAD_TAIL_) {
+
// Send a credit back
// along with the information that this VC is now idle
- m_input_unit[inport]->increment_credit(invc, true);
+ m_input_unit[inport]->increment_credit(invc, true,
+ m_router->curCycle());
+
// This Input VC should now be empty
- assert(m_input_unit[inport]->isReady(invc) == false);
+ assert(m_input_unit[inport]->isReady(invc,
+ m_router->curCycle()) == false);
- m_input_unit[inport]->set_vc_state(IDLE_, invc);
+ m_input_unit[inport]->set_vc_state(IDLE_, invc,
+ m_router->curCycle());
m_input_unit[inport]->set_enqueue_time(invc, INFINITE_);
} else {
// Send a credit back
// but do not indicate that the VC is idle
- m_input_unit[inport]->increment_credit(invc, false);
+ m_input_unit[inport]->increment_credit(invc, false,
+ m_router->curCycle());
}
break; // got a in request for this outport
}
@@ -209,7 +218,8 @@ SWallocator_d::check_for_wakeup()
{
for (int i = 0; i < m_num_inports; i++) {
for (int j = 0; j < m_num_vcs; j++) {
- if (m_input_unit[i]->need_stage_nextcycle(j, ACTIVE_, SA_)) {
+ if (m_input_unit[i]->need_stage_nextcycle(j, ACTIVE_, SA_,
+ m_router->curCycle())) {
scheduleEvent(1);
return;
}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc
index 1cb31c3e3..db7446f7a 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc
@@ -65,16 +65,16 @@ void
Switch_d::wakeup()
{
DPRINTF(RubyNetwork, "Switch woke up at time: %lld\n",
- g_system_ptr->getTime());
+ m_router->curCycle());
for (int inport = 0; inport < m_num_inports; inport++) {
- if (!m_switch_buffer[inport]->isReady())
+ if (!m_switch_buffer[inport]->isReady(m_router->curCycle()))
continue;
flit_d *t_flit = m_switch_buffer[inport]->peekTopFlit();
- if (t_flit->is_stage(ST_)) {
+ if (t_flit->is_stage(ST_, m_router->curCycle())) {
int outport = t_flit->get_outport();
- t_flit->advance_stage(LT_);
- t_flit->set_time(g_system_ptr->getTime() + 1);
+ t_flit->advance_stage(LT_, m_router->curCycle());
+ t_flit->set_time(m_router->curCycle() + 1);
// This will take care of waking up the Network Link
m_output_unit[outport]->insert_flit(t_flit);
@@ -89,7 +89,7 @@ void
Switch_d::check_for_wakeup()
{
for (int inport = 0; inport < m_num_inports; inport++) {
- if (m_switch_buffer[inport]->isReadyForNext()) {
+ if (m_switch_buffer[inport]->isReadyForNext(m_router->curCycle())) {
scheduleEvent(1);
break;
}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc
index 75533fb10..012837362 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc
@@ -132,7 +132,8 @@ VCallocator_d::is_invc_candidate(int inport_iter, int invc_iter)
if ((m_router->get_net_ptr())->isVNetOrdered(vnet)) {
for (int vc_offset = 0; vc_offset < m_vc_per_vnet; vc_offset++) {
int temp_vc = invc_base + vc_offset;
- if (m_input_unit[inport_iter]->need_stage(temp_vc, VC_AB_, VA_) &&
+ if (m_input_unit[inport_iter]->need_stage(temp_vc, VC_AB_, VA_,
+ m_router->curCycle()) &&
(m_input_unit[inport_iter]->get_route(temp_vc) == outport) &&
(m_input_unit[inport_iter]->get_enqueue_time(temp_vc) <
t_enqueue_time)) {
@@ -163,7 +164,7 @@ VCallocator_d::select_outvc(int inport_iter, int invc_iter)
if (outvc_offset >= num_vcs_per_vnet)
outvc_offset = 0;
int outvc = outvc_base + outvc_offset;
- if (m_output_unit[outport]->is_vc_idle(outvc)) {
+ if (m_output_unit[outport]->is_vc_idle(outvc, m_router->curCycle())) {
m_local_arbiter_activity[vnet]++;
m_outvc_req[outport][outvc][inport_iter][invc_iter] = true;
if (!m_outvc_is_req[outport][outvc])
@@ -182,8 +183,8 @@ VCallocator_d::arbitrate_invcs()
get_vnet(invc_iter))))
continue;
- if (m_input_unit[inport_iter]->need_stage(
- invc_iter, VC_AB_, VA_)) {
+ if (m_input_unit[inport_iter]->need_stage(invc_iter, VC_AB_,
+ VA_, m_router->curCycle())) {
if (!is_invc_candidate(inport_iter, invc_iter))
continue;
@@ -231,7 +232,8 @@ VCallocator_d::arbitrate_outvcs()
int invc = invc_base + invc_offset;
if (m_outvc_req[outport_iter][outvc_iter][inport][invc]) {
m_global_arbiter_activity[vnet]++;
- m_input_unit[inport]->grant_vc(invc, outvc_iter);
+ m_input_unit[inport]->grant_vc(invc, outvc_iter,
+ m_router->curCycle());
m_output_unit[outport_iter]->update_vc(
outvc_iter, inport, invc);
m_router->swarb_req();
@@ -256,7 +258,8 @@ VCallocator_d::check_for_wakeup()
{
for (int i = 0; i < m_num_inports; i++) {
for (int j = 0; j < m_num_vcs; j++) {
- if (m_input_unit[i]->need_stage_nextcycle(j, VC_AB_, VA_)) {
+ if (m_input_unit[i]->need_stage_nextcycle(j, VC_AB_, VA_,
+ m_router->curCycle())) {
scheduleEvent(1);
return;
}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc
index 96d873009..4fd2ebbbf 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc
@@ -30,12 +30,12 @@
#include "mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh"
-VirtualChannel_d::VirtualChannel_d(int id)
+VirtualChannel_d::VirtualChannel_d(int id, Time curTime)
{
m_id = id;
m_input_buffer = new flitBuffer_d();
m_vc_state.first = IDLE_;
- m_vc_state.second = g_system_ptr->getTime();
+ m_vc_state.second = curTime;
m_enqueue_time = INFINITE_;
}
@@ -51,37 +51,36 @@ VirtualChannel_d::set_outport(int outport)
}
void
-VirtualChannel_d::grant_vc(int out_vc)
+VirtualChannel_d::grant_vc(int out_vc, Time curTime)
{
m_output_vc = out_vc;
m_vc_state.first = ACTIVE_;
- m_vc_state.second = g_system_ptr->getTime() + 1;
+ m_vc_state.second = curTime + 1;
flit_d *t_flit = m_input_buffer->peekTopFlit();
- t_flit->advance_stage(SA_);
+ t_flit->advance_stage(SA_, curTime);
}
bool
-VirtualChannel_d::need_stage(VC_state_type state, flit_stage stage)
+VirtualChannel_d::need_stage(VC_state_type state, flit_stage stage,
+ Time curTime)
{
- if ((m_vc_state.first == state) &&
- (g_system_ptr->getTime() >= m_vc_state.second)) {
- if (m_input_buffer->isReady()) {
+ if ((m_vc_state.first == state) && (curTime >= m_vc_state.second)) {
+ if (m_input_buffer->isReady(curTime)) {
flit_d *t_flit = m_input_buffer->peekTopFlit();
- return(t_flit->is_stage(stage)) ;
+ return(t_flit->is_stage(stage, curTime)) ;
}
}
return false;
-
}
bool
-VirtualChannel_d::need_stage_nextcycle(VC_state_type state, flit_stage stage)
+VirtualChannel_d::need_stage_nextcycle(VC_state_type state, flit_stage stage,
+ Time curTime)
{
- if ((m_vc_state.first == state) &&
- ((g_system_ptr->getTime()+1) >= m_vc_state.second)) {
- if (m_input_buffer->isReadyForNext()) {
+ if ((m_vc_state.first == state) && ((curTime + 1) >= m_vc_state.second)) {
+ if (m_input_buffer->isReadyForNext(curTime)) {
flit_d *t_flit = m_input_buffer->peekTopFlit();
- return(t_flit->is_next_stage(stage)) ;
+ return(t_flit->is_next_stage(stage, curTime)) ;
}
}
return false;
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh
index 18553fe2b..6217be1d0 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh
@@ -39,13 +39,14 @@
class VirtualChannel_d
{
public:
- VirtualChannel_d(int id);
+ VirtualChannel_d(int id, Time curTime);
~VirtualChannel_d();
- bool need_stage(VC_state_type state, flit_stage stage);
- bool need_stage_nextcycle(VC_state_type state, flit_stage stage);
+ bool need_stage(VC_state_type state, flit_stage stage, Time curTime);
+ bool need_stage_nextcycle(VC_state_type state, flit_stage stage,
+ Time curTime);
void set_outport(int outport);
- void grant_vc(int out_vc);
+ void grant_vc(int out_vc, Time curTime);
inline Time get_enqueue_time() { return m_enqueue_time; }
inline void set_enqueue_time(Time time) { m_enqueue_time = time; }
@@ -56,7 +57,10 @@ class VirtualChannel_d
inline void update_credit(int credit) { m_credit_count = credit; }
inline void increment_credit() { m_credit_count++; }
- inline bool isReady() { return m_input_buffer->isReady(); }
+ inline bool isReady(Time curTime)
+ {
+ return m_input_buffer->isReady(curTime);
+ }
inline void
insertFlit(flit_d *t_flit)
@@ -65,10 +69,10 @@ class VirtualChannel_d
}
inline void
- set_state(VC_state_type m_state)
+ set_state(VC_state_type m_state, Time curTime)
{
m_vc_state.first = m_state;
- m_vc_state.second = g_system_ptr->getTime() + 1;
+ m_vc_state.second = curTime + 1;
}
inline flit_d*
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc
index 2c4f4e09e..e31989a54 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc
@@ -47,22 +47,22 @@ flitBuffer_d::isEmpty()
}
bool
-flitBuffer_d::isReady()
+flitBuffer_d::isReady(Time curTime)
{
if (m_buffer.size() != 0 ) {
flit_d *t_flit = peekTopFlit();
- if (t_flit->get_time() <= g_system_ptr->getTime())
+ if (t_flit->get_time() <= curTime)
return true;
}
return false;
}
bool
-flitBuffer_d::isReadyForNext()
+flitBuffer_d::isReadyForNext(Time curTime)
{
if (m_buffer.size() != 0 ) {
flit_d *t_flit = peekTopFlit();
- if (t_flit->get_time() <= (g_system_ptr->getTime() + 1))
+ if (t_flit->get_time() <= (curTime + 1))
return true;
}
return false;
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh
index 23cbd0bb3..eb7729bef 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh
@@ -44,8 +44,8 @@ class flitBuffer_d
flitBuffer_d();
flitBuffer_d(int maximum_size);
- bool isReady();
- bool isReadyForNext();
+ bool isReady(Time curTime);
+ bool isReadyForNext(Time curTime);
bool isEmpty();
void print(std::ostream& out) const;
bool isFull();
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc
index 93364348e..07aea133f 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc
@@ -30,12 +30,13 @@
#include "mem/ruby/network/garnet/fixed-pipeline/flit_d.hh"
-flit_d::flit_d(int id, int vc, int vnet, int size, MsgPtr msg_ptr)
+flit_d::flit_d(int id, int vc, int vnet, int size, MsgPtr msg_ptr,
+ Time curTime)
{
m_size = size;
m_msg_ptr = msg_ptr;
- m_enqueue_time = g_system_ptr->getTime();
- m_time = g_system_ptr->getTime();
+ m_enqueue_time = curTime;
+ m_time = curTime;
m_id = id;
m_vnet = vnet;
m_vc = vc;
@@ -54,12 +55,12 @@ flit_d::flit_d(int id, int vc, int vnet, int size, MsgPtr msg_ptr)
m_type = BODY_;
}
-flit_d::flit_d(int vc, bool is_free_signal)
+flit_d::flit_d(int vc, bool is_free_signal, Time curTime)
{
m_id = 0;
m_vc = vc;
m_is_free_signal = is_free_signal;
- m_time = g_system_ptr->getTime();
+ m_time = curTime;
}
void
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh
index 4295cbf6b..549dd59d5 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh
@@ -40,8 +40,8 @@
class flit_d
{
public:
- flit_d(int id, int vc, int vnet, int size, MsgPtr msg_ptr);
- flit_d(int vc, bool is_free_signal);
+ flit_d(int id, int vc, int vnet, int size, MsgPtr msg_ptr, Time curTime);
+ flit_d(int vc, bool is_free_signal, Time curTime);
void set_outport(int port) { m_outport = port; }
int get_outport() {return m_outport; }
void print(std::ostream& out) const;
@@ -58,25 +58,26 @@ class flit_d
flit_type get_type() { return m_type; }
bool
- is_stage(flit_stage t_stage)
+ is_stage(flit_stage t_stage, Time curTime)
{
return (m_stage.first == t_stage &&
- g_system_ptr->getTime() >= m_stage.second);
+ curTime >= m_stage.second);
}
bool
- is_next_stage(flit_stage t_stage)
+ is_next_stage(flit_stage t_stage, Time curTime)
{
return (m_stage.first == t_stage &&
- (g_system_ptr->getTime() + 1) >= m_stage.second);
+ (curTime + 1) >= m_stage.second);
}
void
- advance_stage(flit_stage t_stage)
+ advance_stage(flit_stage t_stage, Time curTime)
{
m_stage.first = t_stage;
- m_stage.second = g_system_ptr->getTime() + 1;
+ m_stage.second = curTime + 1;
}
+
std::pair<flit_stage, Time>
get_stage()
{
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
index 9916f4ba5..a60d23457 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
@@ -255,7 +255,7 @@ GarnetNetwork::printLinkStats(ostream& out) const
for (int i = 0; i < m_link_ptr_vector.size(); i++) {
average_link_utilization +=
(double(m_link_ptr_vector[i]->getLinkUtilization())) /
- (double(g_system_ptr->getTime()-m_ruby_start));
+ (double(curCycle() - m_ruby_start));
vector<int> vc_load = m_link_ptr_vector[i]->getVcLoad();
for (int j = 0; j < vc_load.size(); j++) {
@@ -273,8 +273,8 @@ GarnetNetwork::printLinkStats(ostream& out) const
if (!m_in_use[i/m_vcs_per_vnet])
continue;
- average_vc_load[i] = (double(average_vc_load[i]) /
- (double(g_system_ptr->getTime()) - m_ruby_start));
+ average_vc_load[i] = double(average_vc_load[i]) /
+ (double(curCycle() - m_ruby_start));
out << "Average VC Load [" << i << "] = " << average_vc_load[i]
<< " flits/cycle " << endl;
}
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
index 9e4c1ef9a..7267da36d 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
@@ -68,7 +68,7 @@ NetworkInterface::NetworkInterface(int id, int virtual_networks,
for (int i = 0; i < m_num_vcs; i++) {
m_out_vc_state.push_back(new OutVcState(i));
- m_out_vc_state[i]->setState(IDLE_, g_system_ptr->getTime());
+ m_out_vc_state[i]->setState(IDLE_, m_net_ptr->curCycle());
}
}
@@ -167,19 +167,20 @@ NetworkInterface::flitisizeMessage(MsgPtr msg_ptr, int vnet)
}
for (int i = 0; i < num_flits; i++) {
m_net_ptr->increment_injected_flits(vnet);
- flit *fl = new flit(i, vc, vnet, num_flits, new_msg_ptr);
- fl->set_delay(g_system_ptr->getTime() - msg_ptr->getTime());
+ flit *fl = new flit(i, vc, vnet, num_flits, new_msg_ptr,
+ m_net_ptr->curCycle());
+ fl->set_delay(m_net_ptr->curCycle() - msg_ptr->getTime());
m_ni_buffers[vc]->insert(fl);
}
- m_out_vc_state[vc]->setState(VC_AB_, g_system_ptr->getTime());
+ m_out_vc_state[vc]->setState(VC_AB_, m_net_ptr->curCycle());
// setting an output vc request for the next hop.
// This flit will be ready to traverse the link and into the next hop
// only when an output vc is acquired at the next hop
outNetLink->request_vc_link(vc,
new_net_msg_ptr->getInternalDestination(),
- g_system_ptr->getTime());
+ m_net_ptr->curCycle());
}
return true ;
@@ -222,7 +223,7 @@ NetworkInterface::calculateVC(int vnet)
m_vc_allocator[vnet] = 0;
if (m_out_vc_state[(vnet*m_vc_per_vnet) + delta]->isInState(IDLE_,
- g_system_ptr->getTime())) {
+ m_net_ptr->curCycle())) {
return ((vnet*m_vc_per_vnet) + delta);
}
}
@@ -266,18 +267,18 @@ NetworkInterface::wakeup()
flit *t_flit = inNetLink->consumeLink();
if (t_flit->get_type() == TAIL_ || t_flit->get_type() == HEAD_TAIL_) {
DPRINTF(RubyNetwork, "m_id: %d, Message delivered at time: %lld\n",
- m_id, g_system_ptr->getTime());
+ m_id, m_net_ptr->curCycle());
outNode_ptr[t_flit->get_vnet()]->enqueue(
t_flit->get_msg_ptr(), 1);
// signal the upstream router that this vc can be freed now
inNetLink->release_vc_link(t_flit->get_vc(),
- g_system_ptr->getTime() + 1);
+ m_net_ptr->curCycle() + 1);
}
int vnet = t_flit->get_vnet();
m_net_ptr->increment_received_flits(vnet);
- int network_delay = g_system_ptr->getTime() -
+ int network_delay = m_net_ptr->curCycle() -
t_flit->get_enqueue_time();
int queueing_delay = t_flit->get_delay();
m_net_ptr->increment_network_latency(network_delay, vnet);
@@ -304,14 +305,14 @@ NetworkInterface::scheduleOutputLink()
vc++;
if (vc == m_num_vcs)
vc = 0;
- if (m_ni_buffers[vc]->isReady()) {
+ if (m_ni_buffers[vc]->isReady(m_net_ptr->curCycle())) {
if (m_out_vc_state[vc]->isInState(ACTIVE_,
- g_system_ptr->getTime()) &&
+ m_net_ptr->curCycle()) &&
outNetLink->isBufferNotFull_link(vc)) { // buffer backpressure
// Just removing the flit
flit *t_flit = m_ni_buffers[vc]->getTopFlit();
- t_flit->set_time(g_system_ptr->getTime() + 1);
+ t_flit->set_time(m_net_ptr->curCycle() + 1);
outSrcQueue->insert(t_flit);
// schedule the out link
@@ -332,7 +333,7 @@ NetworkInterface::checkReschedule()
}
}
for (int vc = 0; vc < m_num_vcs; vc++) {
- if (m_ni_buffers[vc]->isReadyForNext()) {
+ if (m_ni_buffers[vc]->isReadyForNext(m_net_ptr->curCycle())) {
scheduleEvent(1);
return;
}
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc
index 2d94f6484..b9faef28d 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc
@@ -116,7 +116,7 @@ NetworkLink::getLinkUtilization()
bool
NetworkLink::isReady()
{
- return linkBuffer->isReady();
+ return linkBuffer->isReady(curCycle());
}
void
@@ -134,11 +134,11 @@ NetworkLink::setOutPort(int port)
void
NetworkLink::wakeup()
{
- if (!link_srcQueue->isReady())
+ if (!link_srcQueue->isReady(curCycle()))
return;
flit *t_flit = link_srcQueue->getTopFlit();
- t_flit->set_time(g_system_ptr->getTime() + m_latency);
+ t_flit->set_time(curCycle() + m_latency);
linkBuffer->insert(t_flit);
link_consumer->scheduleEvent(m_latency);
m_link_utilized++;
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc
index 8e064a01f..ca82f0757 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc
@@ -71,7 +71,7 @@ Router::addInPort(NetworkLink *in_link)
vector<InVcState *> in_vc_vector;
for (int i = 0; i < m_num_vcs; i++) {
in_vc_vector.push_back(new InVcState(i));
- in_vc_vector[i]->setState(IDLE_, g_system_ptr->getTime());
+ in_vc_vector[i]->setState(IDLE_, curCycle());
}
m_in_vc_state.push_back(in_vc_vector);
m_in_link.push_back(in_link);
@@ -111,7 +111,7 @@ Router::addOutPort(NetworkLink *out_link, const NetDest& routing_table_entry,
vector<OutVcState *> out_vc_vector;
for (int i = 0; i < m_num_vcs; i++) {
out_vc_vector.push_back(new OutVcState(i));
- out_vc_vector[i]->setState(IDLE_, g_system_ptr->getTime());
+ out_vc_vector[i]->setState(IDLE_, curCycle());
}
m_out_vc_state.push_back(out_vc_vector);
m_link_weights.push_back(link_weight);
@@ -137,8 +137,8 @@ Router::request_vc(int in_vc, int in_port, NetDest destination,
int outport = getRoute(destination);
m_in_vc_state[in_port][in_vc]->setRoute(outport);
m_in_vc_state[in_port][in_vc]->setState(VC_AB_, request_time);
- assert(request_time >= g_system_ptr->getTime());
- if (request_time > g_system_ptr->getTime())
+ assert(request_time >= curCycle());
+ if (request_time > curCycle())
m_vc_arbiter->scheduleEventAbsolute(request_time);
else
vc_arbitrate();
@@ -180,22 +180,21 @@ Router::vc_arbitrate()
InVcState *in_vc_state = m_in_vc_state[inport][invc];
- if (in_vc_state->isInState(VC_AB_, g_system_ptr->getTime())) {
+ if (in_vc_state->isInState(VC_AB_, curCycle())) {
int outport = in_vc_state->get_outport();
vector<int> valid_vcs = get_valid_vcs(invc);
for (int valid_vc_iter = 0; valid_vc_iter < valid_vcs.size();
valid_vc_iter++) {
if (m_out_vc_state[outport][valid_vcs[valid_vc_iter]]
- ->isInState(IDLE_, g_system_ptr->getTime())) {
+ ->isInState(IDLE_, curCycle())) {
in_vc_state->grant_vc(valid_vcs[valid_vc_iter],
- g_system_ptr->getTime());
+ curCycle());
- m_in_link[inport]->grant_vc_link(invc,
- g_system_ptr->getTime());
+ m_in_link[inport]->grant_vc_link(invc, curCycle());
m_out_vc_state[outport][valid_vcs[valid_vc_iter]]
- ->setState(VC_AB_, g_system_ptr->getTime());
+ ->setState(VC_AB_, curCycle());
break;
}
}
@@ -270,8 +269,7 @@ Router::routeCompute(flit *m_flit, int inport)
assert(m_net_ptr->getNumPipeStages() >= 1);
// Subtract 1 as 1 cycle will be consumed in scheduling the output link
- m_flit->set_time(g_system_ptr->getTime() +
- (m_net_ptr->getNumPipeStages() - 1));
+ m_flit->set_time(curCycle() + (m_net_ptr->getNumPipeStages() - 1));
m_flit->set_vc(outvc);
m_router_buffers[outport][outvc]->insert(m_flit);
@@ -283,25 +281,18 @@ Router::routeCompute(flit *m_flit, int inport)
NetDest destination = nm->getInternalDestination();
if (m_net_ptr->getNumPipeStages() > 1) {
- m_out_vc_state[outport][outvc]->setState(VC_AB_,
- g_system_ptr->getTime() + 1);
-
+ m_out_vc_state[outport][outvc]->setState(VC_AB_, curCycle() + 1);
m_out_link[outport]->request_vc_link(outvc, destination,
- g_system_ptr->getTime() + 1);
+ curCycle() + 1);
} else {
- m_out_vc_state[outport][outvc]->setState(VC_AB_,
- g_system_ptr->getTime());
-
+ m_out_vc_state[outport][outvc]->setState(VC_AB_, curCycle());
m_out_link[outport]->request_vc_link(outvc, destination,
- g_system_ptr->getTime());
+ curCycle());
}
}
if ((m_flit->get_type() == TAIL_) || (m_flit->get_type() == HEAD_TAIL_)) {
- m_in_vc_state[inport][invc]->setState(IDLE_,
- g_system_ptr->getTime() + 1);
-
- m_in_link[inport]->release_vc_link(invc,
- g_system_ptr->getTime() + 1);
+ m_in_vc_state[inport][invc]->setState(IDLE_, curCycle() + 1);
+ m_in_link[inport]->release_vc_link(invc, curCycle() + 1);
}
}
@@ -325,8 +316,7 @@ Router::wakeup()
// checking the incoming link
if (m_in_link[incoming_port]->isReady()) {
- DPRINTF(RubyNetwork, "m_id: %d, Time: %lld\n",
- m_id, g_system_ptr->getTime());
+ DPRINTF(RubyNetwork, "m_id: %d, Time: %lld\n", m_id, curCycle());
t_flit = m_in_link[incoming_port]->peekLink();
routeCompute(t_flit, incoming_port);
m_in_link[incoming_port]->consumeLink();
@@ -360,16 +350,16 @@ Router::scheduleOutputLinks()
if (vc_tolookat == m_num_vcs)
vc_tolookat = 0;
- if (m_router_buffers[port][vc_tolookat]->isReady()) {
+ if (m_router_buffers[port][vc_tolookat]->isReady(curCycle())) {
// models buffer backpressure
if (m_out_vc_state[port][vc_tolookat]->isInState(ACTIVE_,
- g_system_ptr->getTime()) &&
+ curCycle()) &&
m_out_link[port]->isBufferNotFull_link(vc_tolookat)) {
flit *t_flit =
m_router_buffers[port][vc_tolookat]->getTopFlit();
- t_flit->set_time(g_system_ptr->getTime() + 1 );
+ t_flit->set_time(curCycle() + 1 );
m_out_src_queue[port]->insert(t_flit);
m_out_link[port]->scheduleEvent(1);
break; // done for this port
@@ -392,7 +382,7 @@ Router::checkReschedule()
{
for (int port = 0; port < m_out_link.size(); port++) {
for (int vc = 0; vc < m_num_vcs; vc++) {
- if (m_router_buffers[port][vc]->isReadyForNext()) {
+ if (m_router_buffers[port][vc]->isReadyForNext(curCycle())) {
scheduleEvent(1);
return;
}
@@ -405,9 +395,7 @@ Router::check_arbiter_reschedule()
{
for (int port = 0; port < m_in_link.size(); port++) {
for (int vc = 0; vc < m_num_vcs; vc++) {
- if (m_in_vc_state[port][vc]->isInState(VC_AB_,
- g_system_ptr->getTime() + 1)) {
-
+ if (m_in_vc_state[port][vc]->isInState(VC_AB_, curCycle() + 1)) {
m_vc_arbiter->scheduleEvent(1);
return;
}
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc b/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc
index 161625978..6e858199b 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc
@@ -30,12 +30,12 @@
#include "mem/ruby/network/garnet/flexible-pipeline/flit.hh"
-flit::flit(int id, int vc, int vnet, int size, MsgPtr msg_ptr)
+flit::flit(int id, int vc, int vnet, int size, MsgPtr msg_ptr, Time curTime)
{
m_size = size;
m_msg_ptr = msg_ptr;
- m_enqueue_time = g_system_ptr->getTime();
- m_time = g_system_ptr->getTime();
+ m_enqueue_time = curTime;
+ m_time = curTime;
m_id = id;
m_vnet = vnet;
m_vc = vc;
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh b/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh
index 66cd604ab..9e1168409 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh
@@ -40,7 +40,7 @@
class flit
{
public:
- flit(int id, int vc, int vnet, int size, MsgPtr msg_ptr);
+ flit(int id, int vc, int vnet, int size, MsgPtr msg_ptr, Time curTime);
int get_size();
int get_id();
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc
index 9446c812a..fd9922af7 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc
@@ -51,22 +51,22 @@ flitBuffer::isEmpty()
}
bool
-flitBuffer::isReady()
+flitBuffer::isReady(Time curTime)
{
if (m_buffer.size() != 0 ) {
flit *t_flit = m_buffer.front();
- if (t_flit->get_time() <= g_system_ptr->getTime())
+ if (t_flit->get_time() <= curTime)
return true;
}
return false;
}
bool
-flitBuffer::isReadyForNext()
+flitBuffer::isReadyForNext(Time curTime)
{
if (m_buffer.size() != 0 ) {
flit *t_flit = m_buffer.front();
- if (t_flit->get_time() <= (g_system_ptr->getTime() + 1))
+ if (t_flit->get_time() <= (curTime + 1))
return true;
}
return false;
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh
index 3170c6c78..263dcb902 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh
@@ -43,8 +43,8 @@ class flitBuffer
flitBuffer();
flitBuffer(int maximum_size);
- bool isReady();
- bool isReadyForNext();
+ bool isReady(Time curTime);
+ bool isReadyForNext(Time curTime);
bool isFull();
bool isEmpty();
void setMaxSize(int maximum);
diff --git a/src/mem/ruby/network/orion/NetworkPower.cc b/src/mem/ruby/network/orion/NetworkPower.cc
index 9ac0dd815..6d4fc1923 100644
--- a/src/mem/ruby/network/orion/NetworkPower.cc
+++ b/src/mem/ruby/network/orion/NetworkPower.cc
@@ -39,9 +39,7 @@ Router_d::calculate_power()
{
//Network Activities from garnet
calculate_performance_numbers();
- double sim_cycles;
- sim_cycles =
- g_system_ptr->getTime() - m_network_ptr->getRubyStartTime();
+ double sim_cycles = curCycle() - m_network_ptr->getRubyStartTime();
// Number of virtual networks/message classes declared in Ruby
// maybe greater than active virtual networks.
@@ -248,7 +246,7 @@ NetworkLink_d::calculate_power()
orion_cfg_ptr);
double sim_cycles =
- (double)(g_system_ptr->getTime() - m_net_ptr->getRubyStartTime());
+ (double)(m_net_ptr->curCycle() - m_net_ptr->getRubyStartTime());
// Dynamic Power
// Assume half the bits flipped on every link activity
diff --git a/src/mem/ruby/slicc_interface/Message.hh b/src/mem/ruby/slicc_interface/Message.hh
index 201ec4b60..74b405312 100644
--- a/src/mem/ruby/slicc_interface/Message.hh
+++ b/src/mem/ruby/slicc_interface/Message.hh
@@ -32,9 +32,8 @@
#include <iostream>
#include "base/refcnt.hh"
-#include "mem/ruby/common/Global.hh"
#include "mem/ruby/common/TypeDefines.hh"
-#include "mem/ruby/system/System.hh"
+#include "mem/packet.hh"
class Message;
typedef RefCountingPtr<Message> MsgPtr;
@@ -42,9 +41,9 @@ typedef RefCountingPtr<Message> MsgPtr;
class Message : public RefCounted
{
public:
- Message()
- : m_time(g_system_ptr->getTime()),
- m_LastEnqueueTime(g_system_ptr->getTime()),
+ Message(Time curTime)
+ : m_time(curTime),
+ m_LastEnqueueTime(curTime),
m_DelayedCycles(0)
{ }
diff --git a/src/mem/ruby/slicc_interface/NetworkMessage.hh b/src/mem/ruby/slicc_interface/NetworkMessage.hh
index d2bcb1241..e26612e0f 100644
--- a/src/mem/ruby/slicc_interface/NetworkMessage.hh
+++ b/src/mem/ruby/slicc_interface/NetworkMessage.hh
@@ -36,16 +36,14 @@
#include "mem/ruby/common/NetDest.hh"
#include "mem/ruby/slicc_interface/Message.hh"
-class Address;
-
class NetworkMessage;
typedef RefCountingPtr<NetworkMessage> NetMsgPtr;
class NetworkMessage : public Message
{
public:
- NetworkMessage()
- : m_internal_dest_valid(false)
+ NetworkMessage(Time curTime)
+ : Message(curTime), m_internal_dest_valid(false)
{ }
NetworkMessage(const NetworkMessage &other)
diff --git a/src/mem/ruby/slicc_interface/RubyRequest.hh b/src/mem/ruby/slicc_interface/RubyRequest.hh
index a4dadc7a7..37b89dc8f 100644
--- a/src/mem/ruby/slicc_interface/RubyRequest.hh
+++ b/src/mem/ruby/slicc_interface/RubyRequest.hh
@@ -36,7 +36,6 @@
#include "mem/protocol/RubyAccessMode.hh"
#include "mem/protocol/RubyRequestType.hh"
#include "mem/ruby/common/Address.hh"
-#include "mem/packet.hh"
class RubyRequest : public Message
{
@@ -52,12 +51,12 @@ class RubyRequest : public Message
PacketPtr pkt;
unsigned m_contextId;
- RubyRequest() {}
- RubyRequest(uint64_t _paddr, uint8_t* _data, int _len, uint64_t _pc,
- RubyRequestType _type, RubyAccessMode _access_mode,
- PacketPtr _pkt, PrefetchBit _pb = PrefetchBit_No,
- unsigned _proc_id = 100)
- : m_PhysicalAddress(_paddr),
+ RubyRequest(Time curTime, uint64_t _paddr, uint8_t* _data, int _len,
+ uint64_t _pc, RubyRequestType _type, RubyAccessMode _access_mode,
+ PacketPtr _pkt, PrefetchBit _pb = PrefetchBit_No,
+ unsigned _proc_id = 100)
+ : Message(curTime),
+ m_PhysicalAddress(_paddr),
m_Type(_type),
m_ProgramCounter(_pc),
m_AccessMode(_access_mode),
@@ -71,10 +70,8 @@ class RubyRequest : public Message
m_LineAddress.makeLineAddress();
}
- static RubyRequest*
- create()
+ RubyRequest(Time curTime) : Message(curTime)
{
- return new RubyRequest();
}
RubyRequest*
diff --git a/src/mem/ruby/slicc_interface/RubySlicc_Util.hh b/src/mem/ruby/slicc_interface/RubySlicc_Util.hh
index 06c540db5..178c4cd1e 100644
--- a/src/mem/ruby/slicc_interface/RubySlicc_Util.hh
+++ b/src/mem/ruby/slicc_interface/RubySlicc_Util.hh
@@ -130,6 +130,11 @@ mod(int val, int mod)
return val % mod;
}
+inline int max_tokens()
+{
+ return 1024;
+}
+
/**
* This function accepts an address, a data block and a packet. If the address
* range for the data block contains the address which the packet needs to
diff --git a/src/mem/ruby/structures/Prefetcher.hh b/src/mem/ruby/structures/Prefetcher.hh
index f64d39f8a..967d96086 100644
--- a/src/mem/ruby/structures/Prefetcher.hh
+++ b/src/mem/ruby/structures/Prefetcher.hh
@@ -36,9 +36,9 @@
#include "base/statistics.hh"
#include "mem/ruby/buffers/MessageBuffer.hh"
#include "mem/ruby/common/Address.hh"
-#include "mem/ruby/common/Global.hh"
#include "mem/ruby/slicc_interface/AbstractController.hh"
#include "mem/ruby/slicc_interface/RubyRequest.hh"
+#include "mem/ruby/system/System.hh"
#include "params/Prefetcher.hh"
#include "sim/sim_object.hh"
diff --git a/src/mem/ruby/system/DMASequencer.cc b/src/mem/ruby/system/DMASequencer.cc
index 84450fda4..fe9ab39be 100644
--- a/src/mem/ruby/system/DMASequencer.cc
+++ b/src/mem/ruby/system/DMASequencer.cc
@@ -70,7 +70,7 @@ DMASequencer::makeRequest(PacketPtr pkt)
active_request.bytes_issued = 0;
active_request.pkt = pkt;
- SequencerMsg *msg = new SequencerMsg;
+ SequencerMsg *msg = new SequencerMsg(curCycle());
msg->getPhysicalAddress() = Address(paddr);
msg->getLineAddress() = line_address(msg->getPhysicalAddress());
msg->getType() = write ? SequencerRequestType_ST : SequencerRequestType_LD;
@@ -108,7 +108,7 @@ DMASequencer::issueNext()
return;
}
- SequencerMsg *msg = new SequencerMsg;
+ SequencerMsg *msg = new SequencerMsg(curCycle());
msg->getPhysicalAddress() = Address(active_request.start_paddr +
active_request.bytes_completed);
diff --git a/src/mem/ruby/system/Sequencer.cc b/src/mem/ruby/system/Sequencer.cc
index 9e3fd6864..d57f80468 100644
--- a/src/mem/ruby/system/Sequencer.cc
+++ b/src/mem/ruby/system/Sequencer.cc
@@ -657,7 +657,7 @@ Sequencer::issueRequest(PacketPtr pkt, RubyRequestType secondary_type)
pc = pkt->req->getPC();
}
- RubyRequest *msg = new RubyRequest(pkt->getAddr(),
+ RubyRequest *msg = new RubyRequest(curCycle(), pkt->getAddr(),
pkt->getPtr<uint8_t>(true),
pkt->getSize(), pc, secondary_type,
RubyAccessMode_Supervisor, pkt,
diff --git a/src/mem/ruby/system/WireBuffer.cc b/src/mem/ruby/system/WireBuffer.cc
index 0845b3c8d..b5a2849ce 100644
--- a/src/mem/ruby/system/WireBuffer.cc
+++ b/src/mem/ruby/system/WireBuffer.cc
@@ -34,6 +34,8 @@
#include "base/cprintf.hh"
#include "base/stl_helpers.hh"
+#include "mem/ruby/common/Global.hh"
+#include "mem/ruby/system/System.hh"
#include "mem/ruby/system/WireBuffer.hh"
using namespace std;
diff --git a/src/mem/slicc/ast/EnqueueStatementAST.py b/src/mem/slicc/ast/EnqueueStatementAST.py
index b27bff629..a8785c9af 100644
--- a/src/mem/slicc/ast/EnqueueStatementAST.py
+++ b/src/mem/slicc/ast/EnqueueStatementAST.py
@@ -53,7 +53,8 @@ class EnqueueStatementAST(StatementAST):
self.symtab.newSymbol(v)
# Declare message
- code("${{msg_type.ident}} *out_msg = new ${{msg_type.ident}};")
+ code("${{msg_type.ident}} *out_msg = \
+ new ${{msg_type.ident}}(curCycle());")
# The other statements
t = self.statements.generate(code, None)
diff --git a/src/mem/slicc/symbols/Type.py b/src/mem/slicc/symbols/Type.py
index 19c144048..ebf187630 100644
--- a/src/mem/slicc/symbols/Type.py
+++ b/src/mem/slicc/symbols/Type.py
@@ -226,7 +226,7 @@ class Type(Symbol):
#include <iostream>
-#include "mem/ruby/common/Global.hh"
+#include "mem/ruby/slicc_interface/RubySlicc_Util.hh"
''')
for dm in self.data_members.values():
@@ -242,10 +242,14 @@ class Type(Symbol):
$klass ${{self.c_ident}}$parent
{
public:
- ${{self.c_ident}}()
- {
+ ${{self.c_ident}}
''', klass="class")
+ if self.isMessage:
+ code('(Time curTime) : %s(curTime) {' % self["interface"])
+ else:
+ code('()\n\t\t{')
+
code.indent()
if not self.isGlobal:
code.indent()
@@ -284,13 +288,19 @@ $klass ${{self.c_ident}}$parent
if not self.isGlobal:
params = [ 'const %s& local_%s' % (dm.type.c_ident, dm.ident) \
for dm in self.data_members.itervalues() ]
-
params = ', '.join(params)
+
+ if self.isMessage:
+ params = "const Time curTime, " + params
+
code('${{self.c_ident}}($params)')
# Call superclass constructor
if "interface" in self:
- code(' : ${{self["interface"]}}()')
+ if self.isMessage:
+ code(' : ${{self["interface"]}}(curTime)')
+ else:
+ code(' : ${{self["interface"]}}()')
code('{')
code.indent()
@@ -302,14 +312,8 @@ $klass ${{self.c_ident}}$parent
code.dedent()
code('}')
- # create a static factory method and a clone member
+ # create a clone member
code('''
-static ${{self.c_ident}}*
-create()
-{
- return new ${{self.c_ident}}();
-}
-
${{self.c_ident}}*
clone() const
{
@@ -419,7 +423,6 @@ operator<<(std::ostream& out, const ${{self.c_ident}}& obj)
#include <iostream>
#include "mem/protocol/${{self.c_ident}}.hh"
-#include "mem/ruby/slicc_interface/RubySlicc_Util.hh"
using namespace std;
''')