What the check does
A contract names one definition in the RTL and one definition in a C header that must agree. Breakspec parses the two definitions and compares them. It does not use a model for this comparison. It reads the SystemVerilog with slang and the C header with libclang.
A review needs no configuration file. Add this check when you want the same comparison on each review, without a reviewer having to find the two files.
What the configuration needs
List the contracts in .breakspec/config.yaml. Each entry has a name, an RTL side and a firmware side.
contracts: - name: register-map rtl: { package: axon_regs_pkg, prefix: ADDR_ } firmware: { header: fw/include/axon_regs.h, prefix: AXON_REG_ } - name: dma-descriptor rtl: { type: axon_desc_pkg::dma_desc_t, layout: lsb_first_le } firmware: { header: fw/include/axon_desc.h, struct: axon_dma_desc }This example is from our sample project. breakspec onboard --agent can write the entries for you. See Configuration.
Register map
For a register map, give the RTL package and the C header. Give the prefix of the address names on each side. Breakspec removes the prefix and pairs the names, so ADDR_CTRL pairs with AXON_REG_CTRL.
It compares the address of each register. It compares the bit position of each field. It also lists each place in the driver that uses a register that does not agree.
Struct layout
For a packed struct, give the RTL type and the C struct. Breakspec calculates the bit offset of each field in the RTL type. It compares that with the layout that clang calculates for the C struct, padding included.
What it reports
Each disagreement becomes one finding in the review. The finding shows the RTL value and the C value side by side. Examples are a register at a different address, a field with a different width, a struct with a different size, and a register that only one side defines.
A finding from this check is confirmed by reading the code. It is not a simulation result. See Evidence for the words Breakspec uses for each level.
Run the check yourself
$ breakspec check contracts$ breakspec regmap export --format c # print the RTL register map as a C headerSee Command line for the other commands.