Class OutputVCBuffer

java.lang.Object
  extended by OutputVCBuffer

public class OutputVCBuffer
extends java.lang.Object

There is one output buffer for each of the output physical link. As we are using wormhole switching and virtual channel technique to avoid deadlock developed in wormhole switching output buffer provides these virtual channel support. A virtual channel is simply a buffer. So buffer buffer object holds as many buffer objects as many virtual channels are required. OutputBuffer class defines such output buffer object. Note: some of the codes have been commented as they are deprecated, no longer used. ['not used' precedes such comments.]

Version:
1.0

Field Summary
private  boolean[] buffAssignedStatus
          An array of booleans of size VCN.
private  boolean[] buffMidStatus
          An array of booleans of size VCN.
private  java.util.Vector[] data
          A Vector type object instantiated to hold the Buffer objects.
private  int[] flitCounter
          An array of integer of size VCN.
private  int numVCCount
          Number of virtual channels per physical channel used in the system.
private  int pLinkNo
          The physical link no.
 
Constructor Summary
OutputVCBuffer(int linkNo)
          Default Constructor.
OutputVCBuffer(int vcCount, int linkNo)
          Instantiates all the necessary data required to manage the output buffer and then initialize all the data.
 
Method Summary
 boolean addBufferData(Flit flit, int vcId, int curCycle)
          Stores a flit in a specified virtual channel of the output buffer.
 Flit getBufferData(int vcId)
          Retrieve the flit from the specified virtual channel number of this output buffer object.
 int getFreeVC_NEW(Flit f)
          An alternative of the getFreeVC()
 int getFreeVC()
          Returns a free virtual channel on the physical link.
 int getNumSlotUsed()
          Returns total no.
 int getNumUsedVC()
          Returns the number of used VCs in a particular simulation cycle.
 boolean hasFlitToSend(int vcId)
          Returns whether there are more flits to send from the virtual channel.
 boolean hasFreeSlotInVC(int vcId)
          Checks whether the virtual channel can hold another incoming flit of the packet that already holds the virtual channel.
 Flit removeBufferData(int vcId, int curCycle)
          Remove the flit from the specified virtual channel of the output buffer.
 void updateStatusAfterCycle()
          Re-initializes the temporary status variables after each cycle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

data

private java.util.Vector[] data
A Vector type object instantiated to hold the Buffer objects. This vector holds VCN number of buffer objects, where VCN indicates number of virtual channels per physical channel used in the system.


pLinkNo

private int pLinkNo
The physical link no. on which this input buffer is associated.


numVCCount

private int numVCCount
Number of virtual channels per physical channel used in the system.


flitCounter

private int[] flitCounter
An array of integer of size VCN. One cell is for every virtual channel. It is used to track the number of flit is to pass (in a packet)


buffMidStatus

private boolean[] buffMidStatus
An array of booleans of size VCN. It is used temporarily to hold the stattus of a buffer to indicate whether it can be used in the next cycle for storage. This value is set when a flit is removed from the buffer.


buffAssignedStatus

private boolean[] buffAssignedStatus
An array of booleans of size VCN. It is used temporarily to hold the stattus of a buffer to indicate whether it has been assigned in the simulation cycle or not.

Constructor Detail

OutputVCBuffer

public OutputVCBuffer(int linkNo)
Default Constructor.

Parameters:
linkNo - Physical link no

OutputVCBuffer

public OutputVCBuffer(int vcCount,
                      int linkNo)
Instantiates all the necessary data required to manage the output buffer and then initialize all the data.

Parameters:
vcCount - Number of virtual channel for the output physical link.
linkNo - Physical link no.
Method Detail

addBufferData

public boolean addBufferData(Flit flit,
                             int vcId,
                             int curCycle)
Stores a flit in a specified virtual channel of the output buffer. The method is called by an Input Link Controller. Everytime a flit needs to be transferred to an adjacent switch or node, at firth the flit is transferred to the output buffer of the destined physical link from an input buffer of the switch. Similarly, the last service timestamp of the flit is also modified.

Parameters:
flit - Flit data
vcId - Virtual Channel no. to which this flit has to be delegated
curCycle - Current timestamp
Returns:
true (always, as before invoking this method, usually the status of the buffer is checked whether it can hold anymore flit)

removeBufferData

public Flit removeBufferData(int vcId,
                             int curCycle)
Remove the flit from the specified virtual channel of the output buffer. The method is called by an Input Link Controller. The flit can be removed if it is stored there at least one cycle ahead of the current timestamp specified by 'curCycle'.

Parameters:
vcId - Virtual channel number from where the flit is to be removed
curCycle - Current timestamp
Returns:
the flit, if there is any flit stored in the buffer one cycle prior to this operation, else null

updateStatusAfterCycle

public void updateStatusAfterCycle()
Re-initializes the temporary status variables after each cycle. If a flit has been removed from the buffer, it gets such information from the buffMidStatus variable. Then it decrements the flitCounter variables. Finallly, if all flits of the packet leaves the input buffer, then it re-initializes other route-info holding variables.


getBufferData

public Flit getBufferData(int vcId)
Retrieve the flit from the specified virtual channel number of this output buffer object. Here the flit is not removed from the buffer. The flit may be required for testing. For those cases this method is called.

Parameters:
vcId - virtual channel number
Returns:
Flit data

hasFreeSlotInVC

public boolean hasFreeSlotInVC(int vcId)
Checks whether the virtual channel can hold another incoming flit of the packet that already holds the virtual channel.

Parameters:
vcId - Virtual channel no.
Returns:
true-if the VC has free slots, false-otherwise.

getFreeVC

public int getFreeVC()
Returns a free virtual channel on the physical link.

Returns:
free Virtual channel no.

getFreeVC_NEW

public int getFreeVC_NEW(Flit f)
An alternative of the getFreeVC()

Parameters:
f - flit to get its input vc no
Returns:
a free output channel if available, -1 otherwise

hasFlitToSend

public boolean hasFlitToSend(int vcId)
Returns whether there are more flits to send from the virtual channel.

Parameters:
vcId - Virtual channel no.
Returns:
true-if one or more flits occupy the virtual channel, false-if the virtual channel is empty.

getNumUsedVC

public int getNumUsedVC()
Returns the number of used VCs in a particular simulation cycle.

Returns:
the number of used VCs

getNumSlotUsed

public int getNumSlotUsed()
Returns total no. of slots occupied by various flits in the output buffer.

Returns:
Number of slots used