2 Icarus Verilog Extensions
4 Icarus Verilog supports certain extensions to the baseline IEEE1364
5 standard. Some of these are picked from extended variants of the
6 language, such as SystemVerilog, and some are expressions of internal
7 behavior of Icarus Verilog, made available as a tool debugging aid.
9 * Builtin System Functions
11 ** Extended Verilog Data Types
13 This feature is turned off if the generation flag "-g" is set to other
14 then the default "2x". For example, "iverilog -g2x" enables extended
15 data types, and "iverilog -g2" disables them.
17 Icarus Verilog adds support for extended data types. This extended
18 type syntax is based on a proposal by Cadence Design Systems,
19 originally as an update to the IEEE1364. That original proposal has
20 apparently been absorbed by the IEEE1800 SystemVerilog
21 standard. Icarus Verilog currently only takes the new primitive types
24 Extended data types separates the concept of net/variable from the
25 data type. Both nets and variables can declared with any data
26 type. The primitive types available are:
28 logic - The familiar 0, 1, x and z, optionally with strength.
29 bool - Limited to only 0 and 1
30 real - 64bit real values
32 Nets with logic type may have multiple drivers with strength, and the
33 value is resolved the usual way. Only logic values may be driven to
34 logic nets, so bool values driven onto logic nets are implicitly
37 Nets with any other type may not have multiple drivers. The compiler
38 should detect the multiple drivers and report an error.
42 The declaration of a net is extended to include the type of the wire,
45 wire <type> <wire-assignment-list>... ;
47 The <type>, if omitted, is taken to be logic. The "wire" can be any of
48 the net keywords. Wires can be logic, bool, real, or vectors of logic
49 or bool. Some valid examples:
56 The declarations of variables is similar. The "reg" keyword is used to
57 specify that this is a variable. Variables can have the same data
62 Module and task ports in standard verilog are restricted to logic
63 types. This extension removes that restriction, allowing any type to
64 pass through the port consistent with the continuous assignment
65 connectivity that is implied by the type.
69 Expressions in the face of real values is covered by the baseline
72 The bool type supports the same operators as the logic type, with the
73 obvious differences imposed by the limited domain.
75 Comparison operators (not case compare) return logic if either of
76 their operands is logic. If both are bool or real (including mix of
77 bool and real) then the result is bool. This is because comparison of
78 bools and reals always return exactly true or false.
80 Case comparison returns bool. This differs from baseline Verilog,
81 which strictly speaking returns a logic, but only 0 or 1 values.
83 All the arithmetic operators return bool if both of their operands are
84 bool or real. Otherwise, they return logic.