Class Node

java.lang.Object
  extended by Node

public class Node
extends java.lang.Object

IP Node (Node class) is the resource that is used in the system for message generation as well as message consumption. Node is connected with a switch (depends on network type) through one input physical link and one output physical link.

Version:
1.0

Field Summary
private  int address
           int type variable - holds the address of the node.
private  double clockRateFactor
          The speed factor of the node with respect to the switches.
private  InputVCBuffer inputBuffer
          An object of InputVCBuffer class.
private  int lastInVCServed
          This variable keeps track of the last input virtual channel from which a flit has been received and transferred into the message center.
private  int lastOutVCServed
          This variable keeps track of the last output virtual channel from which a flit has been transferred to the adjacent switch.
private  int lastSender
          Since in one cycle only one packet can be assigned a free virtual channel, this variable keeps track of the packet number that was last serviced.
private  int lastUsedOwnInCycle
          The last cycle in which it receives an flit from its adjacent switch.
private  int lastUsedOwnOutCycle
          The last cycle in which it an flit is transferred to the adjacent switch.
private  int linkNo
          The link number of the parent switch to which the node is connected.
private  boolean linkUsed
          This is a boolean value which is set for a particual cycle, if the node transmits a flit to its adjacent node.
private  int messageCount
          No of generated messages stored in the node's internal buffer that are yet to be transferred completely.
private  java.util.Vector[] messageList
          Vector type variable - holds the reference of packets which are to transmit.
private  int[] messageVCIndex
          An array of integer values containing the VC assigned to each generated message.
private  int nodeListIndex
          The index for this node in the universal array of nodes in the
private  int[] nodeReceivedFlitCounter
          It keeps track of the number of flits in a packet that are yet to be received.
(package private)  NodeTraffic nodeTraffic
          Reference to the NodeTraffic class.
private  OutputVCBuffer outputBuffer
          An object of OutputVCBufer class.
private  int[] outVCUsedList
          An array of integers that keep track of whether a virtual channel has already been assigned or not.
 Switch parent
          Reference to the parent switch object.
private  java.util.Vector[] receiveMessageList
          Vector type variable - holds the reference of packets which have been received.
private  int vcCount
          Total no.
 
Constructor Summary
Node(int address, Switch parent, int pLink, int vcCount, double clkRateFactor)
           Constructor of Node class
 
Method Summary
 boolean addInputBufferData(Flit flit, int curCycle)
          This method is called by the parent switch when flits are available in the switch sent by some other nodes to transfer to this node.
private  void checkForMsgFreeVC()
          Performs the following operations.
private  void dumpMessage(java.util.Vector packet)
          This method is invoked after a packet is completely received.
private  void fillEmptyBuffer(int curCycle)
          Performs the following operations.
 void forwardFlitToNodeMessageCenter(int curCycle)
          This method is called by the Network class at every cycle.
private  void forwardFlitToSwitch(int curCycle)
           Performs the transmission of flit from the virtual channel (output buffer) to physical channel and ultimately the flit is stored in the corresponding virtual channel of the switch.
private  void generateMessage(int curCycle)
          this method generates the message of L length.
 int getAddress()
          Returns the address of the node.
 double getClockRateFactor()
          Returns the clock rate factor of the node class.
 int getLastUsedOwnInCycle()
          Returns the lastUsedOwnInCycle variable of the node class
 int getLastUsedOwnOutCycle()
          Returns the lastUsedOwnOutCycle variable of the node class
 int getNodeListIndex()
          Returns the nodeListIndex variable of this class.
private  int getNumUsedVC()
          Returns the number of output virtual channels that are already occupied.
 boolean hasFreeSlotInInputVC(int vcId)
          Checks whether the input virtual channel has a free slot or not.
 boolean isInputVCFree(int vcId)
          Checks whether the input virtual channel is free or not.
 void setAddress(int addr)
          Sets the address of the node.
 void setClockRateFactor(double clkRateFactor)
          Sets the clock rate factor (variable clockRateFactor) of the node class.
 void setLastUsedOwnInCycle(int cycle)
          Sets the lastUsedOwnInCycle variable of the node class
 void setLastUsedOwnOutCycle(int cycle)
          Sets the lastUsedOwnOutCycle variable of the node class
 void setNodeListIndex(int index)
          Sets the nodeListIndex variable of this class.
 void updateOutput(int curCycle)
          This method is one of the core methods ot the Node class.
 void updateStatusAfterCycle(int curCycle)
          This method is called after the operation of every cycle to update statistical counters and reset the temporary status variables.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

address

private int address

int type variable - holds the address of the node. The address is represented in different ways for different types of networks.

For example for Mesh and Torus network the address is represented from row and column as well as position of the node in the switch. For Fat Tree network the address is represented from the level of the node and the position of the node in the level.


parent

public Switch parent
Reference to the parent switch object.


messageVCIndex

private int[] messageVCIndex
An array of integer values containing the VC assigned to each generated message.


messageCount

private int messageCount
No of generated messages stored in the node's internal buffer that are yet to be transferred completely.


messageList

private java.util.Vector[] messageList
Vector type variable - holds the reference of packets which are to transmit. Packet is the variable size list of flits on the other hand.


receiveMessageList

private java.util.Vector[] receiveMessageList
Vector type variable - holds the reference of packets which have been received.


nodeReceivedFlitCounter

private int[] nodeReceivedFlitCounter
It keeps track of the number of flits in a packet that are yet to be received.


outVCUsedList

private int[] outVCUsedList
An array of integers that keep track of whether a virtual channel has already been assigned or not.


vcCount

private int vcCount
Total no. of virtual channel per physical link


linkNo

private int linkNo
The link number of the parent switch to which the node is connected.


lastSender

private int lastSender
Since in one cycle only one packet can be assigned a free virtual channel, this variable keeps track of the packet number that was last serviced.


lastOutVCServed

private int lastOutVCServed
This variable keeps track of the last output virtual channel from which a flit has been transferred to the adjacent switch.


lastInVCServed

private int lastInVCServed
This variable keeps track of the last input virtual channel from which a flit has been received and transferred into the message center.


nodeListIndex

private int nodeListIndex
The index for this node in the universal array of nodes in the

See Also:
Network

linkUsed

private boolean linkUsed
This is a boolean value which is set for a particual cycle, if the node transmits a flit to its adjacent node. It is reset again in the updateStatusAfterCycle method.


clockRateFactor

private double clockRateFactor
The speed factor of the node with respect to the switches.


lastUsedOwnInCycle

private int lastUsedOwnInCycle
The last cycle in which it receives an flit from its adjacent switch. This is converted according to its clock rate factor with respect to the speed of the switches.


lastUsedOwnOutCycle

private int lastUsedOwnOutCycle
The last cycle in which it an flit is transferred to the adjacent switch. This is converted according to its clock rate factor with respect to the speed of the switches.


inputBuffer

private InputVCBuffer inputBuffer
An object of InputVCBuffer class. It represents the incoming physical link through which the switch sends data to the node. In our system for node we do not use link controller but incorporated only buffer as for a link controller has one buffer and a node contains only one link controller. Moreover no routing is required for node. The functional code of link controller is incorporated in buffer and link controller is working as a wrapper of the buffer.


outputBuffer

private OutputVCBuffer outputBuffer
An object of OutputVCBufer class. It is almost same as inputBuffer with only the change of data flow direction. Data is transferred to parent switch through this buffer. Parent switch switches it to other switches and nodes.


nodeTraffic

NodeTraffic nodeTraffic
Reference to the NodeTraffic class. NodeTraffic is an abstract class, its implementation defines the traffic pattern for the packet generated by this node object.

Constructor Detail

Node

public Node(int address,
            Switch parent,
            int pLink,
            int vcCount,
            double clkRateFactor)

Constructor of Node class

The constructor instantiates all the necessary objects (e.g. input/output buffer, messageList and so) for internal uses and keeps references of external objects (e.g. parent switch)

Parameters:
address - address of the node
parent - parent switch of the node
pLink - the physical link number through which the node is connected with the switch
vcCount - the number of virtual channel used for every physical channel
clkRateFactor - clock rate factor of the node with respect to those of the switches.
Method Detail

setClockRateFactor

public void setClockRateFactor(double clkRateFactor)
Sets the clock rate factor (variable clockRateFactor) of the node class.

Parameters:
clkRateFactor - clock rate factor

getClockRateFactor

public double getClockRateFactor()
Returns the clock rate factor of the node class.

Returns:
clock rate factor

setLastUsedOwnInCycle

public void setLastUsedOwnInCycle(int cycle)
Sets the lastUsedOwnInCycle variable of the node class

Parameters:
cycle - the last cycle in which it receives an flit from its adjacent switch

getLastUsedOwnInCycle

public int getLastUsedOwnInCycle()
Returns the lastUsedOwnInCycle variable of the node class

Returns:
the last cycle in which it receives an flit from its adjacent switch

setLastUsedOwnOutCycle

public void setLastUsedOwnOutCycle(int cycle)
Sets the lastUsedOwnOutCycle variable of the node class

Parameters:
cycle - the last cycle in which it an flit is transferred to the adjacent switch.

getLastUsedOwnOutCycle

public int getLastUsedOwnOutCycle()
Returns the lastUsedOwnOutCycle variable of the node class

Returns:
the last cycle in which it an flit is transferred to the adjacent switch.

setAddress

public void setAddress(int addr)
Sets the address of the node.

Parameters:
addr - address

getAddress

public int getAddress()
Returns the address of the node.

Returns:
address

generateMessage

private void generateMessage(int curCycle)
this method generates the message of L length. L is found by exponential distribution of mean avgMessageLength. this method is called T cycle. T is found by exponential distribution of mean avgInterArrival.


getNumUsedVC

private int getNumUsedVC()
Returns the number of output virtual channels that are already occupied.

Returns:
the number of used output virtual channel

updateOutput

public void updateOutput(int curCycle)
This method is one of the core methods ot the Node class. It organizes the operation of the Node object.

It first checks if this is the right cycle to generate message.

It, then, looks up for a free VC to assign to its generated messages that are yet to be assigned a VC.

It calls the appropriate method (fillEmptyBuffer) to transfer a flit to the output buffer.

It calls the appropriate method (forwardFlitToSwitch) to transfer a flit to the adjacent switch.

Parameters:
curCycle - current simulation cycle.

checkForMsgFreeVC

private void checkForMsgFreeVC()
Performs the following operations.


fillEmptyBuffer

private void fillEmptyBuffer(int curCycle)
Performs the following operations.

Parameters:
curCycle - current simulation cycle

forwardFlitToSwitch

private void forwardFlitToSwitch(int curCycle)

Performs the transmission of flit from the virtual channel (output buffer) to physical channel and ultimately the flit is stored in the corresponding virtual channel of the switch.

The method performs its activities in the order given below.

Parameters:
curCycle - current simulation cycle

isInputVCFree

public boolean isInputVCFree(int vcId)
Checks whether the input virtual channel is free or not.

Parameters:
vcId - virtual channel no
Returns:
true-if the virtual channel is free, false-otherwise

hasFreeSlotInInputVC

public boolean hasFreeSlotInInputVC(int vcId)
Checks whether the input virtual channel has a free slot or not.

Parameters:
vcId - virtual channel no.
Returns:
true-if the virtual channel has one or more free slots, false-otherwise.

addInputBufferData

public boolean addInputBufferData(Flit flit,
                                  int curCycle)
This method is called by the parent switch when flits are available in the switch sent by some other nodes to transfer to this node. The method simply calls the addBufferData() method of the inputBuffer object that is instantiated for the node. The input buffer performs the real functions.

Parameters:
flit - flit data
curCycle - current simulation cycle
Returns:
true-if flit added to the buffer, false-otherwise.

forwardFlitToNodeMessageCenter

public void forwardFlitToNodeMessageCenter(int curCycle)
This method is called by the Network class at every cycle. The method performs in the following way.

Parameters:
curCycle - current simulation cycle

dumpMessage

private void dumpMessage(java.util.Vector packet)
This method is invoked after a packet is completely received. This method can be used to get the total hops traversed by this packet.

Parameters:
packet - received packet

updateStatusAfterCycle

public void updateStatusAfterCycle(int curCycle)
This method is called after the operation of every cycle to update statistical counters and reset the temporary status variables.

Parameters:
curCycle - current simulation cycle

setNodeListIndex

public void setNodeListIndex(int index)
Sets the nodeListIndex variable of this class.

Parameters:
index - index of this node class in the universal nodelist

getNodeListIndex

public int getNodeListIndex()
Returns the nodeListIndex variable of this class.

Returns:
index of this node class in the universal nodelist