Two byte lanes share a 16-pin output latch. Accept a pair of masked commands together, even when each byte asks for a different operation.
Hardware context: ap_soc 16-pin GPIO bank. Board bring-up and interrupt-driven I/O
Two byte lanes share a 16-pin output latch. Accept a pair of masked commands together, even when each byte asks for a different operation.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
port_clk | 1 | stimulus, the same for every design |
port_rst_n | 1 | stimulus, the same for every design |
port_commit | 1 | stimulus, the same for every design |
port_op | 4 | stimulus, the same for every design |
port_lanes | 2 | stimulus, the same for every design |
port_mask | 16 | stimulus, the same for every design |
port_value | 16 | stimulus, the same for every design |
Full specification
This exercise combines two commands on one edge. op[1:0] controls the low byte. op[3:2] controls the high byte. Each code selects hold (0), set (1), clear (2) or toggle (3).
A mask bit of one selects a pin. lanes[0] permits changes to bits 7:0 and lanes[1] to bits 15:8. Preserve every other bit. Apply both commands when commit is high. Reset clears the latch.
Examples
Example 1
Reset Edge- Input
rst_n=1'h0, commit=1'h1, op=4'h5, lanes=2'h3, mask=16'hffff
- Output
value = 0x0
Reset discards both offered commands.
Example 2
Set Opposite Ends- Input
rst_n=1'h1, commit=1'h1, op=4'h5, lanes=2'h3, mask=16'h8001
- Output
value = 0x8001
Both lanes set a selected pin.
Example 3
Two Commands on One Edge- Input
rst_n=1'h1, commit=1'h1, op=4'hb, lanes=2'h3, mask=16'h8003
- Output
value = 0x2
The high byte clears pin 15 while the low byte toggles pins 0 and 1.
Constraints and Contract
- Sample on each rising edge. Synchronous active-low reset wins over all other inputs. Binary inputs only.
Hints
Hint 1
Label the operation and enable above each byte.
Hint 2
Work through one selected pin for each operation.
Hint 3
Repeat with a neighboring pin that already holds one.
What the grader checks: All sixteen operation pairs and all four lane selections act on both latch values. Mixed words, walking masks and inactive commits follow.
369 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 3 problems on this path