File: mingw.txt

package info (click to toggle)
verilog 0.8-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 7,212 kB
  • ctags: 7,045
  • sloc: cpp: 42,249; ansic: 26,293; yacc: 3,452; sh: 2,773; makefile: 1,108
file content (295 lines) | stat: -rw-r--r-- 10,902 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295


MINGW PORT OF ICARUS VERILOG

    Copyright 2003 Stephen Williams  <steve@icarus.com>


Icarus Verilog source can be compiled with the mingw C/C++ compilers
to get a Windows binary that does not require the POSIX compatibility
cruft of the Cygwin.dll library. The resulting program can be run with
or without Cygwin, so this is the preferred Windows distribution form.
The configure scripts automatically detect that the compilers in use
are the mingw compilers and will configure the Makefiles appropriately.

However, the mingw tools do not include all the other tools around the
compiler, including the shell interpreter for the configure script,
bison, flex, gperf, etc. Therefore, you still need Cygwin to compile
Icarus Verilog, even if you don't need the Cygwin compilers. There are
also a few precompiled library prerequisites that you need.

* Some Preliminary Comments

The Windows port of Icarus Verilog is the most difficult of all the
ports. The Windows system off the shelf is completely stripped, devoid
of any support for software development. Everything needed to compile
Icarus Verilog must be collected from various sources and stitched
together by hand. Normal human beings with a basic understanding of
software development can do this, but some patience (and access to the
Internet) is required. You may choose to print these instructions.

I have no plans to intentionally support MSVC++ compilation. Don't ask.

* Summary of Prerequisites

This is a brief list of prerequisite packages, along with the URL
where each can be found. In most cases, the specific version is not
critical, but these are the versions I use.

     Cygwin                     <http://cygwin.com>
     Mingw32-2.0.0              <http://www.mingw.org>
     readline-4.2-20010727.zip  <http://mingwrep.sourceforge.net>
     bzip2-1.0.2-bin.zip        <http://gnuwin32.sourceforge.net>
     zlib-1.1.4-bin.zip         <http://gnuwin32.sourceforge.net>
     bzip2-1.0.2-lib.zip        <http://gnuwin32.sourceforge.net>
     zlib-1.1.4-lib.zip         <http://gnuwin32.sourceforge.net>

The above table lists the packages required. It is convenient to
install them in the above order. Many of these packages are also
collected into the directory:

     <ftp://icarus.com/pub/eda/verilog/win32-build-parts>

Incidentally, besides Mingw32, none of these packages are needed after
installation of Icarus Verilog is complete. These are only needed to
build the compiler. The Mingw32 package can be used to compile VPI
modules if you choose.

* Install Cygwin

So, step 1 is "Download and Install Cygwin." See the web page
http://www.cygwin.com for instructions and the files to do
this. Cygwin *is* a kool package, and is worth having anyhow. There is
a convenient setup program that you download first. You execute the
setup program, and that prompts you to select the package you want.

You need in particular the Cygwin base, bison (see notes) flex, make
and gperf. If you are compiling from CVS, you also need cvs, rcs and
automake packages. You will also need tar and gunzip, but these are
hard to not install. I recommend installing the "which" package as
well. Beyond the basics, be sure to install these Cygwin packages:

      bison        (*not* 1.875. See Notes.)
      flex
      ghostscript  (makes the documentation)
      gperf
      gzip
      make
      strip
      tar          (tar and gunzip for unpacking the source)
      unzip        (For unpacking zip compressed packages.)
      which

    NOTES:
      bison-1.875 is broken, it generates invalid C/C++ code. You
      don't want that version for anything you do. If you have that
      version (use "bison -V" to check the version) then use the
      Cygwin setup program to get a different version. I've downgraded
      to 1.75 and couldn't be happier. In fact, a whole host of insane
      bison bugs can be avoided that way.

      There is a mingw32 runtime package included in the Cygwin
      distribution. You do *not* need that, as you will be getting
      everything from the mingw32 distribution itself.

Other then the install of mingw32, most of the remaining steps are
best done in a Cygwin window. When you installed Cygwin, a start menu
entry was created to allow you to start up the Cygwin window. I'll use
the string "$ " to represent a command prompt in this window, because
that is the usual bash prompt.

* Install Mingw32

The obvious step 2, then, is install the mingw compilers. These can be
found at the web page <http://www.mingw.org>. The Mingw-2.x.x version
comes prepackaged in a convenient, Windows style, installer. I
recommend you download this package instead of picking and choosing
bits.

When I install Mingw32 (using the installer) I typically set a
destination directory of d:\mingw-2.0.0 or the like. You will be using
that path later.

    NOTES:
      If you intend to compile VPI modules for Icarus Verilog, you
      need Mingw32, even if you are using a precompiled binary. VPI
      modules only require Mingw32, and none of the other libraries.

* Install Mingw32 Packages

There is a collection of precompiled libraries and add-on packages
that are intended for use with the Mingw32 compiler. These do not come
with simplified Windows installers, but they are pretty easy to
install by hand. Icarus Verilog uses the readline-4.2 package from
that collection.

Since I installed Mingw32 in d:\mingw-2.0.0, I also created a
Mingw-packages directory called d:\mingw-packages. The install, then,
is as easy as this:

  <cygwin shell>
    $ cd d:/mingw-packages
    $ unzip readline-4.2-20010727.zip
        [lots of inflating...]

Done. On to the next packages.

* Install GnuWin32 Packages

The GnuWin32 project is a collections of open source programs and
libraries ported to Windows. These also work well with the Mingw
compiler, and in fact Icarus Verilog uses a few libraries from this
collection.

You will need these gnuwin32 packages to compile Icarus Verilog:

  <http://gnuwin32.sourceforge.net>
    bzip2-1.0.2-lib.zip
    bzip2-1.0.2-bin.zip
    zlib-1.1.4-lib.zip
    zlib-1.1.4-bin.zip

I suggest creating a common directory for holding all your gnuwin32
packages. I use D:\gnuwin32.

After downloading these packages, put the .zip files in your gnuwin32
directory and install them like so:

  <cygwin shell>
    $ cd d:/gnuwin32
    $ unzip bzip2-1.0.2-bin.zip
       [lots of inflating...]
    $ unzip bzip2-1.0.2-lib.zip
       [lots of inflating...]
    $ unzip zlib-1.1.4-bin.zip
       [lots of inflating...]
    $ unzip zlib-1.1.4-lib.zip
       [lots of inflating...]

Done.

* Unpack Icarus Verilog source

Unpack the compressed tar file (.tar.gz) of the source with a command
like this:

	$ gunzip -d verilog-20030303.tar.gz | tar xvf -

This will create a directory "verilog-20030303" that contains all the
source for Icarus Verilog. Descend into that directory, as that is
where we will work from now on.

	$ cd verilog-20030303

    NOTE:
      The exact name of the file will vary according to the
      snapshot. The 20030303 name is only an example.

* Select the mingw compilers

In your cygwin window, if you type "which c++" you might get the
response path "/usr/bin/c++" which is the cygwin compiler. This is not
the one we want to use, however. Tell the shell where the mingw
compilers are by setting the search path like so:

	$ PATH=/cygdrive/d/mingw-2.0.0/bin:$PATH

This assumes that you installed mingw in D:\mingw-2.0.0. The actual
programs are in the bin directory under the root. After this command,
check that you are now getting the right compilers with this "which"
command:

	$ which c++
	/cygdrive/d/mingw-2.0.0/bin/c++

Good!

* Configure Icarus Verilog

Now we are all set to configure and compile Icarus Verilog. Choose a
destination path where you will want to install the binaries. I chose
on my system the directory "D:\iverilog". This choice is not
permanent, so don't get too much angst over it. Just choose a name
without white space.

Now, configure the source to make the makefiles and configuration
details. Run these commands:

	$ CPPFLAGS="-Id:/gnuwin32/include -Id:/mingw-packages/include"
	$ LDFLAGS="-Ld:/gnuwin32/lib -Ld:/mingw-packages/include"
	$ export CPPFLAGS LDFLAGS
	$ ./configure --prefix=d:/iverilog

    NOTES:
      The CPPFLAGS and LDFLAGS variables tell configure where
      the gnuwin32 packages are. The configure program will
      write these values into the Makefiles, so you only need to
      keep these variables long enough for the configure program
      to work.

      Your PATH variable was set in the previous step.

      Use forward slashes as directory characters. All the various
      tools prefer the forward slash.

Substitute your chosen directory for the prefix. This will cause the
makefiles to build and the source code to configure. The configure
program will detect that this is a mingw environment and set things up
to build properly.

(For a prefix, use the drive letter notation; the mingw compiled parts
require it, and the Cygwin tools should be able to handle it. You may
need to check or upgrade your Cygwin installation if this causes
problems for you.)


* Compile Icarus Verilog

This, believe it or not, should be the easy part:

	$ make

It could take a while. Now is a good time to go get some coffee or
take a tea break.


* Install Icarus Verilog

If the compile ran OK, then next you install Icarus Verilog in the
directory you have chosen. When you are ready, install like this:

	$ make install

This is part of what the configure program did for you. The Makefiles
now know to put the files under the D:\iverilog directory (or whatever
directory you chose) and away you go.

You may find that you need to put some of the prerequisite DLLs into
the d:\iverilog\bin directory. These include:

      d:\mingw-2.0.0\bin\mingw10.dll
      d:\mingw-packages\bin\libreadline.dll
      d:\gnuwin32\bin\bzip2.dll
      d:\gnuwin32\bin\zlib.dll

If you already have these in your Windows path (i.e. your system32
directory) then you do not need to copy them into the iverilog
directory. However, prepackaged Icarus Verilog binaries include these
files.

* Running Icarus Verilog

Finally, put the D:\iverilog\bin directory in your Windows path, and
you should be able to run the iverilog and vvp commands to your
heart's content.

Currently, the iverilog.exe uses the path to itself to locate the
libraries and modules associated with itself. In other words, if you
execute the D:\iverilog\bin\iverilog.exe program, it will locate its
subparts in the D:\iverilog directory and subdirectories below
that. This means you can move the Icarus Verilog installation by
simply moving the root directory and all its contents.

The vvp.pdf and iverilog.pdf files document the main commands. View
these with Acrobat reader, or any other viewer capable of displaying
PDF format files.