268 lines
13 KiB
HTML
268 lines
13 KiB
HTML
<!DOCTYPE html>
|
||
|
||
<html lang="en" data-content_root="../">
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
||
|
||
<title>VVP Interactive Mode — Icarus Verilog documentation</title>
|
||
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=fa44fd50" />
|
||
<link rel="stylesheet" type="text/css" href="../_static/alabaster.css?v=cb25574f" />
|
||
<script src="../_static/documentation_options.js?v=5929fcd5"></script>
|
||
<script src="../_static/doctools.js?v=888ff710"></script>
|
||
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
||
<link rel="icon" href="../_static/favicon.ico"/>
|
||
<link rel="index" title="Index" href="../genindex.html" />
|
||
<link rel="search" title="Search" href="../search.html" />
|
||
<link rel="next" title="VVP as a library" href="vvp_library.html" />
|
||
<link rel="prev" title="VVP Command Line Flags" href="vvp_flags.html" />
|
||
|
||
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
|
||
|
||
|
||
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
|
||
|
||
</head><body>
|
||
|
||
|
||
<div class="document">
|
||
<div class="documentwrapper">
|
||
<div class="bodywrapper">
|
||
|
||
|
||
<div class="body" role="main">
|
||
|
||
<section id="vvp-interactive-mode">
|
||
<h1>VVP Interactive Mode<a class="headerlink" href="#vvp-interactive-mode" title="Link to this heading">¶</a></h1>
|
||
<p>The vvp command has an interactive debug mode, where you can stop the
|
||
simulation and browse the current state of the simulation. There are
|
||
a couple ways to enter the debug mode, but once in interactive debug
|
||
mode, the usage is the same. Consider the example below:</p>
|
||
<div class="highlight-verilog notranslate"><div class="highlight"><pre><span></span><span class="k">module</span><span class="w"> </span><span class="n">clock</span><span class="p">(</span><span class="k">output</span><span class="w"> </span><span class="kt">reg</span><span class="w"> </span><span class="n">clock</span><span class="p">);</span>
|
||
<span class="w"> </span><span class="k">initial</span><span class="w"> </span><span class="n">clock</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mh">1</span><span class="mb">'b1</span><span class="p">;</span>
|
||
<span class="w"> </span><span class="k">always</span><span class="w"> </span><span class="p">#</span><span class="mh">100</span><span class="w"> </span><span class="n">clock</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">!</span><span class="n">clock</span><span class="p">;</span>
|
||
<span class="k">endmodule</span><span class="w"> </span><span class="c1">// clock</span>
|
||
|
||
<span class="k">module</span><span class="w"> </span><span class="n">main</span><span class="p">;</span>
|
||
|
||
<span class="w"> </span><span class="kt">reg</span><span class="w"> </span><span class="p">[</span><span class="mh">2</span><span class="o">:</span><span class="mh">0</span><span class="p">]</span><span class="w"> </span><span class="n">foo</span><span class="p">;</span>
|
||
<span class="w"> </span><span class="kt">wire</span><span class="w"> </span><span class="n">clk</span><span class="p">;</span>
|
||
|
||
<span class="w"> </span><span class="n">clock</span><span class="w"> </span><span class="n">foo_clock</span><span class="p">(</span><span class="n">clk</span><span class="p">);</span>
|
||
|
||
<span class="w"> </span><span class="k">always</span><span class="w"> </span><span class="p">@(</span><span class="k">posedge</span><span class="w"> </span><span class="n">clk</span><span class="p">)</span>
|
||
<span class="w"> </span><span class="n">foo</span><span class="w"> </span><span class="o"><=</span><span class="w"> </span><span class="n">foo</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mh">1</span><span class="p">;</span>
|
||
|
||
<span class="w"> </span><span class="k">initial</span><span class="w"> </span><span class="k">begin</span>
|
||
<span class="w"> </span><span class="n">foo</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mh">3</span><span class="mb">'b000</span><span class="p">;</span>
|
||
<span class="w"> </span><span class="p">#</span><span class="mh">250</span><span class="w"> </span><span class="nb">$stop</span><span class="p">;</span>
|
||
<span class="w"> </span><span class="k">end</span>
|
||
|
||
<span class="k">endmodule</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>In examples that follow, we will use the above sample program.</p>
|
||
<section id="enter-interactive-mode">
|
||
<h2>Enter Interactive Mode<a class="headerlink" href="#enter-interactive-mode" title="Link to this heading">¶</a></h2>
|
||
<p>The first and most common method is to put “$stop” system task
|
||
calls in the simulation at the times where you want to simulation
|
||
to break and enter interactive mode. The example above has a $stop,
|
||
so the output looks like this:</p>
|
||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>../foo.vl:25: $stop called at 250 (1s)
|
||
** VVP Stop(0) **
|
||
** Flushing output streams.
|
||
** Current simulation time is 250 ticks.
|
||
>
|
||
</pre></div>
|
||
</div>
|
||
<p>You can get some interactive help by using the “help” command:</p>
|
||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> help
|
||
Commands can be from the following table of base commands,
|
||
or can be invocations of system tasks/functions.
|
||
|
||
cd - Synonym for push.
|
||
cont - Resume (continue) the simulation
|
||
finish - Finish the simulation.
|
||
help - Get help.
|
||
list - List items in the current scope.
|
||
load - Load a VPI module, a la vvp -m.
|
||
ls - Shorthand for "list".
|
||
pop - Pop one scope from the scope stack.
|
||
push - Descend into the named scope.
|
||
step - Single-step the scheduler for 1 event.
|
||
time - Print the current simulation time.
|
||
trace - Control statement tracing (on/off) when the code is instrumented.
|
||
where - Show current scope, and scope hierarchy stack.
|
||
|
||
If the command name starts with a '$' character, it
|
||
is taken to be the name of a system task, and a call is
|
||
built up and executed. For example, "$display foo" will
|
||
call the function as $display(foo).
|
||
</pre></div>
|
||
</div>
|
||
<p>You can also enter interactive mode at the terminal by interrupting the
|
||
execution with a “^C” (Control-C) character. The vvp engine catches the
|
||
terminal interrupt and drops you into the interactive prompt:</p>
|
||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>^C** VVP Stop(0) **
|
||
** Flushing output streams.
|
||
** Current simulation time is 533928600 ticks.
|
||
>
|
||
</pre></div>
|
||
</div>
|
||
<p>This could be useful if you suspect that your simulation is stuck in
|
||
an infinite loop and you want to rummage around and see what’s going on.</p>
|
||
<p>And finally, you can pass the “-s” command line flag to vvp to tell it
|
||
to execute “$stop” at the beginning of the simulation, before any other
|
||
events are executed. This may be useful as a way to manually set up some
|
||
details about the simulation.</p>
|
||
</section>
|
||
<section id="browsing-the-design">
|
||
<h2>Browsing the Design<a class="headerlink" href="#browsing-the-design" title="Link to this heading">¶</a></h2>
|
||
<p>Now that you are in the interactive prompt, you can browse
|
||
around the design:</p>
|
||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> ls
|
||
2 items in this scope:
|
||
package : $unit
|
||
module : main
|
||
> cd main
|
||
> ls
|
||
3 items in this scope:
|
||
reg : foo[2:0]
|
||
module : foo_clock
|
||
net : clk
|
||
> where
|
||
module main
|
||
> $display foo
|
||
1
|
||
> cd foo_clock
|
||
> where
|
||
module foo_clock
|
||
module main
|
||
> ls
|
||
2 items in this scope:
|
||
port : clock -- output
|
||
reg : clock
|
||
</pre></div>
|
||
</div>
|
||
<p>In the above example, the ‘cd’ and ‘pop’ commands descend into a scope
|
||
or pop back up a scope level. The ‘where’ command shows the scope stack,
|
||
and the ‘ls’ command lists the items present in the scope. With these
|
||
commands, one can browse freely throughout the design scope hierarchy.</p>
|
||
<p>It is also possible to call system tasks within the debug mode. The call
|
||
to the “$display” function is an example of this. In general, any system
|
||
task can be invoked, in the current context, with the objects that are
|
||
included on the command line passed as arguments. The arguments can be
|
||
variables or nets, and various kinds of literals:</p>
|
||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> ls
|
||
2 items in this scope:
|
||
port : clock -- output
|
||
reg : clock
|
||
> $display "Hello, World! " 10 " " clock
|
||
Hello, World! 10 1
|
||
</pre></div>
|
||
</div>
|
||
<p>This is a great way to call custom system tasks as well. And system task
|
||
that vvp knows about can be invoked this way.</p>
|
||
</section>
|
||
<section id="leave-interactive-mode">
|
||
<h2>Leave Interactive Mode<a class="headerlink" href="#leave-interactive-mode" title="Link to this heading">¶</a></h2>
|
||
<p>After you are done probing around in the interactive mode, you can
|
||
resume the simulation, or termimate execution. Resume the simulation
|
||
with the “cont” command, and terminate the simulation with the
|
||
“finish” command. The latter is the same as executing the
|
||
“$finish” system task.</p>
|
||
</section>
|
||
</section>
|
||
|
||
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||
<div class="sphinxsidebarwrapper">
|
||
<h1 class="logo"><a href="../index.html">Icarus Verilog</a></h1>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<h3>Navigation</h3>
|
||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||
<ul class="current">
|
||
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Icarus Verilog Usage</a><ul class="current">
|
||
<li class="toctree-l2"><a class="reference internal" href="installation.html">Installation Guide</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="getting_started.html">Getting Started With Icarus Verilog</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="simulation.html">Simulation Using Icarus Verilog</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="command_line_flags.html">iverilog Command Line Flags</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="command_files.html">Command File Format</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="verilog_attributes.html">Verilog Attributes</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="ivlpp_flags.html">IVLPP - IVL Preprocessor</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="vvp_flags.html">VVP Command Line Flags</a></li>
|
||
<li class="toctree-l2 current"><a class="current reference internal" href="#">VVP Interactive Mode</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="vvp_library.html">VVP as a library</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="vhdlpp_flags.html">vhdlpp Command Line Flags</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="gtkwave.html">Waveforms With GTKWave</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="vpi.html">Using VPI</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="icarus_verilog_extensions.html">Icarus Verilog Extensions</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="icarus_verilog_quirks.html">Icarus Verilog Quirks</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="reporting_issues.html">Reporting Issues</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../targets/index.html">The Icarus Verilog Targets</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../developer/index.html">Icarus Verilog Developer Support</a></li>
|
||
</ul>
|
||
|
||
<div class="relations">
|
||
<h3>Related Topics</h3>
|
||
<ul>
|
||
<li><a href="../index.html">Documentation overview</a><ul>
|
||
<li><a href="index.html">Icarus Verilog Usage</a><ul>
|
||
<li>Previous: <a href="vvp_flags.html" title="previous chapter">VVP Command Line Flags</a></li>
|
||
<li>Next: <a href="vvp_library.html" title="next chapter">VVP as a library</a></li>
|
||
</ul></li>
|
||
</ul></li>
|
||
</ul>
|
||
</div>
|
||
<div id="searchbox" style="display: none" role="search">
|
||
<h3 id="searchlabel">Quick search</h3>
|
||
<div class="searchformwrapper">
|
||
<form class="search" action="../search.html" method="get">
|
||
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
||
<input type="submit" value="Go" />
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<script>document.getElementById('searchbox').style.display = "block"</script>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="clearer"></div>
|
||
</div>
|
||
<div class="footer">
|
||
©2024-2025, Stephen Williams.
|
||
|
||
|
|
||
Powered by <a href="http://sphinx-doc.org/">Sphinx 7.2.6</a>
|
||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||
|
||
|
|
||
<a href="../_sources/usage/vvp_debug.rst.txt"
|
||
rel="nofollow">Page source</a>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
</body>
|
||
</html> |