Top Banner
Creating Test Environments HDL Model HDL Testbench Simulation Engine API stimulus check Testbench Program stimulus check •Non-HDL languages may be used to control testing process •Provide software abstractions not available in HDLs
15

Creating Test Environments HDL Model HDL Testbench Simulation Engine API stimulus check Testbench Program stimulus check Non-HDL languages may be used.

Dec 21, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Creating Test Environments HDL Model HDL Testbench Simulation Engine API stimulus check Testbench Program stimulus check Non-HDL languages may be used.

Creating Test Environments

HDL Model

HDL Testbench SimulationEngine

APIstimulus

check

TestbenchProgram

stimulus

check

•Non-HDL languages may be used to control testing process•Provide software abstractions not available in HDLs

Page 2: Creating Test Environments HDL Model HDL Testbench Simulation Engine API stimulus check Testbench Program stimulus check Non-HDL languages may be used.

HDL (Verilog) Test Environments

•HDLs provide basic facilities for testbench development•Hierarchy is primarily structural•No classes

Page 3: Creating Test Environments HDL Model HDL Testbench Simulation Engine API stimulus check Testbench Program stimulus check Non-HDL languages may be used.

External Control in Verilog

•$readmemh allows files to be read•Interactive control is weak in language (must use simulator)

Page 4: Creating Test Environments HDL Model HDL Testbench Simulation Engine API stimulus check Testbench Program stimulus check Non-HDL languages may be used.

Behavioral Hierarchy

•Tasks (and functions) enable behavioral hierarchy

STIM module

Page 5: Creating Test Environments HDL Model HDL Testbench Simulation Engine API stimulus check Testbench Program stimulus check Non-HDL languages may be used.

Other Verilog Testbench Features

Debug Trace File Generation

•$display/$fdisplay print data to stdio/files•$monitor/$fmonitor print data whenever signals change

Randomization - watch out for seed values

•$random produces uniform distribution•$dist_normal(), $dist_exponential, $dist_poisson

Page 6: Creating Test Environments HDL Model HDL Testbench Simulation Engine API stimulus check Testbench Program stimulus check Non-HDL languages may be used.

C/C++ Testbench

Benefits

•Every engineer can write C/C++ code•Can use classes, pointers, and other software features

Disadvantages

•Control flow between HDL and C/C++ domain in confusing•Partitioning is an issue•Difficult to make HW tests in SW language (time, structure, etc)

Page 7: Creating Test Environments HDL Model HDL Testbench Simulation Engine API stimulus check Testbench Program stimulus check Non-HDL languages may be used.

Integrated C/C++ Testbench

•HDL Simulator calls C/C++ functions- Program Language Interface (PLI) for Verilog- Foreign Language Interface (FLI) or VHPI for VHDL

Ex. The write_command task could be written in C

•C/C++ performs sub-functions (i.e. make test data, compare test response) but top control flow is in HDL

•C/C++ can be invoked implicitly on events, at time steps

•May be hard to follow control flow when invocation is implicit

Page 8: Creating Test Environments HDL Model HDL Testbench Simulation Engine API stimulus check Testbench Program stimulus check Non-HDL languages may be used.

Separated C/C++ Testbench

•Control flow switches between C/C++ and HDL at each time step•HDL simulator keeps track of signal values over time•Control flow switch at two explicit points, easier to follow

Page 9: Creating Test Environments HDL Model HDL Testbench Simulation Engine API stimulus check Testbench Program stimulus check Non-HDL languages may be used.

High-Level Verification Languages

Common Features

•Temporal Expressions - check for event sequences over time

•Constrained Random Test Generation - need to weight the occurrence of events on inputs

1. Constrain the domain: x >5 OR x <22. Weight the domain: x = 1 (50%), x=2 (25%), x=3 (25%)3. Constrain mutual domains: x + y < MAXVAL4. Temporal constraints: valid0 = 1 => valid1 = 0

Page 10: Creating Test Environments HDL Model HDL Testbench Simulation Engine API stimulus check Testbench Program stimulus check Non-HDL languages may be used.

High-Level Verification Language Features

•Coverage Collection - Quantify the amount of the design covered during testing

•Automatic Garbage Collection (Memory Management) - No malloc, memory leaks, etc.

•Interpretation and Compilation - Interpretation is often useful during interactive debugging

Page 11: Creating Test Environments HDL Model HDL Testbench Simulation Engine API stimulus check Testbench Program stimulus check Non-HDL languages may be used.

OpenVera

•Supported by Synopsys•Object-Oriented language•Random variables can be defined with constraints/weights

Page 12: Creating Test Environments HDL Model HDL Testbench Simulation Engine API stimulus check Testbench Program stimulus check Non-HDL languages may be used.

Context Free Exressions in OpenVera

•Backus-Naur Form (BNF) expressions can be used to restrict test generation

•Weights are possible too

Page 13: Creating Test Environments HDL Model HDL Testbench Simulation Engine API stimulus check Testbench Program stimulus check Non-HDL languages may be used.

E Language

•Owned by Cadence (previously Verisity)•Also object-oriented•Standard subclass hierarchy allowed with “like”

Page 14: Creating Test Environments HDL Model HDL Testbench Simulation Engine API stimulus check Testbench Program stimulus check Non-HDL languages may be used.

Extension and Constraints in E

•“extend” adds fields to a struct

•“keep” constrains field values

•Extend can be useful when different data is used for different tests•May be hard to keep track of all variations

Page 15: Creating Test Environments HDL Model HDL Testbench Simulation Engine API stimulus check Testbench Program stimulus check Non-HDL languages may be used.

System C Language

•Another object-oriented HVL•It is C++ with extra classes to support hardware concepts•Great for cosimulation of HW/SW systems