mail@pastecode.io avatar
a year ago
2.2 kB

It will be great if each of you independently write the full code of router arbitration that performs the following:

High priority always wins over low priority.
Weighted round robin for same priority.
Add support for packet, i.e. when a packet starts to be send on an output VC from an input VC, the output VC will keep receiving the flits of that packet till eop.  However multiple VCs on an output port can still interleave.  Basically, the goal is that we cannot interleave multiple packets within a VC buffer, ever.
When packets have variable lengths, make sure that weighted round robin accounts for packet sizes.
Next, add flow control to the router code, and flit movement based on arbitration results.

After you have the arbitration code and flow control implemented build a multi router system and test it using a simulation system. Assume two routers connected to each other, and each router connected to agents which are sending and receiving packets.  You can assume that each router has 4 input and 4 output ports.  Port has 2 VC.  The routers are connected to each other on one of their ports.  The other 3 router ports are each connected to an agent.  Packets are going between the routers in both directions.  The agent of a router will generate and send packets of random length to random agent connected to the other router, and vice versa.  The agents will also receive incoming packets.

The simulator will work on a clock, where all arbitration will occur on a clock tick.  After arbitration, the flits will be moved across the channel in the next clock tick, before another arbitration in that clock tick.

Write tests to make sure that priority and weights are respected in simulation.

// Pseudo code below

struct Flit {
	int id;
	int src;
	int outputPort;
    int outputVc;
	int dest;
	packet* pk;
	bool sop;
	bool eop;

struct VC {
	int vc_id;
	int priority;
	int weight;
	Flit buffer[SIZE1];

struct inputPort {
	VC channels[];
	int id;

class outputPort{
	int id;
	int creditCounter[];

class Router{
	int id;
	inputPort ip[];
	outputPort op[];
	void arbitration(){