File: README.v2cc

package info (click to toggle)
freehdl 0.0.8-2.2
  • links: PTS
  • area: main
  • in suites: buster, sid, stretch
  • size: 8,632 kB
  • ctags: 10,443
  • sloc: cpp: 45,275; sh: 11,405; yacc: 4,206; ansic: 2,026; lex: 486; perl: 430; makefile: 390; tcl: 100
file content (314 lines) | stat: -rw-r--r-- 11,137 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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
0. Table of content
-------------------

This document is organized as follows:

	1. Running the compiler
	1.1 Compiling ieee.std_logic_1164 and ieee.numeric_std
	1.2 Compiler options
	2. Supported VHDL subset
	3. Supported simulation commands 
	3.1 Controlling simulation from the command line 
	4. Bug reports


1. Running the compiler
-----------------------

Change to subdirectory "v2cc". Here you will find a simple perl script
"gvhdl" which performs all necessary steps in order to create a
simulation binary from a VHDL source file. The command

    %./gvhdl y.vhdl

compiles "y.vhdl" into a executable "y". Type
   
    %./y

to start the simulator. For more info on how to control the simulator
see section 3.

Note that all VHDL source files must end with ".vhdl".

If you would like to build a simulator for a model consisting of
several modules (entity + architecture or package + package body) you
may put all the modules into a single file and compile it as 
described above. The top level module should be placed at the end of 
the file.

Another option is to create a separate file for each module. The files
should be named after the entity/package it stores. Then, each module
must be compiled separately:

    %./gvhdl -c <module_1>.vhdl
    %./gvhdl -c <module_2>.vhdl
    ...
    %./gvhdl -c <module_1>.vhdl

Finally, the top level module is compiled and linked via:

    %./gvhdl <top_module>.vhdl <module_1>.o ... <module_n>.o


1.1 Compiling ieee.std_logic_1164 and ieee.numeric_std
------------------------------------------------------

If package ieee.std_logic_1164 or ieee.numeric_std are used within a
design then the corresponding object files must be added when
compiling the top level design. I.e., when compiling the top level
module of your design add "../ieee/numeric_std.o
../ieee/std_logic_1164.o" (order is important!) to the list of modules
to link (or just "../ieee/std_logic_1164.o" if you do not use
numeric_std):

    %./gvhdl <top_module>.vhdl <module_1>.o ... <module_n>.o \
	../ieee/numeric_std.o ../ieee/std_logic_1164.o

Make sure to list numeric_std.o before std_logic_1164.o. Otherwise,
the link stage may fail!

As an alternative method you may use the "--libieee" option to add
all ieee libraries (that currently come with the compiler).

Directory "v2cc" contains two example models "top.vhdl" and
"model4.vhdl" which make use of std_logic_1164 and numeric_std. To
compile "top.vhdl" execute:

    %./gvhdl -c adder.vhdl
    %./gvhdl top.vhdl adder.o ../ieee/std_logic_1164.o

or 

    %./gvhdl -c adder.vhdl
    %./gvhdl top.vhdl adder.o --libieee


To compile "model4.vhdl" run

    %./gvhdl model4.vhdl ../ieee/std_logic_1164.o ../ieee/numeric_std.o

or simply

    %./gvhdl model4.vhdl --libieee


1.2 Compiler options
--------------------

gvhdl now accepts the following options:

    -g : adds debugging info (i.e., the simulator can be debugged
        using VHDL source file line numbers). This also enables
        outputting some stack trace info in case of an runtime error.
    -G : same as -g but no VHDL source file and line number info
        is added to the executable (this is to support debugging 
	code generated by the compiler).
    -c : compile only, do not link
    -l <lib_name> : compile design into library <lib_name>.
    -L <vhdl_lib> : path to VHDL library root directory. Within this
	directory the compiler search for a file named v2cc.libs. 
	v2cc.libs translates library unit names to directories.
	Note that more than one vhdl_lib may be provided
	(see also section "VHDL library mapping").  
    --libieee : add ieee libraries (std:logic_1164, numeric_std, ...)
	to executable.

All other options not directly recognized by gvhdl are forwarded to
g++.  Hence, in order to optimize the generated code for speed add
"-O3" to the list of gvhdl options! E.g.,

    %../v2cc/gvhdl -O3 -c -l ieee std_logic_1164.vhdl
    %../v2cc/gvhdl -O3 -c -l ieee numeric_std.vhdl

executed within subdir "ieee" will create speed optimized versions of 
std_logic_1164 and numeric_std. However, note that the code of these 
packages is generated form the the ORIGINAL ieee VHDL source. Currently, 
there are no special hand optimized versions of it (this is one of the 
tasks to be done in the future).


1.3 VHDL library mapping
--------------------------------

In order to support mapping from VHDL unit names to directiores, a set
of v2cc.libs files may be used. The directory where a v2cc.libs file
is stored is passed over to the compiler using the "-L <vhdl_lib>"
compiler switch. Note that several vhdl_lib directores may be
specified.

The content of a v2cc.libs file looks like

v2cc_mapfile 0
work : vhdl
dummy : /home/edwin/work/test/dummy

The first line ist just used to check for a vaild vhdl mapping
file. The next two lines associate

- VHDL library "work" with subdirectory "vhdl" and
- VHDL library "dummy" with subdirectory /home/edwin/work/test/dummy.

If the subdir path does not start with "/" then it is relative to the
directory the corresponding v2cc.libs resides in. Here, VHDL library
"work" is mapped to "<vhdl_lib>/vhdl". If a model or package named
"comp" is referenced then the compiler will look into the directores
of all VHDL libraries that are currently visible and searches for a
file named "comp.vhdl".

For more details about the v2cc.libs format please read with
README.libraries.


1.3.1 Example VHDL library setup
--------------------------------

As an example assume that all VHDL libraries are mapped into subdirs
starting from root directory "/foo". Further, assume that there are
VHDL libraries named "lib1" and "lib2". They shall be mapped to subdir
"/foo/lib1_dir" and "/foo/lib2_dir". Hence, the file/directory
structure is as follows:

/foo  			<-  library root directory
/foo/v2cc.libs  	<-  mapping control file	  
/foo/lib1_dir		<-  library dir for VHDL library lib1
/foo/lib1_dir/comp1.vhdl <- file that contains VHDL model comp1
/foo/lib2_dir		<-  library dir for VHDL library lib2
/foo/lib2_dir/comp2.vhdl <- file that contains VHDL model comp2

Then, file "/foo/v2cc.libs" should contain:

v2cc_mapfile 0
lib1 : lib1_dir
lib2 : lib2_dir

In order to compile a design named comp1 (stored in file comp1.vhdl)
into VHDL library lib1 goto subdir "/foo/lib1_dir" and execute:

    %gvhdl -c -L .. -l lib1 comp1.vhdl

Note that option "-l lib1" forces the compiler to associate the model
stored in "comp1.vhdl" with VHDL library lib1.  Note further, that
the compiler switch "-L .." specifies the path to the directory where
"v2cc.libs" is stored. You may also specify an absolute path:

    %gvhdl -c -L /foo -l lib1 comp1.vhdl

Note that comp1 should reside in a file named "comp1.vhdl".

If lib2 contains a design comp2 that makes use of comp1 from lib1 then
goto "/foo/lib2_dir" and run the following command to create an
executable for model comp2:

    %gvhdl -L .. -l lib2 comp2.vhdl ../lib1_dir/comp1.o 


2. Supported VHDL subset
------------------------

Currently, FreeHDL does not support the entire VHDL'93 standard. The
following incomplete list gives an overview on what is currently (not)
supported (note that the compiler is not tested very intensively;
hence, expect to hit a lot of bugs in the compiler and simulator
system):

- Individual association of formals of composite type are currently
not supported. 

- VHDL'93 as well as VHDL'87 file support has been added.

- Shared variables are currently not supported.

- Attributes transaction, quiet, stable and delayed are
currently not supported.

- User defined attributes are currently not supported.

- Groups are currently not supported.

- Guarded signal assignments are currently not supported.

- Currently drivers cannot be switched off.



3. Supported simulation commands 
--------------------------------

After the simulator has been started a short summary of the available
commands are printed to the screen:

  c <number> : execute cycles = execute <number> simulation cycles
  n          : next = execute next simulation cycle
  q          : quit = quit simulation
  r <time>   : run = execute simulation for <time>
  d          : dump = dump signals
  doff       : dump off = stop dumping signals
  don        : dump on = continue dumping signals
  s          : show = show signal values
  dv         : dump var  = dump a signal from the signal lists
  ds         : dump show  = shows the list of dumped signals
  nds        : number  show  = shows the number  of dumped signals
  dc [-f <filename>] [-t <timescale> <time unit>] [-cfg <translation file>] [-q]
                : configures dump process 

Note that signals are dumped into a file (default file name is
"wave.dmp") in VCD format. This file format should be accepted by each
VCD waveform viewer. The file name is set to "wave.dmp" but may be
changed using "dc -f <new_file_name>". However, make sure to execute 
"dc -f ..." before executing "d".

Here is a small protocol of a simulation run (user input is marked
with "<--"):

   %./y
Available commands:
  c <number> : execute cycles = execute <number> simulation cycles
  n          : next = execute next simulation cycle
  q          : quit = quit simulation
  r <time>   : run = execute simulation for <time>
  d          : dump = dump signals
  doff       : dump off = stop dumping signals
  don        : dump on = continue dumping signals
  s          : show = show signal values
  dv         : dump var  = dump a signal from the signal lists
  ds         : dump show  = shows the list of dumped signals
  nds        : number  show  = shows the number  of dumped signals
  dc [-f <filename>] [-t <timescale> <time unit>] [-cfg <translation file>] [-q]
                : configures dump process 
Simulation time = 0 fs + 0d
> dc -q                              <-- suppress warnings/verbose messages
> d                                  <-- dump all signals into wave.dmp
> run 100 ns                         <-- run for 100 ns
Run simulation for which time span? 
Simulating model to time 100 ns
Simulation time = 100 ns + 0d

106 processes were executed.
138 transaction were created.
> quit                               <-- quit simulation


3.1 Controlling simulation from the command line 
------------------------------------------------

Simulation can be controlled via the command line parameter '-cmd
"cmd1; cmd2; ..."' where 'cmd1', 'cmd2', ... are simulation commands
as described in the previous section. Note that each command must be
separated by ';'. E.g., executing

   %./y -cmd "d;run 1000 ns;q;"

will start simulation program 'y', dump all signals and run simulation
for 1000 ns. Finally, simulation is terminated. Actually, the last
command 'q;' is optional as the simulator automatically terminates as
soon as the last command has been executed.


4. Bug reports
--------------

Please send simulator or code generator related bug reports or
comments to Edwin Naroska <edwin@ds.e-technik.uni-dortmund.de>. If you
are not sure to what your problem is related to send your email to
Edwin as well. He will take care of forwarding your report or comment
to the appropriate recipient.