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-418 17 - Signal Spy<br />

Introduction<br />

Designed for testbenches<br />

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

The Verilog language allows access to any signal from any other hierarchical block without<br />

having to route it via the interface. This means you can use hierarchical notation to either<br />

assign or determine the value of a signal in the design hierarchy from a testbench. This<br />

capability fails when a Verilog testbench attempts to reference a signal in a VHDL block<br />

or reference a signal in a Verilog block through a VHDL level of hierarchy.<br />

This limitation exists because VHDL does not allow hierarchical notation. In order to<br />

reference internal hierarchical signals, you have to resort to defining signals in a global<br />

package <strong>and</strong> then utilize those signals in the hierarchical blocks in question. But, this<br />

requires that you keep making changes depending on the signals that you want to reference.<br />

The Signal Spy procedures <strong>and</strong> system tasks overcome the aforementioned limitations.<br />

They allow you to monitor (spy), drive, force, or release hierarchical objects in a VHDL or<br />

mixed design.<br />

The VHDL procedures are provided via the "Util package" (UM-96) within the modelsim_lib<br />

library. To access the procedures you would add lines like the following to your VHDL<br />

code:<br />

library modelsim_lib;<br />

use modelsim_lib.util.all;<br />

The Verilog tasks are available as built-in "System tasks <strong>and</strong> functions" (UM-146). The table<br />

below shows the VHDL procedures <strong>and</strong> their corresponding Verilog system tasks.<br />

VHDL procedures Verilog system tasks<br />

init_signal_driver (UM-419) $init_signal_driver (UM-429)<br />

init_signal_spy (UM-422) $init_signal_spy (UM-432)<br />

In this example, the value of /top/uut/<br />

inst1/sig1 is mirrored onto /top/<br />

top_sig1. signal_force (UM-425)<br />

$signal_force (UM-434)<br />

signal_release (UM-427) $signal_release (UM-436)<br />

Signal Spy limits the portability of your code. HDL code with Signal Spy procedures or<br />

tasks works only in <strong>ModelSim</strong>, not other simulators. We therefore recommend using Signal<br />

Spy only in testbenches, where portability is less of a concern, <strong>and</strong> the need for such a tool<br />

is more applicable.

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

Saved successfully!

Ooh no, something went wrong!