gaf: Fix memory leak
[geda-gaf.git] / docs / wiki / geda-icarus_quick_start.html
blobd6b7a66bcedafe8be6439ab8c5676bae09ab53a2
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html>
4 <head>
5 <link rel="stylesheet" media="screen" type="text/css" href="./style.css" />
6 <link rel="stylesheet" media="screen" type="text/css" href="./design.css" />
7 <link rel="stylesheet" media="print" type="text/css" href="./print.css" />
9 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10 </head>
11 <body>
13 <p>
14 <a href="start.html" class="wikilink1" title="start.html">gEDA</a> &gt;&gt; <a href="geda-documentation.html" class="wikilink1" title="geda-documentation.html">Documentation</a> &gt;&gt; <a href="geda-icarus.html" class="wikilink1" title="geda-icarus.html">Icarus Verilog</a> &gt;&gt; <a href="geda-icarus_quick_start.txt.html" class="wikilink2" title="geda-icarus_quick_start.txt.html">Getting Started</a>
15 </p>
17 <h1 id="gettingstartedwithicarusverilog">Getting Started with Icarus Verilog</h1>
18 <div class="level1">
20 <p>
21 Icarus Verilog is a Verilog compiler. It is suitable for use as a
22 simulator, and, to some degree, synthesizer. Icarus Verilog runs under
23 Linux and a variety of UNIX systems, as well as Windows as a command
24 line tool, so the instructions are generally applicable to all
25 environments. Note that this is only a quick start. For more detailed
26 documentation, see the manual page for the iverilog command.
27 </p>
29 </div>
31 <h2 id="helloworld">Hello, World!</h2>
32 <div class="level2">
34 <p>
35 The first thing you want to do as a user is learn how to compile and
36 execute even the most trivial design. For the purposes of simulation,
37 we use as our example <em>the</em> most trivial simulation:
38 </p>
39 <dl class="code">
40 <dt><a href="/./doku.php?do=export_code&amp;id=:geda:icarus_quick_start.txt&amp;codeblock=0" title="Download Snippet" class="mediafile mf_vl_">&quot;hello.vl&quot;</a></dt>
41 <dd><pre class="code verilog"><span class="kw1">module</span> main<span class="sy0">;</span>
42 &nbsp;
43 <span class="kw1">initial</span>
44 <span class="kw1">begin</span>
45 <span class="kw2">$display</span><span class="br0">&#40;</span><span class="st0">&quot;Hello, World&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
46 <span class="kw2">$finish</span> <span class="sy0">;</span>
47 <span class="kw1">end</span>
48 &nbsp;
49 <span class="kw1">endmodule</span></pre>
50 </dd></dl>
52 <p>
53 Download this program,
54 or copy it from the Icarus Verilog examples directory.
55 Next, compile it with a command like this:
56 </p>
57 <pre class="code">% iverilog -o hello hello.vl</pre>
59 <p>
60 The results of this compile are placed into the file <code>hello</code>, as the
61 <code>-o</code> flag tells the compiler where to place the compiled result. Next,
62 execute the compiled program like so:
63 </p>
64 <pre class="code">% vvp hello
65 Hello, World</pre>
67 <p>
68 And there it is, the program has been executed. So what happened? The
69 first step, the <code>iverilog</code> command, read and interpreted the source
70 file, then generated a compiled result. The compiled form may be
71 selected by command line switches, but the default form is the VVP
72 format, which is actually run by the <code>vvp</code> command.
73 </p>
75 <p>
76 The <code>iverilog</code> and <code>vvp</code> commands are the only commands that users
77 use to invoke Icarus Verilog. What the compiler actually does is
78 controlled by command line switches. In our little example, we asked
79 the compiler to compile the source program to the default vvp form,
80 which is in turn executed by the vvp program.
81 </p>
83 </div>
85 <h2 id="windowsinstall">Windows Install</h2>
86 <div class="level2">
88 <p>
89 The easiest way to install under Windows is to get a precompiled
90 installer for the version you wish to install. Icarus Verilog is
91 distributed for Windows users as a self-installing <code>.exe</code>. Just execute
92 the installer and follow the instructions. During the install, take
93 note of the directory where the program is installed: for example,
94 <code>C:\iverilog</code> is a good place to install.
95 </p>
97 <p>
98 Once the binary is installed, you need to add the bin directory to
99 your execution path. The executables you need are in <code>C:\iverilog\bin</code>,
100 where the <code>C:\iverilog</code> part is actually the root of where you
101 installed the package. The programs are in the bin subdirectory. Put
102 this directory in your <code>PATH</code> environment variable, and the above
103 commands become accessible to you at the command line prompt, or even
104 in batch files.
105 </p>
107 </div>
109 <h2 id="linuxinstall">Linux Install</h2>
110 <div class="level2">
113 Under Linux, the install is even easier. For RedHat and Mandrake based
114 systems, there is the appropriate RPM file. Just install the package
115 with the <code>rpm -U &lt;file&gt;</code> command. Debian users should get Icarus
116 Verilog packages from the main Debian software site.
117 </p>
119 </div>
121 <h2 id="installfromsource">Install From Source</h2>
122 <div class="level2">
125 In this case, see <a href="geda-icarus_readme.html" class="wikilink1" title="geda-icarus_readme.html">The Icarus Verilog Compilation System</a>
126 and other documentation that comes with the source.
127 </p>
129 </div>
130 </body>
131 </html>