Table of Contents Previous page Next page Index

ModelSim Documentation Bookcase

Model Technology Inc.


virtual type

The virtual type command creates a new enumerated type, known only by the GUI, not the kernel. Virtual types are used to convert signal values to character strings.

Syntax

virtual type

{<list_of_strings>} <name>

Arguments

{<list_of_strings>}

A list of values and their associated character strings. Required. Values can be expressed in decimal or based notation. Three kinds of based notation are supported: Verilog, VHDL, and C-language styles. The values are interpreted without regard to the size of the bus to be mapped. Bus widths up to 64 bits are supported.

There is currently no restriction on the contents of each string, but if strings contain spaces they would need to be quoted, and if they contain characters treated specially by Tcl (square brackets, curly braces, backslashes...), they would need to be quoted with curly braces.

See the examples below for further syntax.

<name>

The user-defined name of the virtual type. Required. Case is not ignored. Use alpha, numeric, and underscore characters only, unless you are using VHDL extended identifier notation. If using VHDL extended identifier notation, <name> needs to be quoted with double quotes or with curly braces.

Examples

virtual type {state0 state1 state2 state3} mystateType
virtual function {(mystateType)mysignal} myConvertedSignal
add wave myConvertedSignal

This command uses positional notation to associate each string with an enumeration index, starting at zero and increasing by one in the positive direction.When myConvertedSignal is displayed in the Wave, List or Signals window, the string "state0" will appear when mysignal == 0, and "state1" when mysignal == 1, and "state2" when mysignal == 2, etc.

virtual type {{0 NULL_STATE} {1 st1} {2 st2} {0x04 st3} {16'h08 st4} \
             {'h10 st5} {16#20 st6} {0b01000000 st7} {0x80 st8} \
             {default BAD_STATE}} myMappedType
virtual function {(myMappedType)mybus} myConvertedBus
add wave myConvertedBus

This command uses sparse mapping of bus values to alphanumeric strings for an 8-bit, one-hot encoding. It shows the variety of syntax that can be used for values. The value "default" has special meaning and corresponds to any value not explicitly specified.

See also

virtual function, Virtual Objects (User-defined buses, and more)


Note: Virtual types cannot be used in the when (-642) command.


Model Technology Inc.
Model Technology Incorporated
Voice: (503) 641-1340
Fax: (503)526-5410
www.model.com
sales@model.com
Table of Contents Previous page Next page Index

ModelSim Documentation Bookcase