makehdltb - Generate HDL test bench from model

Syntax

makehdltb('modelname/subsys')
makehdltb('modelname/subsys', 'PropertyName', PropertyValue,...)

Description

makehdltb('modelname/subsys') generates an HDL test bench from the specified subsystem within a model, using default values for all properties. The modelname/subsys argument gives the path to the subsystem under test. This subsystem must be at the top (root) level of the current model. The generated test bench is designed to interface to and validate HDL code generated from subsys (or from a subsystem with a functionally identical public interface).

A typical practice is to generate HDL code for a subsystem, followed immediately by generation of a test bench to validate the same subsystem (see Examples).

makehdltb('modelname/subsys', 'PropertyName', PropertyValue,...) generates an HDL test bench from the specified subsystem within a model, explicitly specifying one or more code generation options as property/value pairs.

Property/value pairs are passed in the form

'PropertyName', PropertyValue

These property settings determine characteristics of the test bench code. Many of these properties are identical to those for makehdl, while others are specific to test bench generation (for example, options for generation of test bench stimuli). The next section, Defaults for Test Bench Code Generation, summarizes the defaults that are specific to generated test bench code.

For detailed descriptions of each property and its effect on generated code, see Properties — Alphabetical List, and Property Reference.

Generating Stimulus and Output Data

makehdltb generates test data from signals connected to inputs of the subsystem under test. Sample values for each stimulus signal are computed and stored for each time step of the simulation. The signal data is represented as arrays in the generated test bench code.

To help you validate generated HDL code, makehdltb also generates output data from signals connected to outputs of the subsystem under test. Like input data, sample values for each output signal are computed and stored for each time step of the simulation. The signal data is represented as arrays in the generated test bench code.

The total simulation time (set by the model's Stop Time parameter) determines the size of the stimulus and output data arrays. Computation of sample values can be time-consuming. Consider speeding up generation of signal data by entering a shorter Stop Time.

Defaults for Test Bench Code Generation

This section describes defaults that apply specifically to generation of test bench code. makehdltb has many properties and defaults in common with makehdl. See HDL Code Generation Defaults for a summary of these common properties and defaults.

File Packaging and Naming

By default, makehdltb generates an HDL source file containing test bench code and arrays of stimulus and output data. In addition, makehdltb generates script files that let you execute a simulation of the test bench and the HDL entity under test. Generated test bench file names (like makehdl generated file names) are based on the name of the DUT. The following table summarizes the default test bench file-naming conventions.

File Name
Verilog test bench system_tb.v, where system is the name of the system under test
VHDL test bench system_tb.vhd, where system is the name of the system under test
Mentor Graphics ModelSim compilation script  system_tb_compile.do, where system is the name of the DUT
Mentor Graphics ModelSim simulation script system_tb_sim.do, where system is the name of the DUT

Other Test Bench Settings

Examples

In the following example, makehdl generates VHDL code for the subsystem symmetric_fir. After the coder indicates successful completion of code generation, makehdltb generates a VHDL test bench for the same subsystem.

makehdl('sfir_fixed/symmetric_fir')
### Applying HDL Code Generation Control Statements
 

### Begin VHDL Code Generation
### Working on sfir_fixed/symmetric_fir as hdlsrc\symmetric_fir.vhd
### HDL Code Generation Complete.
makehdltb('sfir_fixed/symmetric_fir')
### Begin TestBench Generation
### Generating Test bench: hdlsrc\symmetric_fir_tb.vhd
### Please wait ...

### HDL TestBench Generation Complete.

See Also

makehdl

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS