24.03.2013 Views

ModelSim SE User's Manual - Electrical and Computer Engineering

ModelSim SE User's Manual - Electrical and Computer Engineering

ModelSim SE User's Manual - Electrical and Computer Engineering

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

UM-74 4 - VHDL simulation<br />

Range <strong>and</strong> index checking<br />

Subprogram inlining<br />

<strong>ModelSim</strong> <strong>SE</strong> User’s <strong>Manual</strong><br />

A range check verifies that a scalar value defined with a range subtype is always assigned<br />

a value within its range. An index check verifies that whenever an array subscript<br />

expression is evaluated, the subscript will be within the array's range.<br />

Range <strong>and</strong> index checks are performed by default when you compile your design. You can<br />

disable range checks (potentially offering a performance advantage) <strong>and</strong> index checks<br />

using arguments to the vcom (CR-311) comm<strong>and</strong>. Or, you can use the NoRangeCheck <strong>and</strong><br />

NoIndexCheck variables in the modelsim.ini file to specify whether or not they are<br />

performed. See "Preference variables located in INI files" (UM-524).<br />

Range checks in <strong>ModelSim</strong> are slightly more restrictive than those specified by the VHDL<br />

LRM. <strong>ModelSim</strong> requires any assignment to a signal to also be in range whereas the LRM<br />

requires only that range checks be done whenever a signal is updated. Most assignments to<br />

signals update the signal anyway, <strong>and</strong> the more restrictive requirement allows <strong>ModelSim</strong><br />

to generate better error messages.<br />

<strong>ModelSim</strong> attempts to inline subprograms at compile time to improve simulation<br />

performance. This happens automatically <strong>and</strong> should be largely transparent. However, you<br />

can disable automatic inlining two ways:<br />

Invoke vcom (CR-311) with the -O0 or -O1 argument<br />

Use the mti_inhibit_inline attribute as described below<br />

Single-stepping through a simulation varies slightly depending on whether inlining<br />

occurred. When single-stepping to a subprogram call that has not been inlined, the<br />

simulator stops first at the line of the call, <strong>and</strong> then proceeds to the line of the first<br />

executable statement in the called subprogram. If the called subprogram has been inlined,<br />

the simulator does not first stop at the subprogram call, but stops immediately at the line of<br />

the first executable statement.<br />

mti_inhibit_inline attribute<br />

You can disable inlining for individual design units (a package, architecture, or entity) or<br />

subprograms with the mti_inhibit_inline attribute. Follow these rules to use the attribute:<br />

Declare the attribute within the design unit's scope as follows:<br />

attribute mti_inhibit_inline : boolean;<br />

Assign the value true to the attribute for the appropriate scope. For example, to inhibit<br />

inlining for a particular function (e.g., "foo"), add the following attribute assignment:<br />

attribute mti_inhibit_inline of foo : procedure is true;<br />

To inhibit inlining for a particular package (e.g., "pack"), add the following attribute<br />

assignment:<br />

attribute mti_inhibit_inline of pack : package is true;<br />

Do similarly for entities <strong>and</strong> architectures.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!