Learning Task 1: Picker Part
Get familiar with the basic usage of Picker
The code and documentation for the verification object are located at: Design Specification and Code for Sync FIFO.
Preparation
- Create the project directory structure:
fifo_test/
├── rtl/ # Place the FIFO RTL code here
└── test_smoke.py # Test case file
- Put the Sync FIFO code under
rtl, and name itSyncFIFO.v.
1. Creating and Initializing the DUT Class
Create a DUT class for the Sync FIFO
Create a
test_reset_dutfunction as a test case: pull therst_nsignal low for 5 cycles, then pull it high for 2 cycles, and dump the waveform signalObserve the waveform and focus on: In the default write mode, when does pulling
rst_nhigh take effect?Change the write mode of
rst_nto immediate modeImme, observe again when does pullingrst_nhigh take effect? Compare the waveform with the default case.Think: When initializing a module, is assigning a value to
rst_nalone sufficient? What else needs to be considered?You may read the following materials to help you think:
(4.1 Value set) The value set in Verilog HDL contains four basic values:
0: represents logic zero or false condition1: represents logic one or true conditionx: represents unknown logic valuez: represents high impedance state
(4.2.1 Net declarations) The initial value of
wiretype isz(4.2.2 Variable declarations) The initial value of
regtype isx—— From IEEE Std 1364-2005, IEEE Standard for Verilog® Hardware Description Language
Verilator is essentially a two-state simulator, so for
xandzvalues it will assign a specific constant value, which can be a random number or a fixed value, depending on the control of related options.—— From the Unknown States section of the Verilator documentation
2. Writing the Reset Test
Based on the test case test_reset_dut, after the reset is complete, use assert to verify whether the FIFO output and read/write pointers are 0.
3. Writing the Smoke Test
The smoke test is the first line of defense in the verification process, used to quickly confirm whether the basic functions of the system are working properly.
This term originated from the hardware industry: when new hardware is powered on for the first time, if there is no smoke, it passes the initial test.
In chip verification, smoke tests can detect serious problems early in development, saving a lot of debugging time.
Add a test case test_smoke_dut with the following test steps:
Reset the DUT
Write two pieces of data to the FIFO:
Set
we_ihigh, assign0x114todata_i, hold for one cycle, then check whetherempty_oandfull_oare 0Set
we_ihigh, assign0x514todata_i, hold for one cycle
Read two pieces of data from the FIFO:
Set
we_ilow,re_ihigh, hold for one cycle, then readdata_oand verify the result is0x114Set
we_ilow,re_ihigh, hold for one cycle, then readdata_oand verify the result is0x514andempty_ois 1
Then run the test case to verify whether the DUT passes the test.