test benches (test fixtures)
TRANSCRIPT
![Page 1: Test Benches (Test Fixtures)](https://reader033.vdocuments.site/reader033/viewer/2022051302/5882c16a1a28abc3198b9839/html5/thumbnails/1.jpg)
Jim Duckworth, WPI Verilog for Testing - Module 61
Test Benches (Test Fixtures)
Verilog for Testing
![Page 2: Test Benches (Test Fixtures)](https://reader033.vdocuments.site/reader033/viewer/2022051302/5882c16a1a28abc3198b9839/html5/thumbnails/2.jpg)
Jim Duckworth, WPI Verilog for Testing - Module 62
Overview
• We have concentrated on Verilog for synthesis
• Can also use Verilog as a test language
• Very important to conduct comprehensive verification on
your design
• To simulate your design you need to produce an additional
module that includes your synthesizable Verilog design.
– Usually referred to as a TEST BENCH or TEST FIXTURE
• Not hardware, just additional Verilog!
![Page 3: Test Benches (Test Fixtures)](https://reader033.vdocuments.site/reader033/viewer/2022051302/5882c16a1a28abc3198b9839/html5/thumbnails/3.jpg)
Jim Duckworth, WPI Verilog for Testing - Module 63
Test Bench
• A virtual platform containing the design to be tested
(UUT) and virtual wires connected to the UUT inputs and
outputs.
• To exercise and verify the correctness of a design to be
implemented in hardware
• Has three main purposes
– to generate stimulus for simulation
– to apply this stimulus to the module under test and to collect output
responses
– to compare output responses with expected values
• Test Bench should be created by a different engineer than
the one who created the synthesizable Verilog
![Page 4: Test Benches (Test Fixtures)](https://reader033.vdocuments.site/reader033/viewer/2022051302/5882c16a1a28abc3198b9839/html5/thumbnails/4.jpg)
Jim Duckworth, WPI Verilog for Testing - Module 64
Test Bench – Virtual Platform
Module
to be
Tested
(UUT)
Apply
Stimulus
Verify
Responses
![Page 5: Test Benches (Test Fixtures)](https://reader033.vdocuments.site/reader033/viewer/2022051302/5882c16a1a28abc3198b9839/html5/thumbnails/5.jpg)
Jim Duckworth, WPI Verilog for Testing - Module 65
Test Bench Overview
• A Test Bench module consists of
– Port list has NO ports
– Instantiate module to be tested (UUT)
– Declare internal signals to wire to UUT inputs and outputs
– Verilog statements to provide stimulus and verify UUT responses
– Designing a test bench that has good coverage can be a very
involved project!
![Page 6: Test Benches (Test Fixtures)](https://reader033.vdocuments.site/reader033/viewer/2022051302/5882c16a1a28abc3198b9839/html5/thumbnails/6.jpg)
Jim Duckworth, WPI Verilog for Testing - Module 66
Test Bench - general structure
UUT
ina
inb
inc
out1
module decoder_tf;
internal signal declarations
UUT: test_component instantiation
signals to generate stimulus
statements to verify responses
endmodule
![Page 7: Test Benches (Test Fixtures)](https://reader033.vdocuments.site/reader033/viewer/2022051302/5882c16a1a28abc3198b9839/html5/thumbnails/7.jpg)
Example Decoder – is the design correct?
Jim Duckworth, WPIVerilog for Testing - Module 6
7
![Page 8: Test Benches (Test Fixtures)](https://reader033.vdocuments.site/reader033/viewer/2022051302/5882c16a1a28abc3198b9839/html5/thumbnails/8.jpg)
Create Test Fixture
• Select Simulation View
• Select Project => New Source
• Select decoder source to associate with test fixture
Jim Duckworth, WPIVerilog for Testing - Module 6
8
![Page 9: Test Benches (Test Fixtures)](https://reader033.vdocuments.site/reader033/viewer/2022051302/5882c16a1a28abc3198b9839/html5/thumbnails/9.jpg)
Outline of Test Fixture produced
Jim Duckworth, WPIVerilog for Testing - Module 6
9
![Page 10: Test Benches (Test Fixtures)](https://reader033.vdocuments.site/reader033/viewer/2022051302/5882c16a1a28abc3198b9839/html5/thumbnails/10.jpg)
Apply input stimulus
Jim Duckworth, WPIVerilog for Testing - Module 6
10
![Page 11: Test Benches (Test Fixtures)](https://reader033.vdocuments.site/reader033/viewer/2022051302/5882c16a1a28abc3198b9839/html5/thumbnails/11.jpg)
Simulate Behavioral Model
Jim Duckworth, WPIVerilog for Testing - Module 6
11
![Page 12: Test Benches (Test Fixtures)](https://reader033.vdocuments.site/reader033/viewer/2022051302/5882c16a1a28abc3198b9839/html5/thumbnails/12.jpg)
Testing sequential logic
• Creating clock signal
• Can also ‘restart’, ‘run’, and add internal signals to wave
Jim Duckworth, WPIVerilog for Testing - Module 6
12