enum flit_type {HEAD_, BODY_, TAIL_, HEAD_TAIL_, NUM_FLIT_TYPE_};
enum VC_state_type {IDLE_, VC_AB_, ACTIVE_, NUM_VC_STATE_TYPE_};
-enum VNET_type {CTRL_VNET_, DATA_VNET_, NUM_VNET_TYPE_};
+enum VNET_type {CTRL_VNET_, DATA_VNET_, NULL_VNET_, NUM_VNET_TYPE_};
enum flit_stage {I_, VA_, SA_, ST_, LT_, NUM_FLIT_STAGE_};
#define INFINITE_ 10000
m_buffers_per_data_vc = p->buffers_per_data_vc;
m_buffers_per_ctrl_vc = p->buffers_per_ctrl_vc;
+ m_vnet_type.resize(m_virtual_networks);
+ for (int i = 0; i < m_vnet_type.size(); i++) {
+ m_vnet_type[i] = NULL_VNET_; // default
+ }
+
// record the routers
for (vector<BasicRouter*>::const_iterator i =
m_topology_ptr->params()->routers.begin();
}
// false because this isn't a reconfiguration
m_topology_ptr->createLinks(this, false);
-
- m_vnet_type.resize(m_virtual_networks);
- for (int i = 0; i < m_vnet_type.size(); i++) {
- m_vnet_type[i] = CTRL_VNET_;
- // DATA_VNET_ updated later based on traffic
- }
}
GarnetNetwork_d::~GarnetNetwork_d()
void
GarnetNetwork_d::checkNetworkAllocation(NodeID id, bool ordered,
- int network_num)
+ int network_num,
+ string vnet_type)
{
assert(id < m_nodes);
assert(network_num < m_virtual_networks);
m_ordered[network_num] = true;
}
m_in_use[network_num] = true;
+
+ if (vnet_type == "response")
+ m_vnet_type[network_num] = DATA_VNET_; // carries data (and ctrl) packets
+ else
+ m_vnet_type[network_num] = CTRL_VNET_; // carries only ctrl packets
}
MessageBuffer*
GarnetNetwork_d::getToNetQueue(NodeID id, bool ordered, int network_num,
- std::string vnet_type)
+ string vnet_type)
{
- // TODO:
- //if (vnet_type == "response")
- // mark vnet as data vnet and use buffers_per_data_vc
-
- checkNetworkAllocation(id, ordered, network_num);
+ checkNetworkAllocation(id, ordered, network_num, vnet_type);
return m_toNetQueues[id][network_num];
}
MessageBuffer*
GarnetNetwork_d::getFromNetQueue(NodeID id, bool ordered, int network_num,
- std::string vnet_type)
+ string vnet_type)
{
- checkNetworkAllocation(id, ordered, network_num);
+ checkNetworkAllocation(id, ordered, network_num, vnet_type);
return m_fromNetQueues[id][network_num];
}
void printConfig(std::ostream& out) const;
void print(std::ostream& out) const;
- void
- set_vnet_type(int vc, VNET_type vnet_type)
- {
- int vnet = vc/getVCsPerVnet();
- m_vnet_type[vnet] = vnet_type;
- }
-
VNET_type
get_vnet_type(int vc)
{
bool isReconfiguration);
private:
- void checkNetworkAllocation(NodeID id, bool ordered, int network_num);
+ void checkNetworkAllocation(NodeID id, bool ordered, int network_num,
+ std::string vnet_type);
GarnetNetwork_d(const GarnetNetwork_d& obj);
GarnetNetwork_d& operator=(const GarnetNetwork_d& obj);
// flitisized and an output vc is acquired
net_msg_ptr->getInternalDestination().removeNetDest(personal_dest);
}
- if (num_flits > 1) { // data packet
- // defining ctrl vnet to be 1-flit packets
- // and data vnet to be > 1 flit packets
- m_net_ptr->set_vnet_type(vc, DATA_VNET_);
- m_out_vc_state[vc]->set_credit_count();
- }
for (int i = 0; i < num_flits; i++) {
m_net_ptr->increment_injected_flits();
m_vc_state = IDLE_;
m_time = g_eventQueue_ptr->getTime();
- // this value is updated later for data VCs by set_credit_count()
- m_credit_count = m_network_ptr->getBuffersPerCtrlVC();
+ if (m_network_ptr->get_vnet_type(id) == DATA_VNET_)
+ m_credit_count = m_network_ptr->getBuffersPerDataVC();
+ else
+ m_credit_count = m_network_ptr->getBuffersPerCtrlVC();
- // (num_flits > 1) is used to determine ctrl vs data vnet
- // in NetworkInterface_d.cc
- assert(m_credit_count == 1);
+ assert(m_credit_count >= 1);
}
int get_inport() { return m_in_port; }
int get_invc() { return m_in_vc; }
int get_credit_count() { return m_credit_count; }
- void
- set_credit_count()
- {
- // only need to initialize credit count for data VCs
- // constructor sets this to BuffersPerCtrlVC by default
-
- if (m_network_ptr->get_vnet_type(m_id) == DATA_VNET_)
- m_credit_count = m_network_ptr->getBuffersPerDataVC();
- }
void set_inport(int port) { m_in_port = port; }
void set_invc(int vc) { m_in_vc = vc; }
OutputUnit_d::update_vc(int vc, int in_port, int in_vc)
{
m_outvc_state[vc]->setState(ACTIVE_, g_eventQueue_ptr->getTime() + 1);
- m_outvc_state[vc]->set_credit_count();
m_outvc_state[vc]->set_inport(in_port);
m_outvc_state[vc]->set_invc(in_vc);
m_router->update_incredit(in_port, in_vc,