What is Reference model?

A separate model, often in C, implementing the same function as the circuit. Its results for the same inputs serve as expected values for the design's outputs.

Field: HDL & Verification

Japanese name: 参照モデル

Role

A self-checking testbench, which judges outputs as pass or fail automatically, needs expected values for the outputs. With few inputs a person can calculate and write them, but this does not keep up as the number grows. A reference model is a program that takes the inputs and computes the expected outputs. It is given the same inputs as the circuit, and the outputs are compared automatically. It is written in C or C++, or in languages such as SystemVerilog or Python. It normally does not represent the detailed timing of the circuit and describes the function in a straightforward way.

An example and how results are compared

Consider an 8-bit adder whose sum is also output in 8 bits. The model need only return the remainder of a + b divided by 256. If a is 200 and b is 100, the expected value is 300 − 256 = 44. If the circuit output is not 44, a mismatch is reported. The cycle in which an output appears depends on how the circuit is built, so data is often matched by order of arrival instead of by time. The part that performs this comparison is called a scoreboard.

Points to watch when building one

The model is built from the specification, without looking at the circuit description. If it is based on the same misunderstanding as the designer's, the circuit and the model make the same mistake and still agree. Having a different person write it in a different language makes shared mistakes less likely. The level of detail must also be decided. A model that matches result values is easy to build, while one that matches cycle by cycle takes more effort. In processor verification, a simulator that models the behavior of instructions is often used as the reference model.

Try it: questions about Reference model

What is the purpose of a reference (golden) model written in C or similar in verification?

  1. ATo hand it to the factory as the manufacturing blueprint
  2. BTo compute the same function another way and use its results as expected values to compare with the design's outputs
  3. CTo slow the circuit down so it is easier to watch
Show answer and explanation

Answer: B. To compute the same function another way and use its results as expected values to compare with the design's outputs

A reference model is a straightforward software implementation of the function the circuit must perform, without regard to timing. Feeding the same inputs to both the circuit and the model and comparing results generates expected values automatically, even for large volumes of random input. If built by the same person with the same misunderstanding as the design, it will miss bugs, so it should be written independently from the specification.

FAQ

Why is it written separately from the circuit description, in a language such as C?

Because it is easier to write and runs fast. Clocks and signal timing need not be described, so the function can be expressed briefly. The different style of description also makes the same mistake less likely.

If the circuit and the model disagree, is the circuit wrong?

Not necessarily. The model may be wrong, or the comparison itself may be. The specification is consulted to judge which is correct.

Books on HDL & Verification Ad

As an Amazon Associate I earn from qualifying purchases.

This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.

Back to the glossary