m_flit_size = p->flit_size;
m_number_of_pipe_stages = p->number_of_pipe_stages;
m_vcs_per_class = p->vcs_per_class;
- m_buffer_size = p->buffer_size;
+ m_buffers_per_data_vc = p->buffers_per_data_vc;
+ m_buffers_per_ctrl_vc = p->buffers_per_ctrl_vc;
m_using_network_testing = p->using_network_testing;
}
int getFlitSize() {return m_flit_size; }
int getNumPipeStages() {return m_number_of_pipe_stages; }
int getVCsPerClass() {return m_vcs_per_class; }
- int getBufferSize() {return m_buffer_size; }
+ int getBuffersPerDataVC() {return m_buffers_per_data_vc; }
+ int getBuffersPerCtrlVC() {return m_buffers_per_ctrl_vc; }
protected:
int m_flit_size;
int m_number_of_pipe_stages;
int m_vcs_per_class;
- int m_buffer_size;
+ int m_buffers_per_data_vc;
+ int m_buffers_per_ctrl_vc;
bool m_using_network_testing;
};
flit_size = Param.Int(16, "flit size in bytes")
number_of_pipe_stages = Param.Int(4, "router pipeline stages");
vcs_per_class = Param.Int(4, "virtual channels per message class");
- buffer_size = Param.Int(4, "buffer size in bytes");
+ buffers_per_data_vc = Param.Int(4, "buffers per data virtual channel");
+ buffers_per_ctrl_vc = Param.Int(1, "buffers per ctrl virtual channel");
using_network_testing = Param.Bool(False, "network testing enable");
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 flit_stage {I_, VA_, SA_, ST_, LT_, NUM_FLIT_STAGE_};
#define INFINITE_ 10000
for (int i = 0; i < m_router_ptr_vector.size(); i++) {
m_router_ptr_vector[i]->init();
}
+
+ 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 printConfig(std::ostream& out) const;
void print(std::ostream& out) const;
+ void
+ set_vnet_type(int vc, VNET_type vnet_type)
+ {
+ int vnet = vc/getVCsPerClass();
+ m_vnet_type[vnet] = vnet_type;
+ }
+
+ VNET_type
+ get_vnet_type(int vc)
+ {
+ int vnet = vc/getVCsPerClass();
+ return m_vnet_type[vnet];
+ }
+
+
inline void increment_injected_flits() { m_flits_injected++; }
inline void increment_received_flits() { m_flits_received++; }
GarnetNetwork_d(const GarnetNetwork_d& obj);
GarnetNetwork_d& operator=(const GarnetNetwork_d& obj);
+ std::vector<VNET_type > m_vnet_type;
// int m_virtual_networks;
// int m_nodes;
int m_flits_received, m_flits_injected;
// 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();
flit_d *fl = new flit_d(i, vc, vnet, num_flits, new_msg_ptr);
m_id = id;
m_vc_state = IDLE_;
m_time = g_eventQueue_ptr->getTime();
- m_credit_count = m_network_ptr->getBufferSize();
+
+ // this value is updated later for data VCs by set_credit_count()
+ 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);
}
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; }
inline bool
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,