1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6 <link rel=
"stylesheet" media=
"screen" type=
"text/css" href=
"./style.css" />
7 <link rel=
"stylesheet" media=
"screen" type=
"text/css" href=
"./design.css" />
8 <link rel=
"stylesheet" media=
"print" type=
"text/css" href=
"./print.css" />
10 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8" />
15 <h1 class=
"sectionedit1160"><a name=
"fpga_loadable_code_generator_for_icarus_verilog" id=
"fpga_loadable_code_generator_for_icarus_verilog">FPGA Loadable Code Generator for Icarus Verilog
</a></h1>
17 <pre class=
"code">FPGA LOADABLE CODE GENERATOR FOR Icarus Verilog
19 Copyright
2001 Stephen Williams
20 $Id: fpga.txt,v
1.12 2005/
09/
19 21:
45:
36 steve Exp $
22 The FPGA code generator supports a variety of FPGA devices, writing
23 XNF or EDIF depending on the target. You can select the architecture
24 of the device, and the detailed part name. The architecture is used to
25 select library primitives, and the detailed part name is written into
26 the generated file for the use of downstream tools.
28 INVOKING THE FPGA TARGET
30 The code generator is invoked with the -tfpga flag to iverilog. It
31 understands the part= and the arch= parameters, which can be set with
32 the -p flag of iverilog:
34 iverilog -parch=virtex -ppart=v50-pq240-
6 -tfpga foo.vl
36 This example selects the Virtex architecture, and give the detailed
37 part number as v50-pq240-
6. The output is written into a.out unless a
38 different output file is specified with the -o flag.
40 The following is a list of architecture types that this code generator
45 This is a device independent format, where the gates are device types
46 as defined by the LPM
2 1 0 specification. Some backend tools may take
47 this format, or users may write interface libraries to connect these
48 netlists to the device in question.
50 * arch=generic-edif (obsolete)
52 This is generic EDIF code. It doesn
't necessarily work because the
53 external library is not available to the code generator. But, what it
54 does is generate generic style gates that a portability library can
55 map to target gates if desired.
57 * arch=generic-xnf (obsolete)
59 If this is selected, then the output is formatted as an XNF file,
60 suitable for most any type of device. The devices that it emits
61 are generic devices from the unified library. Some devices are macros,
62 you may need to further resolve the generated XNF to get working
67 If this is selected, then the output is formatted as an EDIF
200 file,
68 suitable for Virtex class devices. This is supposed to know that you
69 are targeting a Virtex part, so can generate primitives instead of
70 using external macros. It includes the VIRTEX internal library, and
71 should work properly for any Virtex part.
75 If this is selected, then the output is EDIF
2 0 0 suitable for
76 Virtex-II and Virtex-II Pro devices. It uses the VIRTEX2 library, but
77 is very similar to the Virtex target.
81 NOTE: As parts are moved over to EDIF format, XNF support will be
82 phased out. Current Xilinx implementation tools will accept EDIF
83 format files even for the older parts, and non-Xilinx implementation
84 tools accept nothing else.
86 When the output format is XNF, the code generator will generate
"SIG
"
87 records for the signals that are ports of the root module. The name is
88 declared as an external pin that this macro makes available.
90 The name given to the macro pin is generated from the base name of the
91 signal. If the signal is one bit wide, then the pin name is exactly
92 the module port name. If the port is a vector, then the pin number is
93 given as a vector. For example, the module:
101 leads to these SIG, records:
103 SIG, main/out, PIN=out
104 SIG, main/in
<2>, PIN=in2
105 SIG, main/in
<1>, PIN=in1
106 SIG, main/in
<0>, PIN=in0
111 The EDIF format is more explicit about the interface into an EDIF
112 file. The code generator uses that control to generate an explicit
113 interface definition into the design. (This is *not* the same as the
114 PADS of a part.) The generated EDIF interface section contains port
115 definitions, including the proper direction marks.
117 With the (rename ...) s-exp in EDIF, it is possible to assign
118 arbitrary text to port names. The EDIF code generator therefore does
119 not resort to the mangling that is needed for the XNF target. The base
120 name of the signal that is an input or output is used as the name of
121 the port, complete with the proper case.
123 However, since the ports are single bit ports, the name of vectors
124 includes the string
"[
0]
" where the number is the bit number. For
128 module main(out, in);
141 Target tools, including Xilinx Foundation tools, understand the []
142 characters in the name and recollect the signals into a proper bus
143 when presenting the vector to the user.
146 PADS AND PIN ASSIGNMENT
148 The ports of a root module may be assigned to specific pins, or to a
149 generic pad. If a signal (that is a port) has a PAD attribute, then
150 the value of that attribute is a list of locations, one for each bit
151 of the signal, that specifies the pin for each bit of the signal. For
154 module main( (* PAD =
"P10
" *) output out,
155 (* PAD =
"P20,P21,P22
" *) input [
2:
0] in);
161 In this example, port ``out
'' is assigned to pin
10, and port ``in
''
162 is assigned to pins
20-
22. If the architecture supports it, a pin
163 number of
0 means let the back end tools choose a pin. The format of
164 the pin number depends on the architecture family being targeted, so
165 for example Xilinx family devices take the name that is associated
166 with the
"LOC
" attribute.
168 NOTE: If a module port is assigned to a pin (and therefore attached to
169 a PAD) then it is *not* connected to a port of the EDIF file. This is
170 because the PAD (and possibly IBUF or OBUF) would become an extra
171 driver to the port. An error.
176 The code generator supports the
"cellref
" attribute attached to logic
177 devices to cause specific device types be generated, instead of the
178 usual device that the code generator might generate. For example, to
179 get a clock buffer out of a Verilog buf:
181 buf my_gbuf(out, in);
182 $attribute(my_buf,
"cellref
",
"GBUF:O,I
");
184 The
"cellref
" attribute tells the code generator to use the given
185 cell. The syntax of the value is:
187 <cell type
>:
<pin name
>,...
189 The cell type is the name of the library part to use. The pin names
190 are the names of the type in the library, in the order that the logic
191 device pins are connected.
194 COMPILING WITH XILINX FOUNDATION
196 Compile a single-file design with command line tools like so:
198 % iverilog -parch=virtex -o foo.edf foo.vl
199 % edif2ngd foo.edf foo.ngo
200 % ngdbuild -p v50-pq240 foo.ngo foo.ngd
201 % map -o map.ncd foo.ngd
202 % par -w map.ncd foo.ncd
206 Revision
1.12 2005/
09/
19 21:
45:
36 steve
207 Spelling patches from Larry.
209 Revision
1.11 2003/
08/
07 05:
17:
34 steve
210 Add arch=lpm to the documentation.
212 Revision
1.10 2003/
07/
04 03:
57:
19 steve
213 Allow attributes on Verilog
2001 port declarations.
215 Revision
1.9 2003/
07/
04 01:
08:
03 steve
216 PAD attribute can be used to assign pins.
218 Revision
1.8 2003/
07/
02 00:
26:
49 steve
219 Fix spelling of part= flag.
221 Revision
1.7 2003/
03/
24 02:
28:
38 steve
222 Document the virtex2 architecture.
224 Revision
1.6 2003/
03/
24 00:
47:
54 steve
225 Add new virtex2 architecture family, and
226 also the new edif.h EDIF management functions.
228 Revision
1.5 2002/
04/
30 04:
26:
42 steve
231 Revision
1.4 2001/
09/
16 22:
26:
47 steve
232 Support the cellref attribute.
234 Revision
1.3 2001/
09/
16 01:
48:
16 steve
235 Suppor the PAD attribute on signals.
237 Revision
1.2 2001/
09/
06 04:
28:
40 steve
238 Separate the virtex and generic-edif code generators.
240 Revision
1.1 2001/
09/
02 23:
58:
49 steve
241 Add documentation for the code generator.