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-76 4 - VHDL simulation<br />

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

Files <strong>and</strong> packages<br />

Each package header <strong>and</strong> body should be compiled with the same language version.<br />

Common problems in this area involve files as parameters <strong>and</strong> the size of type<br />

CHARACTER. For example, consider a package header <strong>and</strong> body with a procedure that<br />

has a file parameter:<br />

procedure proc1 ( out_file : out std.textio.text) ...<br />

If you compile the package header with VHDL-87 <strong>and</strong> the body with VHDL-93 or<br />

VHDL-2002, you will get an error message such as:<br />

"** Error: mixed_package_b.vhd(4): Parameter kinds do not conform between<br />

declarations in package header <strong>and</strong> body: 'out_file'."<br />

Direction of concatenation<br />

To solve some technical problems, the rules for direction <strong>and</strong> bounds of concatenation<br />

were changed from VHDL-87 to VHDL-93. You won't see any difference in simple<br />

variable/signal assignments such as:<br />

v1 := a & b;<br />

But if you (1) have a function that takes an unconstrained array as a parameter, (2) pass<br />

a concatenation expression as a formal argument to this parameter, <strong>and</strong> (3) the body of<br />

the function makes assumptions about the direction or bounds of the parameter, then you<br />

will get unexpected results. This may be a problem in environments that assume all arrays<br />

have "downto" direction.<br />

xnor<br />

"xnor" is a reserved word in VHDL-93. If you declare an xnor function in VHDL-87<br />

(without quotes) <strong>and</strong> compile it under VHDL-2002, you will get an error message like<br />

the following:<br />

** Error: xnor.vhd(3): near "xnor": expecting: STRING IDENTIFIER<br />

'FOREIGN attribute<br />

In VHDL-93 package STANDARD declares an attribute 'FOREIGN. If you declare your<br />

own attribute with that name in another package, then <strong>ModelSim</strong> issues a warning such<br />

as the following:<br />

-- Compiling package foopack<br />

** Warning: foreign.vhd(9): (vcom-1140) VHDL-1993 added a definition of the<br />

attribute foreign to package std.st<strong>and</strong>ard. The attribute is also defined in<br />

package 'st<strong>and</strong>ard'. Using the definition from package 'st<strong>and</strong>ard'.<br />

Size of CHARACTER type<br />

In VHDL-87 type CHARACTER has 128 values; in VHDL-93 it has 256 values. Code<br />

which depends on this size will behave incorrectly. This situation occurs most commonly<br />

in test suites that check VHDL functionality. It's unlikely to occur in practical designs. A<br />

typical instance is the replacement of warning message:<br />

by<br />

"range nul downto del is null"<br />

"range nul downto 'ÿ' is null" -- range is nul downto y(umlaut)

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

Saved successfully!

Ooh no, something went wrong!