Core Integration Checks

The core arrives proved, and the model compare checks every instruction. Neither can see how the core is wired into the chip. This page lists the core's boundary pins, the question each one carries, and runs a test that the model compare cannot replace.

You Will Be Able To

  • List the core's boundary pins and the chip-level question of each.
  • Explain why the model compare is silent on a wiring fault at the core's pins.
  • Write a pin check with a limit and a fail code.
  • Plan a check for every boundary question, including each error path and the sleep.
Lesson
V5.6
Time
26 min
Runs on
Your browser
Check
5 questions

The model compare ran every record of a test and found nothing. The test still failed, with its own fail code: an interrupt never came. Both statements are true at once, and the reason is the point of this page.

The Core's Boundary PinsStep through the core's pins; each carries one chip-level question the core's own bench could not ask.
  • Processor
  • Clock / reset
  • Bus
  • Peripheral
  • Power
  • Debug
  • Clock
  • Data
  • Interrupt
  • Power
  • Debug
The Core's Boundary PinsStep through the core's pins; each carries one chip-level question the core's own bench could not ask. processor ap_rv32 proved on its ownbench clock reset reset_vector,hart_id strap and tie-off bus i_ and d_ ports hresp: an ERROR fromany target peripheral Three interruptlines ap_clint and ap_plic power core_sleep, wake wfi debug Debug port halt, step, registers at resetanswerslinessleepsrequests
  1. processor ap_rv32proved on its own bench
    • sleeps → core_sleep, wake
  2. clock reset reset_vector, hart_idstrap and tie-off
    • at reset → ap_rv32
  3. bus i_ and d_ portshresp: an ERROR from any target
    • answers → ap_rv32
  4. peripheral Three interrupt linesap_clint and ap_plic
    • lines → ap_rv32
  5. power core_sleep, wakewfi
  6. debug Debug porthalt, step, registers
    • requests → ap_rv32
  1. reset_vector

    Where does the first instruction come from?

  2. hart_id

    Which hart is this?

  3. d_hresp, i_hresp

    Does every ERROR become a precise trap?

  4. irq_software, irq_timer

    Do MSIP and MTIMECMP reach their lines?

  5. irq_external

    Does ap_plic reach the external line?

  6. core_sleep, core_wake

    Does wfi sleep, and wake on the right line?

Read the diagram as text
  • ap_rv32: proved on its own bench
  • reset_vector, hart_id: strap and tie-off
  • i_ and d_ ports: hresp: an ERROR from any target
  • Three interrupt lines: ap_clint and ap_plic
  • core_sleep, wake: wfi
  • Debug port: halt, step, registers
  • reset_vector, hart_id → ap_rv32: at reset
  • i_ and d_ ports → ap_rv32: answers
  • Three interrupt lines → ap_rv32: lines
  • ap_rv32 → core_sleep, wake: sleeps
  • Debug port → ap_rv32: requests

ap_core_slot of ap_soc v1.5 (tools/soc/ap_soc/rtl/ap_core_slot.sv lists every port). The debug port is module V11's.

Before You Start

Read Interrupts and the Model first. Where You May Look helps too. The Core as an IP lists the ports from the core's side.

Five questions this page answers
Question
1What does the core's own bench prove, and what can it not?
2Which pins does the core share with the chip?
3Why is the model compare silent on a fault at a pin?
4What makes a pin check catch a fault rather than hang?
5Why does every sleep in a pin check need a backstop?

The Idea: A Proved Core in an Unproved Chip

The core's own bench drives every pin of the core and checks it against the ISA. It cannot know what the chip connects to those pins. Take a reset vector tied to the wrong value, or a timer wire crossed with the software line. Take an error answer that never reaches the core. Each is a chip bug in a proved core.

The model compare cannot see them either. It takes what crosses the pins from the record: the device's answer, the error, the lines the core sampled. A wrong wire changes what the core sees, and the model agrees with the core about what it saw.

So the pins are checked by tests that ask for an effect and check it. Raise a line, and wait for the trap of that line. Read a hole, and check the fault and its address. Each pin gets its question, and each question gets a limit.

New Words

New words on this page
WordMeaning
Boundary pinA port of the core that the chip connects to something: a strap, a bus, an interrupt line, a sleep signal.
Integration checkA test of how a block is wired into the chip, not of the block itself.
Precise trapA trap with mepc at the instruction that caused it and nothing after it done.
BackstopA second event armed to end a wait whose first event may never come.
Tie-offA port fixed to a constant at the top level, such as the hart ID.

The Smallest Example: One Pin, One Question

Take the external line. On the good chip, the board pulses IO8 and GPIO raises source 2. Then ap_plic raises the core's external line, and the core traps with cause 0x8000_000B. A test asks for exactly that, and gives up after a limit.

What each outcome means
The test seesIt meansThe test does
cause 0x8000_000B within the limitthe line worksgoes on
another causea line is crossedfails with code 4
nothing within the limitthe line, the source or the map is brokenfails with code 3

The fail codes of the lab program BOUNDARY_S.

The Rules

  1. Rule 1: Give every pin its own question.

    A test of the external line says nothing about the timer line.

  2. Rule 2: Check the effect, with its exact cause.

    Wait for the mcause of the line raised, not for any trap.

  3. Rule 3: Every wait has a limit and a code.

    And every wfi has a backstop on another line.

  4. Rule 4: Check every path of an error.

    A hole of the map, a register block behind each bridge and a block whose power is off answer through different logic.

  5. Rule 5: Do not leave the pins to the model.

    It takes the pins' values from the record, so it cannot check them.

Sources for These Rules

The core's ports in the chip: tools/soc/ap_soc/rtl/ap_core_slot.sv; who drives them: tools/soc/ap_soc/connect.csv. The reset vector from the BOOT strap and STRAPS in ap_sysctl: docs/soc/ap_soc-facts.md 27.3 and 27.11. The error rule of every register block: facts 27.6.

The interrupt lines and causes: blueprint 7.4; mie bits 3, 7 and 11. ap_plic source 2 is GPIO (tools/soc/ap_soc/irq.csv).

What the model takes from the record: facts 27.12. The fault of the lab is a seeded fault of stage E9 (docs/soc/fault-table.md), also shown in lesson V2.4.

Now Run It: Three Pins, Two Chips

The lab checks three pins. The reset vector, by the BOOT strap and auipc; the hart ID; and the external line, through GPIO and ap_plic. It is part of an integration test, not the whole of one.

The reset-vector check of BOUNDARY_S.
    auipc a0, 0                    # where is the core running?
    la   t0, trap
    csrw mtvec, t0
    li   s0, SYSCTL
    li   a7, 1
    lw   t1, 0x0C(s0)              # STRAPS: bit 0 is the BOOT strap as sampled
    andi t1, t1, 1
    beqz t1, fail                  # this bench boots from SRAM: BOOT = 1
    srli t2, a0, 16
    li   t1, 0x8000
    bne  t2, t1, fail              # ... so the core must be running in SRAM, not in the boot ROM
On the good chip (Verilator 5.052 2026-09-05).
good chip: pass, 105 cycles, external interrupts 1, 60 records compared, mismatches 0
first record at 80000000; auipc at 8000000c
The same test on a chip whose ap_plic source 2 samples the SPI request.
plic source two samples the spi interrupt: fail, status_fail, TB_STATUS bad00003, 2573 cycles
external interrupts 0, 1542 records compared, mismatches 0

The test failed with code 3: no external interrupt within its limit. The model compared all 1542 records and found nothing. The core and the model both saw a line that never rose: rule 5. The limit turned the missing line into a report: rule 3.

The pins this lab left unchecked are the work of the practice problem. They are every path of an error, the other two lines, and a bounded sleep.

Why It Is Built This Way

Pin checks are firmware, not bench monitors, because the question is whether the core sees the chip right. Only code running on the core can ask for an effect and see it as the core sees it. It sees a trap, a cause, an mtval.

They are few and short. One check a pin, a few hundred cycles each, run in every regression. They find the faults the model compare cannot, at a cost the run hardly notices. The lab's check of three pins took 105 cycles on the good chip.

A real integration test checks every pin, even where a check seems unable to fail. A core that starts at the wrong address, or never wakes from wfi, runs no test at all. Only the bench's end rules see that run, as a cycle limit. Write the checks anyway. A smaller fault on the same pin lets the program run, and then only your check sees it.

The Trap: The Wait That Hid the Wire

A first integration test waits for each interrupt in a loop with no exit. On a chip with a broken line it runs to the cycle limit. The report says "cycle limit", the regression marks it a timeout, and someone raises the limit.

The cure is a limit and a code on every wait, and a backstop on every sleep. The practice problems build the whole test against hidden faulty chips. They also read a recorded run in which two external sources asked at once, and the test failed.

At Scale

ap_soc~12 blocks
Phone-class SoChundreds of blocks

This section looks ahead. ap_soc has one core, three lines and two bus ports.

  1. Many harts

    Each hart has its own ID, lines and reset; the checks repeat per hart, generated from the integration table.

  2. Generated checks

    Large chips generate these tests from the connection list, the same data the formal connectivity proofs of module V8 use.

  3. Cores from outside

    A licensed core arrives with its own proofs; the integrator owns only the wiring, and these checks.

Try It

Run the slice: it lists the core's pins and whether the lab's test checks each one.

Which pins does the lab leave unchecked?

The predict question marks the interrupt lines as checked.

RUNIcarus Verilog · in your browser
Edit the code, then run it
Expected: reset_vector started in SRAM, as the BOOT strap says hart_id mhartid is 0 d_hresp NOT CHECKED irq_software NOT CHECKED irq_timer NOT CHECKED irq_external ap_plic raises cause 11, within a limit core_sleep and wake NOT CHECKED debug port NOT CHECKED 3 of 8 pins checked

Check Yourself

Predict the outputThe slice now marks the three interrupt lines as checked. What is the last line it prints?
// The core's boundary on ap_soc v1.5: for each pin, what one recorded run checked, and whether that run
// can tell a good chip from a bad one at this pin.
module tb;
  localparam int N = 8;
  string pin [N], check [N];
  bit tested [N];
  int covered = 0;
  initial begin
    pin[0] = "reset_vector"; check[0] = "started in SRAM, as the BOOT strap says"; tested[0] = 1;
    pin[1] = "hart_id"; check[1] = "mhartid is 0"; tested[1] = 1;
    pin[2] = "d_hresp"; check[2] = "an ERROR on each path becomes a load fault"; tested[2] = 0;
    pin[3] = "irq_software"; check[3] = "MSIP raises cause 3"; tested[3] = 1;
    pin[4] = "irq_timer"; check[4] = "MTIMECMP raises cause 7"; tested[4] = 1;
    pin[5] = "irq_external"; check[5] = "ap_plic raises cause 11, within a limit"; tested[5] = 1;
    pin[6] = "core_sleep and wake"; check[6] = "wfi sleeps and the right line wakes it"; tested[6] = 0;
    pin[7] = "debug port"; check[7] = "a halt request stops the core"; tested[7] = 0;
    for (int i = 0; i < N; i++) begin
      if (tested[i]) $display("%-22s %s", pin[i], check[i]);
      else $display("%-22s NOT CHECKED", pin[i]);
      covered += tested[i];
    end
    $display("%0d of %0d pins checked", covered, N);
  end
endmodule
ConceptWhat can the core's own bench not prove?
ConceptWhy is the model compare silent on a crossed interrupt wire?
ConceptWhat makes a pin check catch a fault rather than hang?
ConceptWhy does every sleep in a pin check need a backstop?

Common Mistakes

Wrong Trust the model compare with the core's pins.

The model takes the pins' values from the record, so a wrong wire looks right to it.

Fix Test each pin with an effect and its exact cause.

Wrong Wait for an interrupt with no limit.

A missing line becomes a cycle limit that names nothing.

Fix Give every wait a limit and a fail code; give wfi a backstop.

Wrong Test bus errors on one path.

Each bridge and the default target answer through their own logic.

Fix Read a hole and a register on each bus segment.

Remember

  • A proved core can still be wired wrong; each pin it shares with the chip has a chip-level question.
  • The model compare takes the pins' values from the record, so it cannot check them.
  • Check every pin with its exact effect, every wait with a limit, every sleep with a backstop.
  • Errors travel several paths into the core; test each one.

Practice

Report a problem with this page