Interface Switch

All Known Implementing Classes:
ExFatTreeSwitch, FatTreeSwitch, MeshSwitch, OctalSwitch

public interface Switch

Switches are the objects of the network where switching of flits from various input ports to output ports are performed as well as the path which will be taken from the various output paths is selected (routing). To support the wormhole switching the switch provides various facilities.

The Switch interface defines all the necessary functions that any class simulating the characteristics of the switch in the NoC must implement.

Version:
1.0

Method Summary
 boolean addInputBufferData(int linkNo, Flit flit, int curCycle)
          Adds a flit to the input buffer on a particular physical link.
 boolean addOutputBufferData(int linkNo, Flit flit, int vcId, int curCycle)
          Adds a flit to the output buffer on a particular physical link.
 void createRouter()
          Instantiates a concrete Router instance for this particular architecture.
 int determineRoute(int src, int dest)
          Determines the outgoing link to switch a packet orgininated from a source node (src) and destined to the destination node (dest).
 int getAddress()
          Returns the address of the switch.
 InputLinkController getInputLinkController(int linkNo)
          Returns the input link controller of the switch on a particular physical link.
 int getNoOfPhysicalLink()
          Returns the maximum number of physical links information.
 int getNoOfVirtualLink()
          Returns the number of virtual channel per physical link information.
 int getNumAdjacentNode()
          Returns the number of adjacent nodes to which the switch is connected.
 int getNumLinkActive()
          Returns the number of physical links for the switch
 OutputLinkController getOutputLinkController(int linkNo)
          Returns the output link controller of the switch on a particular physical link.
 int getSwitchingInfoVector(int dest)
           Returns the input virtual channel information for a packet flowing through the output virtual channel.
 boolean hasFreeSlotInVCBuffer(int linkNo, int vcId)
          Checks whether there is one or more slots in the input virtual channel of an input buffer or not.
 boolean isVCFreeInSwitch(int linkNo, int vcId)
          Checks if the virtual channels in the input buffer of a particular physical link is available to be assigned to a new incoming packet.
 void moveInputBufferToOutputBuffer(int curCycle)
          Transfers the flits from the input buffers to the output buffers.
 void moveSwitchOutputBufferToInputBufferOfNodeSwitch(int curCycle)
          Transfers the flits from the output buffers to the input buffers of the adjacent switches or nodes.
 Flit removeInputBufferData(int linkNo, int vcId, int curCycle)
          Removes a flit data from an input virtual channel of the input buffer on a particular physical link.
 Flit removeOutputBufferData(int linkNo, int vcId, int curCycle)
          Removes a flit data from an output virtual channel of the output buffer on a particular physical link.
 void resetSwitchingInfoVector()
          Resets the switching info vector of the Switch instance which keeps track of the assignment of a output virtual channel to a packet on a input virtual channel.
 void setAddress(int addr)
          Sets the address of the switch.
 void setAdjacentNode(Node node, int linkNo)
          Assigns a node reference to which this Switch is connected.
 void setAdjacentSwitch(Switch switchref, int linkNo)
          Assigns a switch reference to which this Switch is connected.
 void setInputLinkController(int linkNo, InputLinkController iLC)
          Assigns an input link controller to the switch on a particular physical link.
 void setNoOfPhysicalLink(int no)
          Sets the maximum number of physical links information.
 void setNoOfVirtualLink(int noVlink)
          Sets the number of virtual channel per physical link information.
 void setOutputLinkController(int linkNo, OutputLinkController oLC)
          Assigns an output link controller to the switch on a particular physical link.
 boolean setSwitchingInfoVector(int dest, int src)
          Sets the path information for a pair of input virtual channel and output virtual channel.
 void updateStatusAfterCycle(int curCycle)
          Updates the statistical counters for a particular simulation cycle and re-initializes the temporary status variables.
 void updateSwitchOutPathRequest(int curCycle)
          Assigns or updates the path information for the flits stored in the input buffers.
 

Method Detail

setNoOfPhysicalLink

void setNoOfPhysicalLink(int no)
Sets the maximum number of physical links information.

Parameters:
no - maximum number of physical links

getNoOfPhysicalLink

int getNoOfPhysicalLink()
Returns the maximum number of physical links information.

Returns:
maximum number of physical links

setNoOfVirtualLink

void setNoOfVirtualLink(int noVlink)
Sets the number of virtual channel per physical link information.

Parameters:
noVlink - number of virtual channel per physical link

getNoOfVirtualLink

int getNoOfVirtualLink()
Returns the number of virtual channel per physical link information.

Returns:
number of virtual channel per physical link

setAddress

void setAddress(int addr)
Sets the address of the switch.

Parameters:
addr - address of the switch

getAddress

int getAddress()
Returns the address of the switch.

Returns:
address of the switch

setAdjacentNode

void setAdjacentNode(Node node,
                     int linkNo)
Assigns a node reference to which this Switch is connected.

Parameters:
node - Node
linkNo - the physical link number that connects the node
See Also:
Node

getNumAdjacentNode

int getNumAdjacentNode()
Returns the number of adjacent nodes to which the switch is connected.

Returns:
number of adjacent nodes

setAdjacentSwitch

void setAdjacentSwitch(Switch switchref,
                       int linkNo)
Assigns a switch reference to which this Switch is connected.

Parameters:
switchref - adjacent switch reference
linkNo - the physical link number that connects these two switches

getInputLinkController

InputLinkController getInputLinkController(int linkNo)
Returns the input link controller of the switch on a particular physical link.

Parameters:
linkNo - link number
Returns:
input link controller reference of the switch on the link 'linkNo'
See Also:
InputLinkController

setInputLinkController

void setInputLinkController(int linkNo,
                            InputLinkController iLC)
Assigns an input link controller to the switch on a particular physical link.

Parameters:
linkNo - link number
iLC - input link controller
See Also:
InputLinkController

getOutputLinkController

OutputLinkController getOutputLinkController(int linkNo)
Returns the output link controller of the switch on a particular physical link.

Parameters:
linkNo - link number
Returns:
output link controller reference of the switch on the link 'linkNo'

setOutputLinkController

void setOutputLinkController(int linkNo,
                             OutputLinkController oLC)
Assigns an output link controller to the switch on a particular physical link.

Parameters:
linkNo - link number
oLC - output link controller

resetSwitchingInfoVector

void resetSwitchingInfoVector()
Resets the switching info vector of the Switch instance which keeps track of the assignment of a output virtual channel to a packet on a input virtual channel.


addInputBufferData

boolean addInputBufferData(int linkNo,
                           Flit flit,
                           int curCycle)
Adds a flit to the input buffer on a particular physical link.

Parameters:
linkNo - link number
flit - Flit data
curCycle - simulation cycle
Returns:
true-if flit can be added, false-otherwise.
See Also:
InputVCBuffer.addBufferData(Flit, int, int)

addOutputBufferData

boolean addOutputBufferData(int linkNo,
                            Flit flit,
                            int vcId,
                            int curCycle)
Adds a flit to the output buffer on a particular physical link.

Parameters:
linkNo - link number
flit - Flit data
vcId - virtual channel number
curCycle - simulation cycle
Returns:
true-if flit can be added, false-otherwise.
See Also:
OutputLinkController.addOutputBufferData(Flit, int, int)

setSwitchingInfoVector

boolean setSwitchingInfoVector(int dest,
                               int src)
Sets the path information for a pair of input virtual channel and output virtual channel.

Parameters:
dest - ((output link number * number of VC per link) + output virtual channel number)
src - ((input link number * number of VC per link) + input virtual channel number)
Returns:
true-if the path can be set, false-otherwise
See Also:
InputLinkController.setOutPathRequest(int)

getSwitchingInfoVector

int getSwitchingInfoVector(int dest)

Returns the input virtual channel information for a packet flowing through the output virtual channel.

This pair of values identify the switching path in the switch for a packet.

Here the input virtual channel information is encoded as ((input link number * number of VC per link) + input virtual channel number) and the output virtual channel information is encoded as ((output link number * number of VC per link) + output virtual channel number).

Parameters:
dest - encoded output virtual channel information
Returns:
encoded input virtual channel information
See Also:
InputLinkController.setOutPathRequest(int)

removeInputBufferData

Flit removeInputBufferData(int linkNo,
                           int vcId,
                           int curCycle)
Removes a flit data from an input virtual channel of the input buffer on a particular physical link.

Parameters:
linkNo - input physical link number
vcId - input virtual channel number
curCycle - simulation cycle
Returns:
Flit
See Also:
InputLinkController.removeInputBufferData(int, int)

removeOutputBufferData

Flit removeOutputBufferData(int linkNo,
                            int vcId,
                            int curCycle)
Removes a flit data from an output virtual channel of the output buffer on a particular physical link.

Parameters:
linkNo - output physical link number
vcId - output virtual channel number
curCycle - simulation cycle
Returns:
Flit
See Also:
OutputLinkController.removeOutputBufferData(int, int)

determineRoute

int determineRoute(int src,
                   int dest)
Determines the outgoing link to switch a packet orgininated from a source node (src) and destined to the destination node (dest).

Parameters:
src - address of the source node
dest - address of the destination node
Returns:
outgoing physical link of the switch
See Also:
Router.determineRoute(int, int, int)

hasFreeSlotInVCBuffer

boolean hasFreeSlotInVCBuffer(int linkNo,
                              int vcId)
Checks whether there is one or more slots in the input virtual channel of an input buffer or not.

Parameters:
linkNo - input physical link number
vcId - virtual channel number on the input link
Returns:
true-if more slots are available, false-otherwise
See Also:
InputLinkController.hasFreeSlotInVCBuffer(int)

updateSwitchOutPathRequest

void updateSwitchOutPathRequest(int curCycle)
Assigns or updates the path information for the flits stored in the input buffers.

Parameters:
curCycle - simualtion cycle
See Also:
InputLinkController.setOutPathRequest(int)

moveInputBufferToOutputBuffer

void moveInputBufferToOutputBuffer(int curCycle)
Transfers the flits from the input buffers to the output buffers.

Parameters:
curCycle - simulation cycle

moveSwitchOutputBufferToInputBufferOfNodeSwitch

void moveSwitchOutputBufferToInputBufferOfNodeSwitch(int curCycle)
Transfers the flits from the output buffers to the input buffers of the adjacent switches or nodes.

Parameters:
curCycle -

isVCFreeInSwitch

boolean isVCFreeInSwitch(int linkNo,
                         int vcId)
Checks if the virtual channels in the input buffer of a particular physical link is available to be assigned to a new incoming packet.

Parameters:
linkNo - input physical link number
vcId - virtual channel number
Returns:
true-if the virtual channel is free, false-otherwise.
See Also:
InputLinkController.isVCFree(int)

getNumLinkActive

int getNumLinkActive()
Returns the number of physical links for the switch

Returns:
number of valid physical links

updateStatusAfterCycle

void updateStatusAfterCycle(int curCycle)
Updates the statistical counters for a particular simulation cycle and re-initializes the temporary status variables.

Parameters:
curCycle - simulation cycle

createRouter

void createRouter()
Instantiates a concrete Router instance for this particular architecture.