Tie-Offs, Parameters and Straps
Some inputs are driven by no block: straps the board sets, constants tied in the top level, parameters fixed at an instance. They are set once and easy to forget. Check each one the way it can go wrong.
You Will Be Able To
- Tell a strap, a tie-off and a parameter apart, and say who sets each.
- Check a strap at both of its board values, and a tie-off by proof.
- Find a parameter whose block default differs from its instance value, and say why that matters.
- Explain why checks carried from block level need their expected values from the chip.
- Lesson
- V8.5
- Time
- 24 min
- Runs on
- Your browser
- Check
- 5 questions
Bring-up day: a program built for SRAM never prints a word, and the core seems to run code nobody wrote. Every block passed its own bench.
The culprit is an input that no block drives, so nobody thought to check it.
- Test
- Control / FSM
- Peripheral
- Control
- Data
- A strap
The board sets a pin; the chip samples it once and holds what it saw. Its value depends on the board, so it has two legal values.
- A tie-off
A block input that the chip never drives is tied to a constant in connect.csv. It has one legal value on this chip.
- A parameter
A block's size or count is fixed where it is instantiated, and can differ from the block's own default.
Read the diagram as text
- Board: holds BOOT high or low
- ap_crg: samples BOOT once, after the PLL locks
- STRAPS, reset vector: what the chip remembers
- connect.csv constants: 32'h0 -> u_core.hart_id, ...
- Block inputs: hart ID, watchdog mode, ...
- Instance parameters: WORDS, N
- Block sizes and shapes: set at elaboration
- Board → ap_crg: strap
- ap_crg → STRAPS, reset vector: held
- connect.csv constants → Block inputs: tie-off
- Instance parameters → Block sizes and shapes: elaboration
connect.csv, blocks.csv and ap_crg.sv of ap_soc v1.5 (facts §27.11).
Before You Start
Read Clocks, Resets and Straps From the Outside and Connectivity Proofs From connect.csv first.
| Question | |
|---|---|
| 1 | Who sets a strap, a tie-off and a parameter? |
| 2 | Why does a strap need a test at each of its values? |
| 3 | How do you check a tie-off without a test? |
| 4 | Why can a block's default parameter mislead a chip-level test? |
| 5 | Where must a check carried from block level take its expected values? |
The Idea: Values Set Once, Then Forgotten
Most chip inputs move: a block drives them, a test changes them, a checker watches them. Three kinds do not. A strap is a pin the board holds, sampled once at power-up; BOOT on ap_soc chooses ROM or SRAM. A tie-off is a block input tied to a constant in the top level; the core's hart ID is tied to 0. A parameter fixes a block's size or count where it is instantiated.
Each is set once, so a wrong value never flickers. It is simply wrong, every run, in every test, and every test is written around it. A wrong strap shows as the chip booting from the wrong place. A wrong tie-off shows as a feature that is always on, or never. A wrong parameter shows as a memory that is too small, or a guard that blocks the wrong blocks.
They also differ between levels. A block bench drives a tie-off both ways. The chip ties it one way. A check carried up must learn the chip's value.
New Words
| Word | Meaning |
|---|---|
| Strap | A pad the board holds at a level. The chip samples it once and keeps it (BOOT, read back in STRAPS). |
| Tie-off | A block input given a constant in connect.csv, because nothing on this chip drives it. |
| Instance parameter | The value a parameter takes where the block is instantiated, which may differ from the block's own default. |
| Default parameter | The value written in the block's own source, used only if the instance gives none. |
| Elaboration | The step in which a tool fixes every parameter and builds the design's structure, before any simulation or proof. |
| Sampled once | Read at one moment and held: ap_crg samples BOOT after the PLL locks, before the bus leaves reset. |
The Smallest Example: Two Values of One Parameter
The clock guard of ap_soc is written for N blocks, with N = 5 by default. The chip uses one guard per block, each with N = 1. So two answers exist for "how many enable bits does a guard have?": the source file says five, the chip says one.
| Where you look | N | Enable bits |
|---|---|---|
| ap_apb_guard.sv, the default | 5 | 5 |
| u_guard_uart in the top level | 1 | 1 |
| A test written from the source file | assumes 5 | wrong for this chip |
From rtl/ap_apb_guard.sv and blocks.csv; the runnable example below elaborates both.
The test that read the source file is wrong, and nothing in the block is broken. The truth is at the instance. That is why the site has a wiring part that proves each instance's parameter values.
The Rules
Rule 1: A strap has two legal values; test both.
Run with the board pin low and high, and read back what the chip sampled.
Rule 2: A tie-off has one value on the chip; prove it.
One connectivity row with the constant as its driver checks it with no stimulus.
Rule 3: The instance decides a parameter.
Prove or print the value at the instance; never take it from the block's default.
Rule 4: Carried checks take chip values.
A check reused from a block bench must take expected values from the chip's tables, not the block's.
Rule 5: A strap is sampled once.
Changing the pin after the sample does nothing until the next power-up; a test must set it before.
Sources for These Rules
The strap: ap_crg samples BOOT once after the PLL locks. STRAPS bit 0 and the reset vector follow it (facts §27.3, §27.11; rtl/ap_crg.sv).
Tie-offs: the rows of connect.csv with clock const; parameters: blocks.csv and the site's parameters part (tools/soc-conn-parts.mjs). The guard default: rtl/ap_apb_guard.sv.
The bench's BOOT pin (+boot=1) and the SRAM layout of the site's problems: bench manual, "Plusargs".
The Lab: A Strap, a Parameter, a Tie-Off
First the strap, rule 1. The seat reads STRAPS twice: once on a board that holds BOOT low, once with BOOT high. Each table expects the level the board holds.
core r 1000400c 00000000 00000001 00000000 0 1
core r 10004004 00000000 00000010 00000000 0 1
board BOOT low: verdict=pass
core r 1000400c 00000000 00000001 00000001 0 1
core r 10004004 00000000 00000010 00000000 0 1
board BOOT high: verdict=passBoth pass. Now run the rows that expect BOOT high on a board that holds it low. It is the commonest strap bug: the bench and the test disagree about the board.
BENCH 12: seat: read 1000400c = 00000000, expected 00000001 (mask 00000001)Rule 3 next. The site's parameters part has a row for each instance value, with the constant as its driver. They are ROM WORDS 1024, SRAM WORDS 16384, and N = 1 for each guard. On the good chip all are proved. On an altered chip, the ROM gets one word more. The proof fails, and its first step shows u_rom.WORDS = 1025.
1024,u_rom.WORDS,32,const,PD_MAIN,,
16384,u_sram.WORDS,32,const,PD_MAIN,,
1,u_guard_uart.N,32,const,PD_MAIN,,
1,u_guard_gpio.N,32,const,PD_MAIN,,
1,u_guard_timer.N,32,const,PD_MAIN,,
1,u_guard_spi.N,32,const,PD_MAIN,,
1,u_guard_dma.N,32,const,PD_MAIN,,Rule 2 last. The ties-straps part has 12 rows; a few of them are below. All hold on the good wiring. Write the watchdog's development mode as 1 instead of 0, and the proof answers with a counterexample in which u_watchdog.dev_mode = 0.
1'b0,u_fabric.s_hresp[3:3],1,const,PD_MAIN,,
u_pads.boot,u_crg.boot_pad,1,pad,PD_MAIN,static,
u_crg.strap_boot,u_sysctl.strap_boot,1,clk_aon,PD_AON,static,
32'h0,u_core.hart_id,32,const,PD_MAIN,,
1'b0,u_watchdog.dev_mode,1,const,PD_MAIN,,
1'b0,u_crg.debug_reset_req,1,const,PD_MAIN,,The graded diagnosis runs on the processor: a check carried from block level, failing on the good chip.
Why It Is Built This Way
Why sample a strap once instead of reading the pin whenever it is needed? Because the pin may be shared with another use after boot, or float when the board changes state. Sampling once, after the clocks are stable, gives one clean value for the whole session. The price is that a test must set the pin before power-up.
Why write tie-offs into connect.csv instead of leaving the inputs open? An open input floats, and simulators and synthesis treat it differently. A written constant has one value in every tool, and the generator stops on an input bit with no driver. It also gives the proof a row to check.
Traps
The first trap is the board and the test disagreeing. The test is built for SRAM; the bench holds BOOT low. The first instruction comes from ROM, and the failure looks like a broken core. Check STRAPS first in any boot failure.
The second trap is the block-bench value. A check written at block level expects the value its bench drove into an input. On the chip that input is tied the other way. The chip is right; the check is wrong. Take expected values from the chip's tables.
The third trap is the default parameter. ap_soc's clock guard is written for five blocks and used with one. A test sized from the block source expects five enable bits, and nothing in the chip fails to tell it otherwise.
At Scale
This section looks ahead. ap_soc has one strap and a few dozen constants.
Many straps
Larger chips have several straps for boot source, test mode, clock choice and debug, often shared with ordinary pads after boot.
Parameters everywhere
Configurable IP may have dozens of parameters per instance; teams prove or print every one at the top level.
Every strap combination
Boot tests run once per legal strap combination; module V9 does it for ap_soc.
Try It
Run it: the default guard has five enable bits, the chip's instance one.
Instantiate the guard with N = 2 (the predict question below). What does the instance print?
Which line would a test need to read to size itself correctly?
guard tb.block_default: N = 5, 5 enable bits guard tb.chip_instance: N = 1, 1 enable bitCheck Yourself
Common Mistakes
Wrong Test the boot path with the strap at one value.
A strap has two legal values; the other path stays untested.
Fix Run with the board pin low and high, and read STRAPS each time.
Wrong Expect the value a block bench drove into a tied input.
The chip ties the input to its own value.
Fix Take expected values from connect.csv and the chip's tables.
Wrong Size a test from a block's default parameter.
The instance may set another value.
Fix Use the instance value, and prove it.
Remember
- A strap has two legal values: test both and read back what was sampled.
- A tie-off has one value on the chip: prove it with a constant row.
- The instance, not the block's default, decides a parameter.
- Checks carried from block level take expected values from the chip.