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.

Example 3 — Mixed-HDL design<br />

First, create three VCD files, one for each module:<br />

% cd ~/modeltech/examples/mixedHDL<br />

% vlib work<br />

% vlog cache.v memory.v proc.v<br />

% vcom util.vhd set.vhd top.vhd<br />

% vsim top<br />

VSIM 1> vcd dumpports -file proc.vcd /top/p/*<br />

VSIM 2> vcd dumpports -file cache.vcd /top/c/*<br />

VSIM 3> vcd dumpports -file memory.vcd /top/m/*<br />

VSIM 4> run 1000<br />

VSIM 5> quit -f<br />

Next, rerun each module separately, using the captured VCD stimulus:<br />

% vsim -vcdstim proc.vcd proc -do "add wave /*; run 1000"<br />

VSIM 1> quit -f<br />

% vsim -vcdstim cache.vcd cache -do "add wave /*; run 1000"<br />

VSIM 1> quit -f<br />

% vsim -vcdstim memory.vcd memory -do "add wave /*; run 1000"<br />

VSIM 1> quit -f<br />

Replacing instances with output values from a VCD file<br />

Using extended VCD as stimulus UM-459<br />

Replacing instances with output values from a VCD file lets you simulate without the<br />

instance’s source or even the compiled object. The general procedure includes two steps:<br />

1 Create VCD files for one or more instances in your design using the vcd dumpports<br />

comm<strong>and</strong> (CR-295). If necessary, use the -vcdstim switch to h<strong>and</strong>le port order problems<br />

(see below).<br />

2 Re-simulate your design using the -vcdstim = argument to vsim<br />

(CR-373). Note that this works only with VCD files that were created by a <strong>ModelSim</strong><br />

simulation.<br />

Example<br />

In the following example, the three instances /top/p, /top/c, <strong>and</strong> /top/m are replaced in<br />

simulation by the output values found in the corresponding VCD files.<br />

First, create VCD files for all instances you want to replace:<br />

vcd dumpports -vcdstim -file proc.vcd /top/p/*<br />

vcd dumpports -vcdstim -file cache.vcd /top/c/*<br />

vcd dumpports -vcdstim -file memory.vcd /top/m/*<br />

run 1000<br />

Next, simulate your design <strong>and</strong> map the instances to the VCD files you created:<br />

vsim top -vcdstim /top/p=proc.vcd -vcdstim /top/c=cache.vcd<br />

-vcdstim /top/m=memory.vcd<br />

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

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

Saved successfully!

Ooh no, something went wrong!