S9.1.2 Shared or Private

EasyImplement12 minIcarus Verilog · serverReview the topic

Sort the parts of the dual-hart ap_soc into those each hart owns and those both harts share.

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

The dual-hart option of ap_soc adds a second hart to the same chip. Some state is copied once per hart; some exists once and both harts reach it over the bus.

This worksheet uses named constants. The first three entries show how to record your decisions.

Signals in the Timeline

SignalWidthRole
question8input of each check
Full specification
CodeMeaning
1One copy per hart. Each hart has its own.
2One copy for the chip. Both harts use the same one.

ap_clint keeps one time counter for the chip, and one timer compare register and one msip bit per hart. These are ap_soc design choices, as is the msip word for hart h at byte offset 4 × h.

EntryYour decision
REGISTERSThe integer registers and the program counter
SRAM_DATAThe 64 KiB SRAM
CONSOLEUART0
MSIPThe software-interrupt request bit in ap_clint
TIMEThe time counter in ap_clint
COMPAREThe timer compare register in ap_clint
HART_IDThe hart id a hart reads at reset
SLEEPWhether a hart is asleep in wfi
DMA_REGSThe channel registers of the DMA controller
RESERVATIONThe reservation that a load-reserved records
LOCK_WORDThe lock word of a spin lock
MSIP_OFFSETByte offset inside ap_clint of the msip word for hart HART.

Examples

Example 1

REGISTERS
Input
The integer registers and the program counter
Output
matches = 1

Each hart runs its own instruction stream, so each needs its own registers and program counter.

Example 2

SRAM DATA
Input
The 64 KiB SRAM
Output
matches = 1

Both harts reach the same SRAM over the AHB fabric. That is what makes it shared memory.

Example 3

CONSOLE
Input
UART0
Output
matches = 1

There is one UART0 on the chip. Both harts write the same transmit register.

Constraints and Contract

  • Keep the parameter and named constants. Use the numeric codes and units on this page.
  • For MSIP_OFFSET, enter a constant expression using HART. Only this entry changes with the parameter. The supported integer range is 0 through 1, inclusive.

Hints

Hint 1

If each hart changes it on its own, it needs one copy per hart.

Hint 2

If one hart writes and another must read it, it is shared.

Hint 3

Its counter is shared; its compare and msip registers are per hart.

What the grader checks: Each check compares the full eight-bit answer. Parameter trials change one condition and keep the other decisions fixed.

12 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

REGISTERS

Input
The integer registers and the program counter
Expected output
matches = 1

Each hart runs its own instruction stream, so each needs its own registers and program counter.

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

Icarus Verilog · server