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.

Optimizing Verilog designs UM-127<br />

If your design uses PLI applications that look for object h<strong>and</strong>les in the design hierarchy,<br />

then it is likely that you will need to use the +acc option. For example, the built-in<br />

$dumpvars system task is an internal PLI application that requires h<strong>and</strong>les to nets <strong>and</strong><br />

registers so that it can call the PLI routine acc_vcl_add() to monitor changes <strong>and</strong> dump the<br />

values to a VCD file. This requires that access is enabled for the nets <strong>and</strong> registers on which<br />

it operates. Suppose you want to dump all nets <strong>and</strong> registers in the entire design, <strong>and</strong> that<br />

you have the following $dumpvars call in your testbench (no arguments to $dumpvars<br />

means to dump everything in the entire design):<br />

initial $dumpvars;<br />

Then you need to optimize your design as follows to enable net <strong>and</strong> register access for all<br />

modules in the design:<br />

% vopt +acc=rn testbench<br />

Optimizing gate-level designs<br />

As another example, suppose you only need to dump nets <strong>and</strong> registers of a particular<br />

instance in the design (the first argument of 1 means to dump just the variables in the<br />

instance specified by the second argument):<br />

initial $dumpvars(1, testbench.u1);<br />

Then you need to compile your design as follows (assuming testbench.u1 refers to the<br />

module design):<br />

% vopt +acc=rn+design testbench<br />

Finally, suppose you need to dump everything in the children instances of testbench.u1 (the<br />

first argument of 0 means to also include all children of the instance):<br />

initial $dumpvars(0, testbench.u1);<br />

Then you need to compile your design as follows:<br />

% vopt +acc=rn+design. testbench<br />

To gain maximum performance, it may be necessary to enable the minimum required<br />

access within the design.<br />

Gate-level designs should not be optimized with vopt. These designs often have large<br />

netlists that are slow to optimize with vopt. In most cases we recommend the following<br />

flow for optimizing gate-level designs:<br />

Compile the cell library using -fast. If the cell library is vendor supplied <strong>and</strong> the compiled<br />

results will be placed in a read-only location, you should also use the -forcecode<br />

argument along with -fast. The -forcecode argument ensures that code is generated for<br />

inlined modules.<br />

Compile the device under test <strong>and</strong> testbench without -fast.<br />

There are two cases where you should not follow this flow:<br />

If your testbench has hierarchical references into the cell library, optimizing the library<br />

alone would result in unresolved references.<br />

If you are passing parameters to the cell library from either the testbench or the design<br />

under test.<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!