|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectMeshSwitch
public class MeshSwitch
This switch is used for building the Mesh and Torus network. This type of switch is interconnected with different number of switches according to its position. For example if the switch is in the corner then two other switches are connected with this switch in Mesh topology. If in the side line other than the corners then three other switches are connected with this switch and if in the middle of the network then four other adjacent switches are connected with this switch. Along with these adjacent switches every switch in the network is connected with one or four adjacent nodes. Connection with four nodes provides better throughput.
Field Summary | |
---|---|
private int |
address
This is an int type variable used to hold the address (position) of the switch in the network. |
private InputLinkController[] |
inputLC
These are array of InputLinkController used to store the list of input link controller objects instantiated for input communication management with the adjacent nodes and switches. |
private int[] |
lastVCServedList
In order to facilitate round-robin service for the virtual channels, this array keeps track of the index of last served virtual channel on different links. |
private boolean[] |
LinkUseStatus
This array keeps track of the status of the output links if there are any transmission of flits in a particular simulation cycle. |
private Node[] |
nodeList
This is array of Node used to store the list of references of adjacent nodes. |
private int |
noOfPhysicalLink
This is an int type variable used to hold the number of physical links attached with the switch to perform communication between adjacent switches and nodes. |
private int |
noOfVirtualLink
This is an int type variable used to hold the number of virtual channel used for every physical link. |
private OutputLinkController[] |
outputLC
These are array of OutputLinkController used to store the list of output link controller objects instantiated for output communication management with the adjacent nodes and switches. |
private Router |
router
This is an object of type Router. |
private int |
switchIndex
Index of the switch in the global array of switches in the |
private int[] |
switchingInfoVector
This is an array of int variable having the size of noOfPhysicalLink * noOfVirtualLink. |
private MeshSwitch[] |
switchList
This is the array of MeshSwitch used to store the list of reference of adjacent switches. |
Constructor Summary | |
---|---|
MeshSwitch(int pLink,
int vLink,
int address,
int noOfAdjNode,
int noOfAdjSwitch,
int switchIndex)
Constructor of the MeshSwitch used for mesh and torus topology. |
Method Summary | |
---|---|
boolean |
addInputBufferData(int linkNo,
Flit flit,
int curCycle)
This method is called by adjacent nodes and switches to store the flit sent to it from output buffer of respective node/switch. |
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)
Instantiates the input and output link controllers. |
void |
createRouter()
Instantiates a concrete Router instance for this particular architecture. |
private void |
createSwitchingInfoVector()
Instantiates and initializes the switchingInfoVector data structure to hold the path mapping information. |
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)
Transfers a flit to an adjacent node. |
private void |
forwardFlitToSwitch(MeshSwitch adjSwitch,
int linkNo,
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. |
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. |
private int |
getMeshSwitchOutAdjLinkNo(int linkNo)
Returns the input physical link number of an adjacent switch, to which this switch in question is connected by an output physical link specified by the parameter 'linkNo' |
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 nodes to which the switch is directly 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)
This method is called by network in every cycle to transfer flit from input buffer to output buffer. |
void |
moveSwitchOutputBufferToInputBufferOfNodeSwitch(int curCycle)
This method is called by Network in every cycle to transfer flit from output buffer of the switch to input buffer of adjacent nodes and switches. |
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(MeshSwitch meshSwitch,
int linkNo)
Assigns a MeshSwitch reference to which this MeshSwitch is connected. |
void |
setAdjacentSwitch(Switch meshSwitch,
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)
This method is called by network in every cycle to set the request of transferring flit from the input buffer to output buffer of the respective switch. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int address
private int switchIndex
Network
private int noOfPhysicalLink
private int noOfVirtualLink
private MeshSwitch[] switchList
private Node[] nodeList
private int[] lastVCServedList
private InputLinkController[] inputLC
private OutputLinkController[] outputLC
private boolean[] LinkUseStatus
private Router router
private int[] switchingInfoVector
Constructor Detail |
---|
public MeshSwitch(int pLink, int vLink, int address, int noOfAdjNode, int noOfAdjSwitch, int switchIndex)
pLink
- Number of physical linksvLink
- Number of virtual channels per physical linkaddress
- Address of the switchnoOfAdjNode
- Number of adjacent nodesnoOfAdjSwitch
- Number of adjacent switchesswitchIndex
- index of this switch in the global array of switches in theNetwork.createMeshNetwork()
Method Detail |
---|
public void setNoOfPhysicalLink(int no)
Switch
setNoOfPhysicalLink
in interface Switch
no
- maximum number of physical linkspublic int getNoOfPhysicalLink()
Switch
getNoOfPhysicalLink
in interface Switch
public void setNoOfVirtualLink(int noVlink)
Switch
setNoOfVirtualLink
in interface Switch
noVlink
- number of virtual channel per physical linkpublic int getNoOfVirtualLink()
Switch
getNoOfVirtualLink
in interface Switch
public void setAddress(int addr)
Switch
setAddress
in interface Switch
addr
- address of the switchpublic int getAddress()
Switch
getAddress
in interface Switch
public void createRouter()
Switch
createRouter
in interface Switch
private void createLinkController(int linkCount, int vcCount)
linkCount
- number of physical linksvcCount
- number of virtual channels per linkpublic void setAdjacentNode(Node node, int linkNo)
Switch
setAdjacentNode
in interface Switch
node
- NodelinkNo
- the physical link number that connects the nodeNode
public int getNumAdjacentNode()
getNumAdjacentNode
in interface Switch
public void setAdjacentSwitch(MeshSwitch meshSwitch, int linkNo)
meshSwitch
- adjacent switch referencelinkNo
- the physical link number that connects these two switchespublic InputLinkController getInputLinkController(int linkNo)
Switch
getInputLinkController
in interface Switch
linkNo
- link number
InputLinkController
public void setInputLinkController(int linkNo, InputLinkController iLC)
Switch
setInputLinkController
in interface Switch
linkNo
- link numberiLC
- input link controllerInputLinkController
public OutputLinkController getOutputLinkController(int linkNo)
Switch
getOutputLinkController
in interface Switch
linkNo
- link number
public void setOutputLinkController(int linkNo, OutputLinkController oLC)
Switch
setOutputLinkController
in interface Switch
linkNo
- link numberoLC
- output link controllerprivate void createSwitchingInfoVector()
public void resetSwitchingInfoVector()
resetSwitchingInfoVector
in interface Switch
public boolean addInputBufferData(int linkNo, Flit flit, int curCycle)
addInputBufferData
in interface Switch
linkNo
- the input link controller where the flit arrives.flit
- Flit datacurCycle
- current simulation cycle
InputLinkController
,
InputVCBuffer
,
Flit
public boolean addOutputBufferData(int linkNo, Flit flit, int vcId, int curCycle)
Switch
addOutputBufferData
in interface Switch
linkNo
- link numberflit
- Flit datavcId
- virtual channel numbercurCycle
- simulation cycle
OutputLinkController.addOutputBufferData(Flit, int, int)
public boolean setSwitchingInfoVector(int dest, int src)
Switch
setSwitchingInfoVector
in interface Switch
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)
InputLinkController.setOutPathRequest(int)
public int getSwitchingInfoVector(int dest)
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).
getSwitchingInfoVector
in interface Switch
dest
- encoded output virtual channel information
InputLinkController.setOutPathRequest(int)
public Flit removeInputBufferData(int linkNo, int vcId, int curCycle)
Switch
removeInputBufferData
in interface Switch
linkNo
- input physical link numbervcId
- input virtual channel numbercurCycle
- simulation cycle
InputLinkController.removeInputBufferData(int, int)
public Flit removeOutputBufferData(int linkNo, int vcId, int curCycle)
Switch
removeOutputBufferData
in interface Switch
linkNo
- output physical link numbervcId
- output virtual channel numbercurCycle
- simulation cycle
OutputLinkController.removeOutputBufferData(int, int)
public int determineRoute(int src, int dest)
Switch
determineRoute
in interface Switch
src
- address of the source nodedest
- address of the destination node
Router.determineRoute(int, int, int)
public boolean hasFreeSlotInVCBuffer(int linkNo, int vcId)
Switch
hasFreeSlotInVCBuffer
in interface Switch
linkNo
- input physical link numbervcId
- virtual channel number on the input link
InputLinkController.hasFreeSlotInVCBuffer(int)
public void updateSwitchOutPathRequest(int curCycle)
updateSwitchOutPathRequest
in interface Switch
curCycle
- current simulation cycleInputLinkController.setOutPathRequest(int)
public void moveInputBufferToOutputBuffer(int curCycle)
moveInputBufferToOutputBuffer
in interface Switch
curCycle
- current simulation cycleInputLinkController
,
Network.moveSwitchTrafficFromInputBufferToOutputBuffer(int)
private void forwardFlitToSwitch(MeshSwitch adjSwitch, int linkNo, 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.
This method is called by moveSwitchOutputBufferToInputBufferOfNodeSwitch(int curCycle) method of this switch to complete transmission between this switch and actual parameter adjSwitch (an adjacent switch) for this current cycle.
The method performs its activities in the order given below.
adjSwitch
- adjacent Mesh switchlinkNo
- physical link number which connects the switch 'adjSwitch'curCycle
- simulation cycleprivate void forwardFlitToNode(Node adjNode, int linkNo, int curCycle)
Transfers a flit to an adjacent node.
This method is called by moveSwitchOutputBufferToInputBufferOfNodeSwitch(int curCycle) method of this switch to complete transmission between this switch and parameter adjNode for this current cycle.
The method performs its activities in the order given below.
adjNode
- node referencelinkNo
- physical link number that connects the node to the switchcurCycle
- simulation cyclepublic void moveSwitchOutputBufferToInputBufferOfNodeSwitch(int curCycle)
moveSwitchOutputBufferToInputBufferOfNodeSwitch
in interface Switch
curCycle
- simulation cycleNetwork.moveSwitchTrafficFromOutputBufferToInputBufferOfNodeSwitch(int)
,
forwardFlitToNode(Node, int, int)
,
forwardFlitToSwitch(MeshSwitch, int, int)
public boolean isVCFreeInSwitch(int linkNo, int vcId)
Switch
isVCFreeInSwitch
in interface Switch
linkNo
- input physical link numbervcId
- virtual channel number
InputLinkController.isVCFree(int)
public int getNumLinkActive()
Switch
getNumLinkActive
in interface Switch
public void updateStatusAfterCycle(int curCycle)
Switch
updateStatusAfterCycle
in interface Switch
curCycle
- simulation cycleprivate int getMeshSwitchOutAdjLinkNo(int linkNo)
linkNo
- output physical link number of this switch
public void setAdjacentSwitch(Switch meshSwitch, int linkNo)
Switch
setAdjacentSwitch
in interface Switch
meshSwitch
- adjacent switch referencelinkNo
- the physical link number that connects these two switches
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |