Select one credited egress for a packet in a four-by-four mesh.
Hardware context: Four-router teaching mesh. On-chip network design
A router can see only its coordinates, the destination and the credits on its five outputs. Build its combinational forwarding decision.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
sample | 10 | input of each check |
Full specification
Unsigned coordinates range from zero to three. Move one link toward dx first, then toward dy. Eject locally when both match.
Bits 0 through 4 select local, increasing X, decreasing X, increasing Y and decreasing Y respectively.
Examples
Example 1
Two Axes Differ- Input
valid=1, (0,1) to (2,3), credit=11111
- Output
send = 'b00010
Both axes differ. X increases first.
Example 2
A Blocked Output- Input
valid=1, (2,3) to (2,1), credit=01111
- Output
send = 'b00000
The decreasing-Y port has no credit.
Example 3
Local Delivery- Input
valid=1, (1,1) to (1,1), credit=00001
- Output
send = 'b00001
The packet has reached its destination.
Constraints and Contract
- Set exactly the selected bit when valid and its matching credit are high. Otherwise drive zero. Never detour around a blocked port.
Hints
Hint 1
Find the requested neighbor before inspecting the credits.
Hint 2
Compare complete unsigned coordinates.
Hint 3
If the chosen output has no credit, what should the other four outputs show?
What the grader checks: Checks one forwarding decision for every endpoint pair, including idle and blocked transfers.
19 checks on Icarus Verilog · server. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain your source only; samples require the simulation service. A passing result establishes the tested cases, not a proof for all possible inputs.
See all 2 problems on this path