S9.1.1 Wake the Second Hart

MediumImplement25 minIcarus Verilog · serverReview the topic

Build the registers that hold hart 1 in reset until hart 0 gives it an entry address and lets it run.

Hardware context: ap_soc dual-hart option. Multicore boot and inter-processor interrupts

In the dual-hart option of ap_soc, hart 1 can be held in reset after power-up. Hart 0 runs the start-up code, writes the address where hart 1 must begin, then releases it.

Implement the two registers that do this. A wrong lock or a wrong bit lets hart 1 start at a stale address, or start before its data is ready.

Signals in the Timeline

SignalWidthRole
sample11input of each check
Full specification
Byte offsetRegisterBehaviour
0x0ENTRY1Entry address for hart 1. Bits 31 to 2 are stored; bits 1 and 0 read as zero. Writes are ignored once hart 1 runs.
0x4RUNBit 0 reads 1: hart 0 always runs. Bit 1 is hart1_run. Writing 1 to bit 1 sets it; writing 0 has no effect. Other bits read 0.
0x8, 0xcUnusedRead as zero. Writes are ignored.

A register write happens at a rising edge where sel and write are both 1. rdata shows the selected word while sel is 1 and write is 0, and is zero otherwise.

hart1_entry always shows the stored ENTRY1 value. hart1_run starts at 0. A synchronous active-low reset clears both registers and takes priority over a write.

The register layout, the lock and the reset value are ap_soc design choices for this exercise.

Examples

Example 1

Reset
Input
reset_n=0, sel=0, write=0, offset=0x0, wdata=32'h00000000
Output
rdata = 0x0, hart1_run = 0, hart1_entry = 0x0

Both registers clear. Hart 1 is held and its entry is the boot ROM base.

Example 2

Publish the Entry
Input
reset_n=1, sel=1, write=1, offset=0x0, wdata=32'h80000100
Output
rdata = 0x0, hart1_run = 0, hart1_entry = 0x80000100

Hart 0 writes 0x80000100 to ENTRY1. Hart 1 is still held.

Example 3

Release Hart 1
Input
reset_n=1, sel=1, write=1, offset=0x4, wdata=32'h00000002
Output
rdata = 0x0, hart1_run = 1, hart1_entry = 0x80000100

Writing 2 to RUN sets bit 1. hart1_run rises at this edge.

Constraints and Contract

  • Keep module hart_release and its ports. Accesses are aligned words, so offset bits 1 and 0 are zero.
  • Reach the bench only through your ports. force, release, defparam, bind, $root and bench names are refused before the run.

Hints

Hint 1

List what each register does after hart 1 runs.

Hint 2

Bit 1 of RUN belongs to hart 1. What does writing 0 there do?

Hint 3

Check that offset 0x8 cannot reach ENTRY1.

What the grader checks: Every word is read and written with sel high and low, before and after release. Each entry bit is written alone. Reset is applied mid-sequence. A final group uses an entry address that differs per submission.

285 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

Report a problem with this page

Your code SystemVerilogSaved locally
Ln 1, Col 1Tab indents · Ctrl/⌘ + Enter runs samples
Not run yet

Reset

Input
reset_n=0, sel=0, write=0, offset=0x0, wdata=32'h00000000
Expected output
rdata = 0x0, hart1_run = 0, hart1_entry = 0x0

Both registers clear. Hart 1 is held and its entry is the boot ROM base.

Run samples executes all 3 public checks. Check all tests runs 285 checks on the server.

Icarus Verilog · server