Class OctalSwitch

java.lang.Object
  extended by OctalSwitch
All Implemented Interfaces:
Switch

public class OctalSwitch
extends java.lang.Object
implements Switch


Field Summary
private  int address
           
private  InputLinkController[] inputLC
           
private  int[] lastVCServedList
           
private  boolean[] LinkUseStatus
           
 Node[] nodeList
           
private  int noOfPhysicalLink
           
private  int noOfVirtualLink
           
private  OutputLinkController[] outputLC
           
private  Router router
           
private  int switchIndex
           
private  int[] switchingInfoVector
           
 OctalSwitch[] switchList
           
 
Constructor Summary
OctalSwitch(int pLink, int vLink, int address, int noOfAdjNode, int noOfAdjSwitch, int switchIndex)
           
 
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.
private  void createLinkController(int linkCount, int vcCount)
           
 void createRouter()
          Instantiates a concrete Router instance for this particular architecture.
private  void createSwitchingInfoVector()
           
 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).
private  void forwardFlitToNode(Node adjNode, int linkNo, int curCycle)
           
private  void forwardFlitToSwitch(OctalSwitch adjSwitch, int linkNo, int curCycle)
           
 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 getSwitchIndex()
           
 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(OctalSwitch octalSwitch, int linkNo)
           
 void setAdjacentSwitch(Switch octalSwitch, 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lastVCServedList

private int[] lastVCServedList

switchList

public OctalSwitch[] switchList

nodeList

public Node[] nodeList

noOfPhysicalLink

private int noOfPhysicalLink

noOfVirtualLink

private int noOfVirtualLink

address

private int address

switchIndex

private int switchIndex

inputLC

private InputLinkController[] inputLC

outputLC

private OutputLinkController[] outputLC

LinkUseStatus

private boolean[] LinkUseStatus

router

private Router router

switchingInfoVector

private int[] switchingInfoVector
Constructor Detail

OctalSwitch

public OctalSwitch(int pLink,
                   int vLink,
                   int address,
                   int noOfAdjNode,
                   int noOfAdjSwitch,
                   int switchIndex)
Method Detail

getSwitchIndex

public int getSwitchIndex()

setNoOfPhysicalLink

public void setNoOfPhysicalLink(int no)
Description copied from interface: Switch
Sets the maximum number of physical links information.

Specified by:
setNoOfPhysicalLink in interface Switch
Parameters:
no - maximum number of physical links

getNoOfPhysicalLink

public int getNoOfPhysicalLink()
Description copied from interface: Switch
Returns the maximum number of physical links information.

Specified by:
getNoOfPhysicalLink in interface Switch
Returns:
maximum number of physical links

setNoOfVirtualLink

public void setNoOfVirtualLink(int noVlink)
Description copied from interface: Switch
Sets the number of virtual channel per physical link information.

Specified by:
setNoOfVirtualLink in interface Switch
Parameters:
noVlink - number of virtual channel per physical link

getNoOfVirtualLink

public int getNoOfVirtualLink()
Description copied from interface: Switch
Returns the number of virtual channel per physical link information.

Specified by:
getNoOfVirtualLink in interface Switch
Returns:
number of virtual channel per physical link

setAddress

public void setAddress(int addr)
Description copied from interface: Switch
Sets the address of the switch.

Specified by:
setAddress in interface Switch
Parameters:
addr - address of the switch

getAddress

public int getAddress()
Description copied from interface: Switch
Returns the address of the switch.

Specified by:
getAddress in interface Switch
Returns:
address of the switch

createRouter

public void createRouter()
Description copied from interface: Switch
Instantiates a concrete Router instance for this particular architecture.

Specified by:
createRouter in interface Switch

createLinkController

private void createLinkController(int linkCount,
                                  int vcCount)

setAdjacentNode

public void setAdjacentNode(Node node,
                            int linkNo)
Description copied from interface: Switch
Assigns a node reference to which this Switch is connected.

Specified by:
setAdjacentNode in interface Switch
Parameters:
node - Node
linkNo - the physical link number that connects the node
See Also:
Node

getNumAdjacentNode

public int getNumAdjacentNode()
Description copied from interface: Switch
Returns the number of adjacent nodes to which the switch is connected.

Specified by:
getNumAdjacentNode in interface Switch
Returns:
number of adjacent nodes

setAdjacentSwitch

public void setAdjacentSwitch(OctalSwitch octalSwitch,
                              int linkNo)

getInputLinkController

public InputLinkController getInputLinkController(int linkNo)
Description copied from interface: Switch
Returns the input link controller of the switch on a particular physical link.

Specified by:
getInputLinkController in interface Switch
Parameters:
linkNo - link number
Returns:
input link controller reference of the switch on the link 'linkNo'
See Also:
InputLinkController

setInputLinkController

public void setInputLinkController(int linkNo,
                                   InputLinkController iLC)
Description copied from interface: Switch
Assigns an input link controller to the switch on a particular physical link.

Specified by:
setInputLinkController in interface Switch
Parameters:
linkNo - link number
iLC - input link controller
See Also:
InputLinkController

getOutputLinkController

public OutputLinkController getOutputLinkController(int linkNo)
Description copied from interface: Switch
Returns the output link controller of the switch on a particular physical link.

Specified by:
getOutputLinkController in interface Switch
Parameters:
linkNo - link number
Returns:
output link controller reference of the switch on the link 'linkNo'

setOutputLinkController

public void setOutputLinkController(int linkNo,
                                    OutputLinkController oLC)
Description copied from interface: Switch
Assigns an output link controller to the switch on a particular physical link.

Specified by:
setOutputLinkController in interface Switch
Parameters:
linkNo - link number
oLC - output link controller

createSwitchingInfoVector

private void createSwitchingInfoVector()

resetSwitchingInfoVector

public void resetSwitchingInfoVector()
Description copied from interface: Switch
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.

Specified by:
resetSwitchingInfoVector in interface Switch

addInputBufferData

public boolean addInputBufferData(int linkNo,
                                  Flit flit,
                                  int curCycle)
Description copied from interface: Switch
Adds a flit to the input buffer on a particular physical link.

Specified by:
addInputBufferData in interface Switch
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

public boolean addOutputBufferData(int linkNo,
                                   Flit flit,
                                   int vcId,
                                   int curCycle)
Description copied from interface: Switch
Adds a flit to the output buffer on a particular physical link.

Specified by:
addOutputBufferData in interface Switch
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

public boolean setSwitchingInfoVector(int dest,
                                      int src)
Description copied from interface: Switch
Sets the path information for a pair of input virtual channel and output virtual channel.

Specified by:
setSwitchingInfoVector in interface Switch
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

public int getSwitchingInfoVector(int dest)
Description copied from interface: Switch

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).

Specified by:
getSwitchingInfoVector in interface Switch
Parameters:
dest - encoded output virtual channel information
Returns:
encoded input virtual channel information
See Also:
InputLinkController.setOutPathRequest(int)

removeInputBufferData

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

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

removeOutputBufferData

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

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

determineRoute

public int determineRoute(int src,
                          int dest)
Description copied from interface: Switch
Determines the outgoing link to switch a packet orgininated from a source node (src) and destined to the destination node (dest).

Specified by:
determineRoute in interface Switch
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

public boolean hasFreeSlotInVCBuffer(int linkNo,
                                     int vcId)
Description copied from interface: Switch
Checks whether there is one or more slots in the input virtual channel of an input buffer or not.

Specified by:
hasFreeSlotInVCBuffer in interface Switch
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

public void updateSwitchOutPathRequest(int curCycle)
Description copied from interface: Switch
Assigns or updates the path information for the flits stored in the input buffers.

Specified by:
updateSwitchOutPathRequest in interface Switch
Parameters:
curCycle - simualtion cycle
See Also:
InputLinkController.setOutPathRequest(int)

moveInputBufferToOutputBuffer

public void moveInputBufferToOutputBuffer(int curCycle)
Description copied from interface: Switch
Transfers the flits from the input buffers to the output buffers.

Specified by:
moveInputBufferToOutputBuffer in interface Switch
Parameters:
curCycle - simulation cycle

forwardFlitToSwitch

private void forwardFlitToSwitch(OctalSwitch adjSwitch,
                                 int linkNo,
                                 int curCycle)

forwardFlitToNode

private void forwardFlitToNode(Node adjNode,
                               int linkNo,
                               int curCycle)

moveSwitchOutputBufferToInputBufferOfNodeSwitch

public void moveSwitchOutputBufferToInputBufferOfNodeSwitch(int curCycle)
Description copied from interface: Switch
Transfers the flits from the output buffers to the input buffers of the adjacent switches or nodes.

Specified by:
moveSwitchOutputBufferToInputBufferOfNodeSwitch in interface Switch

isVCFreeInSwitch

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

Specified by:
isVCFreeInSwitch in interface Switch
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

public int getNumLinkActive()
Description copied from interface: Switch
Returns the number of physical links for the switch

Specified by:
getNumLinkActive in interface Switch
Returns:
number of valid physical links

updateStatusAfterCycle

public void updateStatusAfterCycle(int curCycle)
Description copied from interface: Switch
Updates the statistical counters for a particular simulation cycle and re-initializes the temporary status variables.

Specified by:
updateStatusAfterCycle in interface Switch
Parameters:
curCycle - simulation cycle

setAdjacentSwitch

public void setAdjacentSwitch(Switch octalSwitch,
                              int linkNo)
Description copied from interface: Switch
Assigns a switch reference to which this Switch is connected.

Specified by:
setAdjacentSwitch in interface Switch
Parameters:
octalSwitch - adjacent switch reference
linkNo - the physical link number that connects these two switches