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.

The Pins Nobody DrivesThree kinds of input get their value from no block. A strap comes from the board, a tie-off from connect.csv, a parameter from an instance. Each is set once and never checked by a running test unless someone asks.
  • Test
  • Control / FSM
  • Peripheral
  • Control
  • Data
The Pins Nobody DrivesThree kinds of input get their value from no block. A strap comes from the board, a tie-off from connect.csv, a parameter from an instance. Each is set once and never checked by a running test unless someone asks. test Board holds BOOT high orlow control ap_crg samples BOOT once,after the PLL locks peripheral STRAPS, resetvector what the chipremembers control connect.csvconstants 32'h0 ->u_core.hart_id, ... peripheral Block inputs hart ID, watchdogmode, ... control Instanceparameters WORDS, N peripheral Block sizes andshapes set at elaboration strapheldtie-offelaboration
  1. test Boardholds BOOT high or low
    • strap → ap_crg
  2. control ap_crgsamples BOOT once, after the PLL locks
    • held → STRAPS, reset vector
  3. peripheral STRAPS, reset vectorwhat the chip remembers
  4. control connect.csv constants32'h0 -> u_core.hart_id, ...
    • tie-off → Block inputs
  5. peripheral Block inputshart ID, watchdog mode, ...
  6. control Instance parametersWORDS, N
    • elaboration → Block sizes and shapes
  7. peripheral Block sizes and shapesset at elaboration
  1. 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.

  2. 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.

  3. 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.

Five questions this page answers
Question
1Who sets a strap, a tie-off and a parameter?
2Why does a strap need a test at each of its values?
3How do you check a tie-off without a test?
4Why can a block's default parameter mislead a chip-level test?
5Where 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

New words on this page
WordMeaning
StrapA pad the board holds at a level. The chip samples it once and keeps it (BOOT, read back in STRAPS).
Tie-offA block input given a constant in connect.csv, because nothing on this chip drives it.
Instance parameterThe value a parameter takes where the block is instantiated, which may differ from the block's own default.
Default parameterThe value written in the block's own source, used only if the instance gives none.
ElaborationThe step in which a tool fixes every parameter and builds the design's structure, before any simulation or proof.
Sampled onceRead 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.

One block, two values of N
Where you lookNEnable bits
ap_apb_guard.sv, the default55
u_guard_uart in the top level11
A test written from the source fileassumes 5wrong 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

  1. 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.

  2. 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.

  3. Rule 3: The instance decides a parameter.

    Prove or print the value at the instance; never take it from the block's default.

  4. 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.

  5. 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.

Two runs of the bus-manager seat. The first row reads STRAPS bit 0; the second checks RESET_CAUSE bit 4, the debug cause, which v1.5 ties to 0.
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=pass

Both 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.

The first failing row: the strap as sampled is 0.
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.

Part parameters: seven rows, proved on the good wiring; a counterexample on each altered chip.
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.

Six of the 12 rows of part ties-straps. A static crossing marks a value set once and held.
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

ap_soc~12 blocks
Phone-class SoChundreds of blocks

This section looks ahead. ap_soc has one strap and a few dozen constants.

  1. Many straps

    Larger chips have several straps for boot source, test mode, clock choice and debug, often shared with ordinary pads after boot.

  2. Parameters everywhere

    Configurable IP may have dozens of parameters per instance; teams prove or print every one at the top level.

  3. 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?

RUNIcarus Verilog · in your browser
Edit the code, then run it
Expected: guard tb.block_default: N = 5, 5 enable bits guard tb.chip_instance: N = 1, 1 enable bit

Check Yourself

Predict the outputThe chip instance now sets N = 2. What is the last line printed?
// A guard block written for N blocks (default 5). The chip instantiates one guard per block with N = 2.
module guard #(parameter int N = 5) (input logic [N-1:0] on, output logic [N-1:0] blocked);
  assign blocked = ~on;
  initial $display("guard %m: N = %0d, %0d enable bit%s", N, N, N == 1 ? "" : "s");
endmodule
module tb;
  logic [4:0] on5 = 5'b11111;
  logic on1 = 1'b1;
  wire [4:0] b5;
  wire [1:0] b1;
  guard block_default (.on(on5), .blocked(b5));
  guard #(.N(2)) chip_instance (.on({2{on1}}), .blocked(b1));
endmodule
ConceptWho sets a strap?
ConceptWhy did the third strap table fail?
ConceptHow is a tie-off best checked?
ConceptIn the lab, what did the proof show on the chip with one ROM word more?

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.

Practice

Report a problem with this page