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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

UM-114 5 - Verilog simulation<br />

Compiling Verilog files<br />

Creating a design library<br />

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

Before you can compile your design, you must create a library in which to store the<br />

compilation results. Use either the File > New > Library menu comm<strong>and</strong> in the <strong>ModelSim</strong><br />

GUI or the vlib (CR-356) comm<strong>and</strong> to create a new library. For example:<br />

vlib work<br />

Invoking the Verilog compiler<br />

This creates a library named work. By default compilation results are stored in the work<br />

library.<br />

The work library is actually a subdirectory named work. This subdirectory contains a<br />

special file named _info. Do not create libraries using UNIX comm<strong>and</strong>s – always use the<br />

vlib comm<strong>and</strong> (CR-356).<br />

See "Design libraries" (UM-57) for additional information on working with libraries.<br />

The <strong>ModelSim</strong> Verilog compiler, vlog, compiles Verilog source code into retargetable,<br />

executable code, meaning that the library format is compatible across all supported<br />

platforms <strong>and</strong> that you can simulate your design on any platform without having to<br />

recompile your design specifically for that platform. You can also access the compiler via<br />

the Compile > Compile menu comm<strong>and</strong> in the <strong>ModelSim</strong> GUI (see "Compile Source Files<br />

dialog" (GR-59) for more information).<br />

As you compile your design, the resulting object code for modules <strong>and</strong> UDPs is generated<br />

into a library. As noted above, the compiler places results into the work library by default.<br />

You can specify an alternate library with the -work argument.<br />

Here is one example of a vlog comm<strong>and</strong>:<br />

vlog top.v +libext+.v+.u -y vlog_lib<br />

After compiling top.v, vlog will scan the vlog_lib library for files with modules with the<br />

same name as primitives referenced, but undefined in top.v. The use of +libext+.v+.u<br />

implies filenames with a .v or .u suffix (any combination of suffixes may be used). Only<br />

referenced definitions will be compiled.

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

Saved successfully!

Ooh no, something went wrong!