Name the guard rail behind each rule of the chip's random program generator. Then read what twenty recorded random programs reached and missed.
Hardware context: Random programs of the chip's lockstep gate on ap_soc v1.5, with real interrupt lines. Naming guard rails and reading recorded coverage.
The lockstep gate of the chip runs random programs from tools/soc/rv32/random-program.mjs with the chip's blocks around them (random-chip.mjs). Seeds 1 to 20 were rerun for this sheet on ap_soc v1.5, the model compare on. 20 of 20 passed: 10,731 records in all, 0 mismatches.
This worksheet uses named constants. The first three entries show how to record your decisions.
Replace each unresolved value of 65535 with your result.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
question | 8 | input of each check |
Full specification
| Code | Guard rail |
|---|---|
| 1 | A register no random instruction may write |
| 2 | Branches and jumps only forward, to a known place |
| 3 | A fixed trap handler that steps over a faulting instruction |
| 4 | An end every program reaches |
| 5 | Not a guard rail |
| Bin | Hits in 20 seeds | Seeds that hit it |
|---|---|---|
| raw1 | 4225 | 20 |
| raw2 | 556 | 20 |
| load_use | 85 | 18 |
| load_store | 30 | 12 |
| store_load | 0 | 0 |
| branch_raw | 1042 | 20 |
| csr_raw | 1 | 1 |
| x0_write | 2 | 2 |
| Entry | Your decision |
|---|---|
| LOOP_COUNTER | x25 and x26 count loops down; no random instruction writes them. |
| FORWARD | A branch goes to the start of a later block. |
| STEP_OVER | An illegal word raises an exception; the handler adds 4 to mepc. |
| RAM_POINTER | x28 always points into SRAM. |
| LAST_WORD | The program ends with TB_STATUS = 0x900D and a jump to itself. |
| RANDOM_VALUE | An immediate is picked from a list of edge values half the time. |
| RAW1_HITS | Hits of raw1 in all 20 seeds. |
| STORE_LOAD_SEEDS | Seeds that hit store_load. |
| CSR_SEEDS | Seeds that hit csr_raw. |
| RAW2_AT | Hits of raw2 for random program SEED. |
Examples
Example 1
LOOP COUNTER- Input
x25 and x26 count loops down; no random instruction writes them.
- Output
matches = 1
A loop counter that random code changes can turn a loop into one that never ends.
Example 2
FORWARD- Input
A branch goes to the start of a later block.
- Output
matches = 1
Backward targets chosen at random can make loops with no exit.
Example 3
STEP OVER- Input
An illegal word raises an exception; the handler adds 4 to mepc.
- Output
matches = 1
The program goes on after any exception, so a bad word costs one trap, not the run.
Constraints and Contract
- Keep the parameter and named constants. Use the numeric codes and units on this page.
- For RAW2_AT, enter a constant expression using SEED. Only this entry changes with the parameter. The supported integer range is 1 through 5, inclusive.
Hints
Hint 1
Ask what would kill the program without the rule.
Hint 2
The table counts each bin over the twenty seeds.
Hint 3
A bin with no seed is a hole: the generator needs a directed sequence for it.
What the grader checks: Each check compares the full eight-bit answer. Parameter trials change one condition and keep the other decisions fixed.
14 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