An SoC as a Verifier Sees It

An SoC is a processor, memories and devices sharing one bus, one map, one set of clocks and one set of pads. Learn the six questions a verifier asks of every chip, and read the answers for ap_soc from its own data.

You Will Be Able To

  • Name the parts of an SoC and say what each one does, in one sentence.
  • Ask the six questions of a chip: bus managers, the map, interrupts, clocks and resets, power, pads.
  • Follow one address through the map to its block, bus, clock, power domain and interrupt.
  • Read one register of the chip and say what its value means.
Lesson
VF.1
Time
22 min
Runs on
Your browser
Check
5 questions

You join a chip team on Monday and receive a block diagram full of boxes. Everyone else already knows which box answers which address, and which wire goes where. Before you can test anything, you need to see the chip the way they do.

ap_soc and the Six QuestionsStep through the six questions a verifier asks of every chip. Each step lights the blocks that answer it on ap_soc v1.5.
  • Processor
  • Bus
  • Memory
  • Peripheral
  • Control / FSM
  • Clock / reset
  • Power
  • Pads
  • Data
  • Interrupt
  • Clock
  • Power
ap_soc and the Six QuestionsStep through the six questions a verifier asks of every chip. Each step lights the blocks that answer it on ap_soc v1.5. processor Bus managers the core, the debugmodule, the DMA bus Fabric AHB matrix, bridges,APB memory Boot ROM andSRAM code and data peripheral Peripherals UART0, GPIO, timer,SPI, watchdog control Interruptcontroller ap_plic: 16 inputs clock reset Clocks and resets ap_crg: clk_sys,clk_aon power Power controller ap_pwrctl: PD_PERon or off pads Pads and pin mux 16 IO pads; PINMUXpicks their use transfersdecodedecoderequestsinterruptclocks, resetsswitch PD_PERpin mux
  1. processor Bus managersthe core, the debug module, the DMA
    • transfers → Fabric
  2. bus FabricAHB matrix, bridges, APB
    • decode → Boot ROM and SRAM
    • decode → Peripherals
  3. memory Boot ROM and SRAMcode and data
  4. peripheral PeripheralsUART0, GPIO, timer, SPI, watchdog
    • requests → Interrupt controller
    • pin mux → Pads and pin mux
  5. control Interrupt controllerap_plic: 16 inputs
    • interrupt → Bus managers
  6. clock reset Clocks and resetsap_crg: clk_sys, clk_aon
    • clocks, resets → Peripherals
  7. power Power controllerap_pwrctl: PD_PER on or off
    • switch PD_PER → Peripherals
  8. pads Pads and pin mux16 IO pads; PINMUX picks their use
  1. 1. Who drives the bus?

    Four managers can start a transfer: ap_rv32 instruction port, ap_rv32 data port, DMA, JTAG debug.

  2. 2. What is at which address?

    The memory map gives 12 windows to memories and devices. Every other address is a hole.

  3. 3. Who interrupts whom?

    7 of the 16 inputs of ap_plic come from devices. ap_plic tells the core.

  4. 4. Who clocks and resets what?

    ap_crg makes two clocks and every reset, and releases them in order.

  5. 5. What is powered?

    Three power domains: PD_AON, PD_MAIN, PD_PER. PD_PER can be switched off while the rest runs.

  6. 6. What reaches a pad?

    16 IO pads. On 6 of them, the PINMUX register picks one of several functions.

Read the diagram as text
  • Bus managers: the core, the debug module, the DMA
  • Fabric: AHB matrix, bridges, APB
  • Boot ROM and SRAM: code and data
  • Peripherals: UART0, GPIO, timer, SPI, watchdog
  • Interrupt controller: ap_plic: 16 inputs
  • Clocks and resets: ap_crg: clk_sys, clk_aon
  • Power controller: ap_pwrctl: PD_PER on or off
  • Pads and pin mux: 16 IO pads; PINMUX picks their use
  • Bus managers → Fabric: transfers
  • Fabric → Boot ROM and SRAM: decode
  • Fabric → Peripherals: decode
  • Peripherals → Interrupt controller: requests
  • Interrupt controller → Bus managers: interrupt
  • Clocks and resets → Peripherals: clocks, resets
  • Power controller → Peripherals: switch PD_PER
  • Peripherals → Pads and pin mux: pin mux

The block diagram of ap_soc v1.5, drawn from its data files. Each question is a join between blocks, and each join can be wrong.

Before You Start

This page assumes only digital logic (gates, flip-flops, a clock) and a little programming. If binary and hex numbers are new, read Positional Numbers and Base Conversion first. A computer in one picture helps: What a Computer Is Made Of.

The companion track The Levels: Block, Subsystem, Chip, System explains the levels of verification in general. This module applies them to a whole chip. This site runs ap_soc v1.5 in simulation: Verilator for graded runs, Icarus for small slices. It has no emulator and no FPGA board.

Five questions this page answers
Question
1What is an SoC, and what are its parts?
2What six questions does a verifier ask of every chip?
3Where do the answers live, so a test can use them?
4How do you follow one address to the block that answers it?
5What does the value of one register tell you?

The Idea: Many Blocks, Shared Wires

An SoC, a system on a chip, puts a whole computer on one piece of silicon. A processor runs the software. Memories hold code and data. Devices talk to the world: a serial port, pins, timers. A bus joins them, and clocks, resets, power and pads feed them all.

Each block was usually designed and tested by its own team, often at another company. By the time the chip is put together, each block has passed its own tests. What is new is the sharing: two blocks can disagree about an address, a wire, a clock or a pin. A verifier of a chip looks at the chip as a set of shared things.

That is why this lesson starts with questions, not with blocks. Six questions cover everything the blocks share. Ask them of any chip and you know where its chip-level bugs can hide.

New Words

New words on this page
WordMeaning
SoCSystem on a chip: processor, memories, devices, bus, clocks and pads on one piece of silicon.
CoreThe processor of the chip. It fetches instructions from memory and runs the software.
RTLThe design written as code that describes registers and the logic between them. The chip is built from it.
BlockOne designed part of the chip, such as UART0. Often called an IP block when it is bought or reused.
Boot ROM, SRAMTwo memories. The boot ROM holds the first program the core runs; SRAM holds data and more code.
DMA engineA block that copies data between memory and devices, so the core does not have to.
TransferOne read or one write on the bus: an address goes out, and data moves one way.
Bus managerA block that can start a transfer on the bus, such as the core or the DMA engine.
AHB, APBTwo bus standards from Arm. AHB is the fast main bus. APB is a simpler bus for device registers.
BridgeA block that passes a transfer from one bus to another, such as from AHB to APB.
FabricAll the buses, bridges and switches that carry transfers from managers to the blocks that answer them.
Memory mapThe table of which block answers which address. An address in no row is a hole.
DecoderThe logic that reads an address and selects the block that owns it.
Bus errorThe answer to a transfer that no block can complete. The manager gets a failed access instead of data.
RegisterA word inside a block that software reads or writes at a fixed address.
InterruptA wire a block raises to ask the core for attention.
Clock domainThe flip-flops that run on one clock. ap_soc has two main clocks: clk_sys and clk_aon.
Power domainLogic that is switched on and off together, from one supply.
PadA connection from the chip to the board.
Pin muxA register-controlled switch that picks which function uses a pad.
SpecificationThe documents and data files that say what the chip must do. Every test is written from it.
BenchShort for testbench: code around a design in simulation that drives its inputs and checks its outputs.
VerifierThe engineer who proves the design does what its specification says, before it is built.

The Six Questions on ap_soc

Here are the six questions with the answers for our chip. This page counted every number in the table from the chip's own data files, so the table cannot drift from the chip.

Six questions, answered from the data of ap_soc v1.5
QuestionAnswer on ap_socWhere the answer lives
1. Who drives the bus?4 managers: ap_rv32 instruction port, ap_rv32 data port, DMA, JTAG debugmap.json, topology
2. What is at which address?12 windows: boot ROM, SRAM and 10 device windows; reserved rows and holes answer with an errormap.json, regions
3. Who interrupts whom?7 of 16 ap_plic inputs come from devices (1, 2, 3, 4, 5, 6, 9); the rest are tied to 0irq.csv
4. Who clocks and resets what?clk_sys at 100 MHz for most blocks; clk_aon for the watchdog and ap_pwrctl; resets released by ap_crgblocks.csv; the facts of the chip
5. What is powered?PD_AON, PD_MAIN, PD_PER; the timer and SPI sit in PD_PER, which software can switch offblocks.csv; ap_soc.upf
6. What reaches a pad?16 IO pads; on 6 of them PINMUX picks GPIO, a serial line or a timer pin. Plus 7 dedicated pads such as the clock and resetpins.csv

Counted from tools/soc/ap_soc/map.json, blocks.csv, irq.csv and pins.csv by this page's source.

Notice that each answer names at least two blocks. A manager and a target. A device and the interrupt controller. A clock source and the blocks that use it. That is what makes them chip-level questions: no single block team can answer them alone.

The Smallest Example: One Address, One Register

Follow the address 0x1000_0000 through the six questions by hand. The map says it is UART0. UART0 sits on the fast APB, so its clock is clk_sys. It is in PD_MAIN, so it is always powered. Its interrupt is ap_plic input 1. With PINMUX set to 2, its transmit line reaches pad IO0.

Two addresses followed by hand
AddressOwnerBusClockPowerInterrupt
0x1000_0000UART0fast APBclk_sysPD_MAIN1
0x1000_3000Watchdogslow APBclk_aonPD_AON6

The watchdog lives on the slow APB because it runs on the always-on clock, so its accesses cross between two clocks.

Now read one register. CLK_GATE sits at offset 0x14 of ap_sysctl, base 0x1000_4000. Bit n lets one block's clock run: bit 0 UART0, 1 GPIO, 2 timer, 3 SPI, 4 DMA. After reset it reads 0x1F, so all five clocks run. A test that writes 0x05 leaves only UART0 and the timer running. The chip's identity is another register: CHIP_ID at offset 0x00 reads 0x2A53_10C5.

The Rules

  1. Rule 1: Ask the six questions of every chip.

    Bus managers, the map, interrupts, clocks and resets, power, pads. Together they cover what blocks share.

  2. Rule 2: Read the answers from data, not memory.

    The map, the register files and the connection tables are the specification a test is written from.

  3. Rule 3: Every answer is a join.

    Each one names two blocks, so each one is a place where two teams can disagree.

  4. Rule 4: A hole is an answer too.

    An address no block owns must answer with an error, and a test must check that it does.

Sources for These Rules

Mehta, ASIC/SoC Functional Design Verification, sections 16.1 to 16.4: an SoC seen as the subsystems a plan must cover.

The numbers of ap_soc: tools/soc/ap_soc/map.json, blocks.csv, irq.csv, pins.csv and regs/sysctl.json; docs/soc/ap_soc-facts.md section 27.

The six questions as a checklist are this track's way of grouping the chip-level checks of docs/soc-verification-plan.md section 2.1.

Now Run It: A Map Walk

The lab at the end of this page is a small model built from the chip's data files. A task named who holds one row for each window of the map. It prints the owner, bus, clock, power domain and interrupt of an address. Then the lab prints CLK_GATE at its reset value.

Printed by the lab (Icarus 12). The rows are generated from map.json, blocks.csv and irq.csv.
00000100  Boot ROM      AHB      clk_sys PD_MAIN irq 0
10000000  UART0         fast APB clk_sys PD_MAIN irq 1
10003000  Watchdog      slow APB clk_aon PD_AON  irq 6
10007000  nobody: a hole, so the bus answers ERROR
80000400  SRAM          AHB      clk_sys PD_MAIN irq 0
CLK_GATE = 1f: UART0 on, GPIO on, Timer on, SPI on, DMA on

Read the rows with rule 1. Address 0x0000_0100 is in the boot ROM on the AHB bus, with no interrupt. UART0 answers on the fast APB with interrupt 1. The watchdog is on the slow APB and clk_aon, in the always-on domain, with interrupt 6.

The fourth row is rule 4 at work: nobody owns 0x1000_7000, so the bus must answer with an error. The last row is in SRAM. The CLK_GATE line shows all five clocks on, as after reset.

Why It Is Built This Way

Why share so much? Because sharing is what makes a chip cheap and small. One bus serves four managers. One interrupt controller serves every device. One pad can carry a serial line on one board and a plain pin on another.

The price is paid in verification. A shared thing has more than one user, so it has more ways to be wrong. That is why the chip level checks the shared things and trusts each block's own bench for the rest. The next lesson shows where that line falls.

Traps

The first trap is to trust the drawing. A block diagram shows that UART0 has an interrupt. It does not say which input of the controller it reaches. Only the data, here irq.csv and the generated wiring, says that. Write tests from the data and treat the drawing as a picture.

The second trap is the missing row. A new engineer tests every window of the map and forgets the holes between them. A decoder that answers a hole with an old register, or with silence, is a real chip bug. Rule 4 exists because that test is so easy to skip.

The third trap is the clock nobody turned on. A block whose bit of CLK_GATE is 0 answers every access with an error. A test that forgets the gate looks like a broken block, when the block was simply asleep.

At Scale

ap_soc~12 blocks
Phone-class SoChundreds of blocks

This section looks ahead. ap_soc has 12 windows and 4 managers. A phone chip has hundreds of blocks.

  1. The questions stay six

    A large chip has many more managers, maps and domains. The same six questions still cover what its blocks share.

  2. The data gets bigger

    The map and the connection tables run to thousands of rows. Teams generate the RTL, the headers and the tests from them, so nothing is typed twice.

Where This Goes Next

The next lesson places these joins on the levels of a chip project. Each question of this page also has a lesson of its own.

Where to go from here
LessonWhat it adds
From IP to Chip to SystemThe levels of verification, and which level finds which bug.
The Specification Is DataThe chip's data files read as the thing under test.
The Memory MapHow a memory map is designed (SoC Architecture).
The Interrupt PathThe interrupt path from a device to the core (SoC Architecture).
Clock Sources and the Chip-Level Clock TreeClock sources and the clock tree (SoC Architecture).
Pads and Pin MultiplexingPads and pin multiplexing (SoC Architecture).

Try It

Run the lab and read each row against the table of the six questions.

Add an address of your own, for example 0x1000_8004, and predict its row before you run it.

Change the CLK_GATE value and predict which clocks the last line reports.

RUNIcarus Verilog · in your browser
Edit the code, then run it
Expected: 00000100 Boot ROM AHB clk_sys PD_MAIN irq 0 10000000 UART0 fast APB clk_sys PD_MAIN irq 1 10003000 Watchdog slow APB clk_aon PD_AON irq 6 10007000 nobody: a hole, so the bus answers ERROR 80000400 SRAM AHB clk_sys PD_MAIN irq 0 CLK_GATE = 1f: UART0 on, GPIO on, Timer on, SPI on, DMA on

Check Yourself

Predict the outputThe lab walks 0x1000_2000, 0x1000_6000 and 0x1000_8004, then a test writes 0x05 to CLK_GATE. What is the last line the lab prints?
// chip_map: who answers an address in ap_soc v1.5. The rows are generated from the chip's data files:
// tools/soc/ap_soc/map.json (owner, base, size), blocks.csv (clock, power domain), irq.csv (interrupt source).
module tb;
  // One row a region: who answers, on which bus, on which clock, in which power domain, and its interrupt source.
  task automatic who(input logic [31:0] a);
    if (a >= 32'h00000000 && a < 32'h00001000) $display("%h  %-13s %-8s %-7s %-7s irq %0d", a, "Boot ROM", "AHB", "clk_sys", "PD_MAIN", 0);
    else if (a >= 32'h02000000 && a < 32'h02010000) $display("%h  %-13s %-8s %-7s %-7s irq %0d", a, "ap_clint", "AHB", "clk_sys", "PD_MAIN", 0);
    else if (a >= 32'h0c000000 && a < 32'h0c400000) $display("%h  %-13s %-8s %-7s %-7s irq %0d", a, "ap_plic", "AHB", "clk_sys", "PD_MAIN", 0);
    else if (a >= 32'h10000000 && a < 32'h10001000) $display("%h  %-13s %-8s %-7s %-7s irq %0d", a, "UART0", "fast APB", "clk_sys", "PD_MAIN", 1);
    else if (a >= 32'h10001000 && a < 32'h10002000) $display("%h  %-13s %-8s %-7s %-7s irq %0d", a, "GPIO", "fast APB", "clk_sys", "PD_MAIN", 2);
    else if (a >= 32'h10002000 && a < 32'h10003000) $display("%h  %-13s %-8s %-7s %-7s irq %0d", a, "Timer and PWM", "fast APB", "clk_sys", "PD_PER", 3);
    else if (a >= 32'h10003000 && a < 32'h10004000) $display("%h  %-13s %-8s %-7s %-7s irq %0d", a, "Watchdog", "slow APB", "clk_aon", "PD_AON", 6);
    else if (a >= 32'h10004000 && a < 32'h10005000) $display("%h  %-13s %-8s %-7s %-7s irq %0d", a, "ap_sysctl", "fast APB", "clk_sys", "PD_MAIN", 0);
    else if (a >= 32'h10005000 && a < 32'h10006000) $display("%h  %-13s %-8s %-7s %-7s irq %0d", a, "SPI", "fast APB", "clk_sys", "PD_PER", 4);
    else if (a >= 32'h10006000 && a < 32'h10007000) $display("%h  %-13s %-8s %-7s %-7s irq %0d", a, "DMA", "fast APB", "clk_sys", "PD_MAIN", 5);
    else if (a >= 32'h10008000 && a < 32'h10009000) $display("%h  %-13s %-8s %-7s %-7s irq %0d", a, "ap_pwrctl", "slow APB", "clk_aon", "PD_AON", 9);
    else if (a >= 32'h80000000 && a < 32'h80010000) $display("%h  %-13s %-8s %-7s %-7s irq %0d", a, "SRAM", "AHB", "clk_sys", "PD_MAIN", 0);
    else $display("%h  nobody: a hole, so the bus answers ERROR", a);
  endtask
  // One register of ap_sysctl at offset 0x14: CLK_GATE. Bit n lets one block's clock run (regs/sysctl.json).
  logic [4:0] clk_gate = 5'h1f;   // reset value
  initial begin
    who(32'h10002000);
    who(32'h10006000);
    who(32'h10008004);
    clk_gate = 5'h5;                      // a test writes CLK_GATE
    $display("CLK_GATE = %h: UART0 %0s, GPIO %0s, Timer %0s, SPI %0s, DMA %0s", clk_gate,
      clk_gate[0] ? "on" : "off", clk_gate[1] ? "on" : "off", clk_gate[2] ? "on" : "off", clk_gate[3] ? "on" : "off", clk_gate[4] ? "on" : "off");
  end
endmodule
ConceptWhat makes "which interrupt input does UART0 reach?" a chip-level question?
ConceptWhere does a chip test find which block answers an address?
ConceptA read of 0x1000_7000 returns a value with no error. What is wrong?
ConceptWhich of the six questions does PINMUX answer?

Common Mistakes

Wrong Write a test from the block diagram.

A drawing shows that a wire exists, not where it goes.

Fix Read the map, the register files and the connection tables.

Wrong Test every window of the map and skip the holes.

A hole that answers is a decoder bug no window test can find.

Fix Check that each hole answers with an error.

Wrong Report a block as broken when every access errors.

Its clock may be gated off.

Fix Read CLK_GATE first.

Remember

  • An SoC is many blocks that share a bus, a map, interrupts, clocks, power and pads.
  • Six questions cover what they share: managers, map, interrupts, clocks and resets, power, pads.
  • The answers live in data files, and tests are written from them.
  • Every answer is a join between blocks, so every answer is a place to test.

Practice

Report a problem with this page