Decode the ap_soc life-cycle state and open or close each debug and test door. A damaged state must close every door.
Hardware context: ap_soc boot image gate and life-cycle debug gate. Secure boot and production debug lock
ap_soc reads its life-cycle state from one-time memory as an 8-bit code. Each pair of the four valid codes differs in at least four bits. One flipped bit can never turn one state into another.
Any other code is invalid. An invalid code means the memory is damaged or under attack, so the gate closes everything and raises lc_fault. The states, codes and doors are ap_soc design choices.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
sample | 10 | input of each check |
Full specification
| State | Code | tap_en | halt_en, bus_en | test_en | key_en |
|---|---|---|---|---|---|
| TEST | 8'h3C | 1 | 1 | 1 | 0 |
| DEV | 8'h5A | 1 | 1 | 0 | 1 |
| PROD | 8'h96 | 1 | dbg_unlocked | 0 | not dbg_unlocked |
| RMA | 8'hC3 | 1 | 1 | 1 | 0 |
| Any other | - | 0 | 0 | 0 | 0 |
lc_fault is 1 exactly when the code is invalid. dbg_unlocked comes from debug authentication and matters only in PROD.
Examples
Example 1
PROD, Locked- Input
lc_state=8'h96, dbg_unlocked=0
- Output
lc_fault = 0, key_en = 1, test_en = 0, bus_en = 0, halt_en = 0, tap_en = 1
Debug is closed and the keys are usable. The TAP stays reachable so authentication can happen.
Example 2
PROD, Unlocked- Input
lc_state=8'h96, dbg_unlocked=1
- Output
lc_fault = 0, key_en = 0, test_en = 0, bus_en = 1, halt_en = 1, tap_en = 1
Authentication opened halt and bus access, so the keys are withdrawn.
Example 3
One Bit Away from PROD- Input
lc_state=8'h97, dbg_unlocked=0
- Output
lc_fault = 1, key_en = 0, test_en = 0, bus_en = 0, halt_en = 0, tap_en = 0
8'h97 is not a valid code. Every door closes and lc_fault rises.
Constraints and Contract
- Implement module lc_debug_gate with combinational logic.
- Use only your ports. Force, release, defparam, bind and hierarchical names are refused.
Hints
Hint 1
Decode each valid state with a full 8-bit compare.
Hint 2
Write one signal for "debug is open" and reuse it.
Hint 3
Check what happens to every output when no state matches.
What the grader checks: All 256 codes are tested with dbg_unlocked at 0 and 1.
515 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