4 * Copyright (c) 1998-2006 Stephen Williams (steve@icarus.com)
6 * This source code is free software; you can redistribute it
7 * and/or modify it in source code form under the terms of the GNU
8 * General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
22 #ident "$Id: netlist.h,v 1.380 2007/06/02 03:42:13 steve Exp $"
26 * The netlist types, as described in this header file, are intended
27 * to be the output from elaboration of the source design. The design
28 * can be passed around in this form to the various stages and design
35 # include "ivl_target.h"
36 # include "pform_types.h"
39 # include "verireal.h"
40 # include "StringHeap.h"
42 # include "LineInfo.h"
73 ostream
& operator << (ostream
&o
, ivl_variable_type_t val
);
76 * A NetObj is anything that has any kind of behavior in the
77 * netlist. Nodes can be gates, registers, etc. and are linked
78 * together to form a design web.
80 * The web of nodes that makes up a circuit is held together by the
81 * Link class. There is a link for each pin. All mutually connected
82 * pins form a ring of links.
84 * A link can be INPUT, OUTPUT or PASSIVE. An input never drives the
85 * signal, and PASSIVE never receives the value of the signal. Wires
86 * are PASSIVE, for example.
88 * A NetObj also has delays specified as rise_time, fall_time and
89 * decay_time. The rise and fall time are the times to transition to 1
90 * or 0 values. The decay_time is the time needed to decay to a 'bz
91 * value, or to decay of the net is a trireg. The exact and precise
92 * interpretation of the rise/fall/decay times is typically left to
93 * the target to properly interpret.
95 class NetObj
: public Attrib
, public virtual LineInfo
{
99 // The name of the object must be a permallocated string. A
100 // lex_strings string, for example.
101 explicit NetObj(NetScope
*s
, perm_string n
, unsigned npins
);
105 const NetScope
* scope() const;
107 perm_string
name() const { return name_
; }
109 unsigned pin_count() const { return npins_
; }
111 const NetExpr
* rise_time() const { return delay1_
; }
112 const NetExpr
* fall_time() const { return delay2_
; }
113 const NetExpr
* decay_time() const { return delay3_
; }
115 void rise_time(const NetExpr
* d
) { delay1_
= d
; }
116 void fall_time(const NetExpr
* d
) { delay2_
= d
; }
117 void decay_time(const NetExpr
* d
) { delay3_
= d
; }
119 Link
&pin(unsigned idx
);
120 const Link
&pin(unsigned idx
) const;
122 void dump_node_pins(ostream
&, unsigned) const;
123 void dump_obj_attr(ostream
&, unsigned) const;
129 const unsigned npins_
;
130 const NetExpr
* delay1_
;
131 const NetExpr
* delay2_
;
132 const NetExpr
* delay3_
;
137 friend void connect(Link
&, Link
&);
138 friend void connect(Nexus
*, Link
&);
143 enum DIR { PASSIVE
, INPUT
, OUTPUT
};
145 enum strength_t
{ HIGHZ
, WEAK
, PULL
, STRONG
, SUPPLY
};
150 // Manipulate the link direction.
154 // A link has a drive strength for 0 and 1 values. The drive0
155 // strength is for when the link has the value 0, and drive1
156 // strength is for when the link has a value 1.
157 void drive0(strength_t
);
158 void drive1(strength_t
);
160 strength_t
drive0() const;
161 strength_t
drive1() const;
163 // A link has an initial value that is used by the nexus to
164 // figure out its initial value. Normally, only the object
165 // that contains the link sets the initial value, and only the
166 // attached Nexus gets it. The default link value is Vx.
167 void set_init(verinum::V val
);
168 verinum::V
get_init() const;
170 void cur_link(NetObj
*&net
, unsigned &pin
);
171 void cur_link(const NetObj
*&net
, unsigned &pin
) const;
173 // Get a pointer to the nexus that represents all the links
176 const Nexus
* nexus()const;
178 // Return a pointer to the next link in the nexus.
180 const Link
* next_nlink() const;
182 // Remove this link from the set of connected pins. The
183 // destructor will automatically do this if needed.
186 // Return true if this link is connected to anything else.
187 bool is_linked() const;
189 // Return true if these pins are connected.
190 bool is_linked(const Link
&that
) const;
192 // Return true if this is the same pin of the same object of
194 bool is_equal(const Link
&that
) const;
196 // Return information about the object that this link is
198 const NetObj
*get_obj() const;
200 unsigned get_pin() const;
202 // A link of an object (sometimes called a "pin") has a
203 // name. It is convenient for the name to have a string and an
205 void set_name(perm_string
, unsigned inst
=0);
206 perm_string
get_name() const;
207 unsigned get_inst() const;
210 // The NetNode manages these. They point back to the
211 // NetNode so that following the links can get me here.
216 strength_t drive0_
, drive1_
;
219 // These members name the pin of the link. If the name
220 // has width, then the inst_ member is the index of the
229 private: // not implemented
231 Link
& operator= (const Link
&);
236 * The Nexus represents a collection of links that are joined
237 * together. Each link has its own properties, this class holds the
238 * properties of the group.
240 * The links in a nexus are grouped into a singly linked list, with
241 * the nexus pointing to the first Link. Each link in turn points to
242 * the next link in the nexus, with the last link pointing to 0.
244 * The t_cookie() is a void* that targets can use to store information
245 * in a Nexus. ivl guarantees that the t_cookie will be 0 when the
250 friend void connect(Link
&, Link
&);
251 friend void connect(Nexus
*, Link
&);
258 const char* name() const;
259 verinum::V
get_init() const;
262 const Link
* first_nlink()const;
264 /* Get the width of the Nexus, or 0 if there are no vectors
265 (in the form of NetNet objects) linked. */
266 unsigned vector_width() const;
268 NetNet
* pick_any_net();
270 /* This method returns true if all the possible drivers of
271 this nexus are constant. It will also return true if there
272 are no drivers at all. */
273 bool drivers_constant() const;
275 /* Given the nexus has constant drivers, this method returns
276 the value that has been driven. */
277 verinum::V
driven_value() const;
279 ivl_nexus_t
t_cookie() const;
280 ivl_nexus_t
t_cookie(ivl_nexus_t
) const;
287 mutable char* name_
; /* Cache the calculated name for the Nexus. */
288 mutable ivl_nexus_t t_cookie_
;
290 enum VALUE
{ NO_GUESS
, V0
, V1
, Vx
, Vz
, VAR
};
291 mutable VALUE driven_
;
293 private: // not implemented
295 Nexus
& operator= (const Nexus
&);
304 unsigned count() const;
306 // Add the nexus to the set, if it is not already present.
307 void add(Nexus
*that
);
308 void add(const NexusSet
&that
);
310 // Remove the nexus from the set, if it is present.
311 void rem(Nexus
*that
);
312 void rem(const NexusSet
&that
);
314 Nexus
* operator[] (unsigned idx
) const;
316 // Return true if this set contains every nexus in that set.
317 bool contains(const NexusSet
&that
) const;
319 // Return true if this set contains any nexus in that set.
320 bool intersect(const NexusSet
&that
) const;
326 unsigned bsearch_(Nexus
*that
) const;
328 private: // not implemented
329 NexusSet(const NexusSet
&);
330 NexusSet
& operator= (const NexusSet
&);
334 * A NetBus is a transparent device that is merely a bunch of pins
335 * used to tie some pins to. It is a convenient way to collect a
336 * bundle of pins and pass that bundle around.
338 class NetBus
: public NetObj
{
341 NetBus(NetScope
*scope
, unsigned pin_count
);
344 private: // not implemented
345 NetBus(const NetBus
&);
346 NetBus
& operator= (const NetBus
&);
350 * A NetNode is a device of some sort, where each pin has a different
351 * meaning. (i.e., pin(0) is the output to an and gate.) NetNode
352 * objects are listed in the nodes_ of the Design object.
354 class NetNode
: public NetObj
{
357 // The name parameter must be a permallocated string.
358 explicit NetNode(NetScope
*s
, perm_string n
, unsigned npins
);
362 virtual bool emit_node(struct target_t
*) const;
363 virtual void dump_node(ostream
&, unsigned) const;
365 // This is used to scan a modifiable netlist, one node at a time.
366 virtual void functor_node(Design
*, functor_t
*);
370 NetNode
*node_next_
, *node_prev_
;
375 * A NetDelaySrc is an input-only device that calculates a path delay
376 * based on the time that the inputs change. This class is used by the
377 * NetNet class, and NetDelaySrc objects cannot exist outside of its
378 * association with NetNet objects.
380 class NetDelaySrc
: public NetObj
{
383 explicit NetDelaySrc(NetScope
*s
, perm_string n
,
384 unsigned nsrc
, bool condit_src
);
387 // These functions set the delays from the values in the
388 // source. These set_delays functions implement the various
389 // rules wrt collections of transitions.
391 // One transition specified.
392 void set_delays(uint64_t del
);
393 // Two transitions: rise and fall
394 void set_delays(uint64_t rise
, uint64_t fall
);
396 void set_delays(uint64_t rise
, uint64_t fall
, uint64_t tz
);
397 void set_delays(uint64_t t01
, uint64_t t10
, uint64_t t0z
,
398 uint64_t tz1
, uint64_t t1z
, uint64_t tz0
);
399 void set_delays(uint64_t t01
, uint64_t t10
, uint64_t t0z
,
400 uint64_t tz1
, uint64_t t1z
, uint64_t tz0
,
401 uint64_t t0x
, uint64_t tx1
, uint64_t t1x
,
402 uint64_t tx0
, uint64_t txz
, uint64_t tzx
);
404 uint64_t get_delay(unsigned pe
) const;
408 bool is_posedge() const;
409 bool is_negedge() const;
411 unsigned src_count() const;
412 Link
&src_pin(unsigned);
413 const Link
&src_pin(unsigned) const;
415 bool is_condit() const;
417 const Link
&condit_pin() const;
419 void dump(ostream
&, unsigned ind
) const;
422 uint64_t transition_delays_
[12];
427 private: // Not implemented
428 NetDelaySrc(const NetDelaySrc
&);
429 NetDelaySrc
& operator= (const NetDelaySrc
&);
433 * NetNet is a special kind of NetObj that doesn't really do anything,
434 * but carries the properties of the wire/reg/trireg, including its
435 * name. Scalers and vectors are all the same thing here, a NetNet
436 * with a single pin. The difference between a scaler and vector is
437 * the video of the atomic vector datum it carries.
439 * NetNet objects can also appear as side effects of synthesis or
440 * other abstractions.
442 * Note that INTEGER types are an alias for a ``reg signed [31:0]''.
444 * NetNet objects have a name and exist within a scope, so the
445 * constructor takes a pointer to the containing scope. The object
446 * automatically adds itself to the scope.
448 * NetNet objects are located by searching NetScope objects.
450 * The pin of a NetNet object are PASSIVE: they do not drive
451 * anything and they are not a data sink, per se. The pins follow the
452 * values on the nexus.
454 class NetNet
: public NetObj
{
457 enum Type
{ NONE
, IMPLICIT
, IMPLICIT_REG
, INTEGER
, WIRE
, TRI
, TRI1
,
458 SUPPLY0
, SUPPLY1
, WAND
, TRIAND
, TRI0
, WOR
, TRIOR
, REG
,
461 enum PortType
{ NOT_A_PORT
, PIMPLICIT
, PINPUT
, POUTPUT
, PINOUT
};
463 // The width in this case is a shorthand for ms=width-1 and
464 // ls=0. Only one pin is created, the width is of the vector
465 // that passed through.
466 explicit NetNet(NetScope
*s
, perm_string n
, Type t
, unsigned width
=1);
468 // This form supports an array of vectors. The [ms:ls] define
469 // the base vector, and the [s0:e0] define the array
470 // dimensions. If s0==e0, then this is not an array after
472 explicit NetNet(NetScope
*s
, perm_string n
, Type t
,
474 explicit NetNet(NetScope
*s
, perm_string n
, Type t
,
475 long ms
, long ls
, long s0
, long e0
);
482 PortType
port_type() const;
483 void port_type(PortType t
);
485 ivl_variable_type_t
data_type() const;
486 void data_type(ivl_variable_type_t t
);
488 /* If a NetNet is signed, then its value is to be treated as
489 signed. Otherwise, it is unsigned. */
490 bool get_signed() const;
491 void set_signed(bool);
493 /* Used to maintain original type of net since integers are
494 implemented as 'reg signed [31:0]' in Icarus */
495 bool get_isint() const;
496 void set_isint(bool);
498 /* These methods return the msb and lsb indices for the most
499 significant and least significant bits. These are signed
500 longs, and may be different from pin numbers. For example,
501 reg [1:8] has 8 bits, msb==1 and lsb==8. */
504 unsigned long vector_width() const;
506 /* This method converts a signed index (the type that might be
507 found in the verilog source) to a pin number. It accounts
508 for variation in the definition of the reg/wire/whatever. */
509 unsigned sb_to_idx(long sb
) const;
511 /* This method checks that the signed index is valid for this
512 signal. If it is, the above sb_to_idx can be used to get
513 the pin# from the index. */
514 bool sb_is_valid(long sb
) const;
516 /* This method returns 0 for scalers and vectors, and greater
517 for arrays. The value is the number of array
518 indices. (Currently only one array index is supported.) */
519 unsigned array_dimensions() const;
520 long array_first() const;
522 // This is the number of array elements.
523 unsigned array_count() const;
525 // This method returns a 0 based address of an array entry as
526 // indexed by idx. The Verilog source may give index ranges
527 // that are not zero based.
528 bool array_index_is_valid(long idx
) const;
529 unsigned array_index_to_address(long idx
) const;
531 bool local_flag() const { return local_flag_
; }
532 void local_flag(bool f
) { local_flag_
= f
; }
534 /* NetESignal objects may reference this object. Keep a
535 reference count so that I keep track of them. */
538 unsigned peek_eref() const;
540 /* Assignment statements count their lrefs here. */
543 unsigned peek_lref() const;
545 unsigned get_refs() const;
547 /* Manage path delays */
548 void add_delay_path(class NetDelaySrc
*path
);
549 unsigned delay_paths(void) const;
550 const class NetDelaySrc
*delay_path(unsigned idx
) const;
552 virtual void dump_net(ostream
&, unsigned) const;
555 // The NetScope class uses this for listing signals.
556 friend class NetScope
;
557 NetNet
*sig_next_
, *sig_prev_
;
562 ivl_variable_type_t data_type_
;
564 bool isint_
; // original type of integer
567 const unsigned dimensions_
;
571 unsigned eref_count_
;
572 unsigned lref_count_
;
574 vector
<class NetDelaySrc
*> delay_paths_
;
578 * This class implements the LPM_ADD_SUB component as described in the
579 * EDIF LPM Version 2 1 0 standard. It is used as a structural
580 * implementation of the + and - operators.
582 class NetAddSub
: public NetNode
{
585 NetAddSub(NetScope
*s
, perm_string n
, unsigned width
);
588 // Get the width of the device (that is, the width of the
589 // operands and results.)
590 unsigned width() const;
597 Link
& pin_Overflow();
603 const Link
& pin_Cout() const;
604 const Link
& pin_DataA() const;
605 const Link
& pin_DataB() const;
606 const Link
& pin_Result() const;
608 virtual void dump_node(ostream
&, unsigned ind
) const;
609 virtual bool emit_node(struct target_t
*) const;
610 virtual void functor_node(Design
*des
, functor_t
*fun
);
617 * The NetArrayDq node represents an array dereference. The NetNet
618 * that this object refers to is an array, and the Address pin selects
619 * which word of the array to place on the Result.
621 class NetArrayDq
: public NetNode
{
624 NetArrayDq(NetScope
*s
, perm_string name
, NetNet
*mem
, unsigned awid
);
627 unsigned width() const;
628 unsigned awidth() const;
629 unsigned size() const;
630 const NetNet
*mem() const;
635 const Link
& pin_Address() const;
636 const Link
& pin_Result() const;
638 virtual void dump_node(ostream
&, unsigned ind
) const;
639 virtual bool emit_node(struct target_t
*) const;
648 * This type represents the LPM_CLSHIFT device.
650 class NetCLShift
: public NetNode
{
653 NetCLShift(NetScope
*s
, perm_string n
, unsigned width
,
654 unsigned width_dist
, bool right_flag
, bool signed_flag
);
657 unsigned width() const;
658 unsigned width_dist() const;
660 bool right_flag() const;
661 bool signed_flag() const;
665 Link
& pin_Distance();
667 const Link
& pin_Data() const;
668 const Link
& pin_Result() const;
669 const Link
& pin_Distance() const;
671 virtual void dump_node(ostream
&, unsigned ind
) const;
672 virtual bool emit_node(struct target_t
*) const;
676 unsigned width_dist_
;
682 * This class supports the LPM_COMPARE device.
684 * The width of the device is the width of the inputs. If one of the
685 * inputs is narrower then the other, it is up to the generator to
686 * make sure all the data pins are properly driven.
688 * NOTE: This is not the same as the device used to support case
689 * compare. Case comparisons handle Vx and Vz values, whereas this
692 class NetCompare
: public NetNode
{
695 NetCompare(NetScope
*scope
, perm_string n
, unsigned width
);
698 unsigned width() const;
700 bool get_signed() const;
701 void set_signed(bool);
715 const Link
& pin_Aclr() const;
716 const Link
& pin_Clock() const;
717 const Link
& pin_AGB() const;
718 const Link
& pin_AGEB() const;
719 const Link
& pin_AEB() const;
720 const Link
& pin_ANEB() const;
721 const Link
& pin_ALB() const;
722 const Link
& pin_ALEB() const;
724 const Link
& pin_DataA() const;
725 const Link
& pin_DataB() const;
727 virtual void functor_node(Design
*, functor_t
*);
728 virtual void dump_node(ostream
&, unsigned ind
) const;
729 virtual bool emit_node(struct target_t
*) const;
738 * This node is a means to connect net inputs together to form a wider
739 * vector. The output (pin 0) is a concatenation of the input vectors,
740 * with pin-1 at the LSB, pin-2 next, and so on. This node is most
741 * like the NetLogic node, as it has one output at pin 0 and the
742 * remaining pins are the input that are combined to make the
743 * output. It is seperated out because it it generally a special case
744 * for the code generators.
746 * When constructing the node, the width is the vector_width of the
747 * output, and the cnt is the number of pins. (the number of input
750 class NetConcat
: public NetNode
{
753 NetConcat(NetScope
*scope
, perm_string n
, unsigned wid
, unsigned cnt
);
756 unsigned width() const;
758 void dump_node(ostream
&, unsigned ind
) const;
759 bool emit_node(struct target_t
*) const;
767 * This class represents a theoretical (though not necessarily
768 * practical) integer divider gate. This is not to represent any real
769 * hardware, but to support the / operator in Verilog, when it shows
770 * up in structural contexts.
772 * The operands of the operation are the DataA<i> and DataB<i> inputs,
773 * and the Result<i> output reflects the value DataA/DataB.
776 class NetDivide
: public NetNode
{
779 NetDivide(NetScope
*scope
, perm_string n
,
780 unsigned width
, unsigned wa
, unsigned wb
);
783 unsigned width_r() const;
784 unsigned width_a() const;
785 unsigned width_b() const;
787 void set_signed(bool);
788 bool get_signed() const;
794 const Link
& pin_DataA() const;
795 const Link
& pin_DataB() const;
796 const Link
& pin_Result() const;
798 virtual void dump_node(ostream
&, unsigned ind
) const;
799 virtual bool emit_node(struct target_t
*) const;
800 virtual void functor_node(Design
*des
, functor_t
*fun
);
811 * This class represents a theoretical (though not necessarily
812 * practical) integer modulo gate. This is not to represent any real
813 * hardware, but to support the % operator in Verilog, when it shows
814 * up in structural contexts.
816 * The operands of the operation are the DataA<i> and DataB<i> inputs,
817 * and the Result<i> output reflects the value DataA%DataB.
820 class NetModulo
: public NetNode
{
823 NetModulo(NetScope
*s
, perm_string n
,
824 unsigned width
, unsigned wa
, unsigned wb
);
827 unsigned width_r() const;
828 unsigned width_a() const;
829 unsigned width_b() const;
835 const Link
& pin_DataA() const;
836 const Link
& pin_DataB() const;
837 const Link
& pin_Result() const;
839 virtual void dump_node(ostream
&, unsigned ind
) const;
840 virtual bool emit_node(struct target_t
*) const;
841 virtual void functor_node(Design
*des
, functor_t
*fun
);
850 * This class represents an LPM_FF device. There is no literal gate
851 * type in Verilog that maps, but gates of this type can be inferred.
853 class NetFF
: public NetNode
{
856 NetFF(NetScope
*s
, perm_string n
, unsigned vector_width
);
859 unsigned width() const;
870 const Link
& pin_Clock() const;
871 const Link
& pin_Enable() const;
872 const Link
& pin_Aset() const;
873 const Link
& pin_Aclr() const;
874 const Link
& pin_Sset() const;
875 const Link
& pin_Sclr() const;
876 const Link
& pin_Data() const;
877 const Link
& pin_Q() const;
879 void aset_value(const verinum
&val
);
880 const verinum
& aset_value() const;
882 void sset_value(const verinum
&val
);
883 const verinum
& sset_value() const;
885 virtual void dump_node(ostream
&, unsigned ind
) const;
886 virtual bool emit_node(struct target_t
*) const;
887 virtual void functor_node(Design
*des
, functor_t
*fun
);
896 * This class implements a basic LPM_MULT combinational multiplier. It
897 * is used as a structural representation of the * operator. The
898 * device has inputs A and B and output Result all with independent
901 * NOTE: Check this width thing. I think that the independence of the
902 * widths is not necessary or even useful.
904 class NetMult
: public NetNode
{
907 NetMult(NetScope
*sc
, perm_string n
, unsigned width
,
908 unsigned wa
, unsigned wb
);
911 bool get_signed() const;
912 void set_signed(bool);
914 // Get the width of the device bussed inputs. There are these
915 // parameterized widths:
916 unsigned width_r() const; // Result
917 unsigned width_a() const; // DataA
918 unsigned width_b() const; // DataB
924 const Link
& pin_DataA() const;
925 const Link
& pin_DataB() const;
926 const Link
& pin_Result() const;
928 virtual void dump_node(ostream
&, unsigned ind
) const;
929 virtual bool emit_node(struct target_t
*) const;
930 virtual void functor_node(Design
*des
, functor_t
*fun
);
941 * This class represents an LPM_MUX device. This device has some
942 * number of Result points (the width of the device) and some number
943 * of input choices. There is also a selector of some width. The
946 * width -- Width of the result and each possible Data input
947 * size -- Number of Data input (each of width)
948 * selw -- Width in bits of the select input
950 * All the data inputs must have the same type, and are the type of
951 * the result. The actual type does not matter, as the mux does not
952 * process data, just selects alternatives.
954 * The select input must be an integral type of some sort. Not real.
956 class NetMux
: public NetNode
{
959 NetMux(NetScope
*scope
, perm_string n
,
960 unsigned width
, unsigned size
, unsigned selw
);
963 unsigned width() const;
964 unsigned size() const;
965 unsigned sel_width() const;
968 Link
& pin_Data(unsigned si
);
971 const Link
& pin_Result() const;
972 const Link
& pin_Data(unsigned) const;
973 const Link
& pin_Sel() const;
975 virtual void dump_node(ostream
&, unsigned ind
) const;
976 virtual bool emit_node(struct target_t
*) const;
977 virtual void functor_node(Design
*des
, functor_t
*fun
);
987 * The NetReplicate node takes a vector input and makes it into a larger
988 * vector by repeating the input vector some number of times. The
989 * repeat count is a fixed value. This is just like the repeat
990 * concatenation of Verilog: {<repeat>{<vector>}}.
992 * When construction this node, the wid is the vector width of the
993 * output, and the rpt is the repeat count. The wid must be an even
994 * multiple of the cnt, and wid/cnt is the expected input width.
996 * The device has exacly 2 pins: pin(0) is the output and pin(1) the
999 class NetReplicate
: public NetNode
{
1002 NetReplicate(NetScope
*scope
, perm_string n
, unsigned wid
, unsigned rpt
);
1005 unsigned width() const;
1006 unsigned repeat() const;
1008 void dump_node(ostream
&, unsigned ind
) const;
1009 bool emit_node(struct target_t
*) const;
1017 * This node represents the call of a user defined function in a
1018 * structural context. The pin count is the same as the port count,
1019 * with pin0 the return value.
1021 class NetUserFunc
: public NetNode
{
1024 NetUserFunc(NetScope
*s
, perm_string n
, NetScope
*def
);
1027 unsigned port_width(unsigned port
) const;
1029 const NetScope
* def() const;
1031 virtual void dump_node(ostream
&, unsigned ind
) const;
1032 virtual bool emit_node(struct target_t
*) const;
1039 * The number of ports includes the return value, so will always be at
1042 class NetSysFunc
: public NetNode
{
1045 NetSysFunc(NetScope
*s
, perm_string n
,
1046 const struct sfunc_return_type
*def
,
1050 unsigned vector_width() const;
1051 const char* func_name() const;
1053 virtual void dump_node(ostream
&, unsigned ind
) const;
1054 virtual bool emit_node(struct target_t
*) const;
1057 const struct sfunc_return_type
*def_
;
1061 * There are cases where expressions need to be represented. The
1062 * NetExpr class is the root of a hierarchy that serves that purpose.
1064 * The expr_width() is the width of the expression, that accounts
1065 * for the widths of the sub-expressions I might have. It is up to the
1066 * derived classes to properly set the expr width, if need be. The
1067 * set_width() method is used to compel an expression to have a
1068 * certain width, and is used particularly when the expression is an
1069 * rvalue in an assignment statement.
1071 class NetExpr
: public LineInfo
{
1073 explicit NetExpr(unsigned w
=0);
1074 virtual ~NetExpr() =0;
1076 virtual void expr_scan(struct expr_scan_t
*) const =0;
1077 virtual void dump(ostream
&) const;
1079 // Expressions have type.
1080 virtual ivl_variable_type_t
expr_type() const;
1083 unsigned expr_width() const { return width_
; }
1085 // Coerce the expression to have a specific width. If the
1086 // coercion works, then return true. Otherwise, return false.
1087 // A coercion will work or not depending on the implementation
1088 // in the derived class. Normally, the width will be set if
1089 // the expression is:
1090 // - already the requested size, OR
1091 // - otherwise unsized.
1092 // Normally, the resize will not allow a width size that loses
1093 // data. For example, it will not reduce a constant expression
1094 // to the point where significant bits are lost. But if the
1095 // last_chance flag is true, then the method assumes that high
1096 // bits will be lost anyhow, so try harder. Loss will be
1097 // allowed, but it still won't resize fixed size expressions
1098 // such as vector signals. This flag is meant to be used by
1099 // elaboration of procedural assignment to set the expression
1100 // width to the l-value width, if possible.
1101 virtual bool set_width(unsigned wid
, bool last_chance
=false);
1103 // This method returns true if the expression is
1104 // signed. Unsigned expressions return false.
1105 bool has_sign() const;
1106 void cast_signed(bool flag
);
1108 // This returns true if the expression has a definite
1109 // width. This is generally true, but in some cases the
1110 // expression is amorphous and desires a width from its
1111 // environment. For example, 'd5 has indefinite width, but
1112 // 5'd5 has a definite width.
1114 // This method is only really used within concatenation
1115 // expressions to check validity.
1116 virtual bool has_width() const;
1119 // This method evaluates the expression and returns an
1120 // equivalent expression that is reduced as far as compile
1121 // time knows how. Essentially, this is designed to fold
1124 // The prune_to_width is the maximum width that the result
1125 // should be. If it is -1, then do not prune the result.
1126 virtual NetExpr
*eval_tree(int prune_to_width
= -1);
1128 // Make a duplicate of myself, and subexpressions if I have
1129 // any. This is a deep copy operation.
1130 virtual NetExpr
*dup_expr() const =0;
1132 // Get the Nexus that are the input to this
1133 // expression. Normally this descends down to the reference to
1134 // a signal that reads from its input.
1135 virtual NexusSet
* nex_input() =0;
1137 // Return a version of myself that is structural. This is used
1138 // for converting expressions to gates.
1139 virtual NetNet
*synthesize(Design
*);
1143 void expr_width(unsigned w
) { width_
= w
; }
1149 private: // not implemented
1150 NetExpr(const NetExpr
&);
1151 NetExpr
& operator=(const NetExpr
&);
1155 * The expression constant is slightly special, and is sometimes
1156 * returned from other classes that can be evaluated at compile
1157 * time. This class represents constant values in expressions.
1159 class NetEConst
: public NetExpr
{
1162 explicit NetEConst(const verinum
&val
);
1165 const verinum
&value() const;
1167 virtual bool set_width(unsigned w
, bool last_chance
=false);
1169 virtual bool has_width() const;
1170 virtual ivl_variable_type_t
expr_type() const;
1172 virtual void expr_scan(struct expr_scan_t
*) const;
1173 virtual void dump(ostream
&) const;
1175 virtual NetEConst
* dup_expr() const;
1176 virtual NetNet
*synthesize(Design
*);
1177 virtual NexusSet
* nex_input();
1183 class NetEConstParam
: public NetEConst
{
1186 explicit NetEConstParam(NetScope
*scope
, perm_string name
,
1190 perm_string
name() const;
1191 const NetScope
*scope() const;
1193 virtual bool set_width(unsigned w
, bool last_chance
);
1194 virtual void expr_scan(struct expr_scan_t
*) const;
1195 virtual void dump(ostream
&) const;
1197 virtual NetEConstParam
* dup_expr() const;
1205 * This class represents a constant real value.
1207 class NetECReal
: public NetExpr
{
1210 explicit NetECReal(const verireal
&val
);
1213 const verireal
&value() const;
1215 // Reals can be used in vector expressions. Conversions will
1216 // be done at the right time.
1217 virtual bool set_width(unsigned w
, bool last_chance
);
1219 // This type has no self-determined width. This is false.
1220 virtual bool has_width() const;
1222 // The type of this expression is ET_REAL
1223 ivl_variable_type_t
expr_type() const;
1225 virtual void expr_scan(struct expr_scan_t
*) const;
1226 virtual void dump(ostream
&) const;
1228 virtual NetECReal
* dup_expr() const;
1229 virtual NetNet
*synthesize(Design
*);
1230 virtual NexusSet
* nex_input();
1236 class NetECRealParam
: public NetECReal
{
1239 explicit NetECRealParam(NetScope
*scope
, perm_string name
,
1240 const verireal
&val
);
1243 perm_string
name() const;
1244 const NetScope
*scope() const;
1246 virtual void expr_scan(struct expr_scan_t
*) const;
1247 virtual void dump(ostream
&) const;
1249 virtual NetECRealParam
* dup_expr() const;
1257 * The NetPartSelect device represents a netlist part select of a
1258 * signal vector. Pin 0 is a vector that is a part select of pin 1,
1259 * which connected to the NetNet of the signal being selected from.
1261 * The part to be selected is the canonical (0-based) offset and the
1262 * specified number of bits (wid).
1264 * If the offset is non-constant, then pin(2) is the input vector for
1265 * the selector. If this pin is present, then use the non-constant
1266 * selector as the input.
1268 * The NetPartSelect can be output from the signal (i.e. reading a
1269 * part), input into the signal, or bi-directional. The DIR method
1270 * gives the type of the node.
1272 * VP (Vector-to-Part)
1273 * Output pin 0 is the part select, and input pin 1 is connected to
1274 * the NetNet object.
1276 * PV (Part-to-Vector)
1277 * Output pin 1 is connected to the NetNet, and input pin 0 is the
1278 * part select. In this case, the node is driving the NetNet.
1280 * BI (BI-directional)
1281 * Pin 0 is the part select and pin 1 is connected to the NetNet, but
1282 * the ports are intended to be bi-directional.
1284 * Note that whatever the direction that data is intended to flow,
1285 * pin-0 is the part select and pin-1 is connected to the NetNet.
1287 class NetPartSelect
: public NetNode
{
1290 // enum for the device direction
1291 enum dir_t
{ VP
, PV
, BI
};
1293 explicit NetPartSelect(NetNet
*sig
,
1294 unsigned off
, unsigned wid
, dir_t dir
);
1295 explicit NetPartSelect(NetNet
*sig
, NetNet
*sel
,
1299 unsigned base() const;
1300 unsigned width() const;
1303 virtual void dump_node(ostream
&, unsigned ind
) const;
1304 bool emit_node(struct target_t
*tgt
) const;
1313 * The NetBUFZ is a magic device that represents the continuous
1314 * assign, with the output being the target register and the input
1315 * the logic that feeds it. The netlist preserves the directional
1316 * nature of that assignment with the BUFZ. The target may elide it if
1317 * that makes sense for the technology.
1319 class NetBUFZ
: public NetNode
{
1322 explicit NetBUFZ(NetScope
*s
, perm_string n
, unsigned wid
);
1325 unsigned width() const;
1327 virtual void dump_node(ostream
&, unsigned ind
) const;
1328 virtual bool emit_node(struct target_t
*) const;
1335 * This node is used to represent case equality in combinational
1336 * logic. Although this is not normally synthesizable, it makes sense
1337 * to support an abstract gate that can compare x and z. This node
1338 * always generates a single bit result, no matter the width of the
1339 * input. The elaboration, btw, needs to make sure the input widths
1342 * This pins are assigned as:
1344 * 0 -- Output (always returns 0 or 1)
1348 class NetCaseCmp
: public NetNode
{
1351 explicit NetCaseCmp(NetScope
*s
, perm_string n
, unsigned wid
, bool eeq
);
1354 unsigned width() const;
1355 // true if this is ===, false if this is !==
1358 virtual void dump_node(ostream
&, unsigned ind
) const;
1359 virtual bool emit_node(struct target_t
*) const;
1366 /* NOTE: This class should be replaced with the NetLiteral class
1367 * below, that is more general in that it supports different types of
1370 * This class represents instances of the LPM_CONSTANT device. The
1371 * node has only outputs and a constant value. The width is available
1372 * by getting the pin_count(), and the value bits are available one at
1373 * a time. There is no meaning to the aggregation of bits to form a
1374 * wide NetConst object, although some targets may have an easier time
1375 * detecting interesting constructs if they are combined.
1377 class NetConst
: public NetNode
{
1380 explicit NetConst(NetScope
*s
, perm_string n
, verinum::V v
);
1381 explicit NetConst(NetScope
*s
, perm_string n
, const verinum
&val
);
1384 verinum::V
value(unsigned idx
) const;
1385 unsigned width() const;
1387 virtual bool emit_node(struct target_t
*) const;
1388 virtual void functor_node(Design
*, functor_t
*);
1389 virtual void dump_node(ostream
&, unsigned ind
) const;
1397 * This class represents instances of the LPM_CONSTANT device. The
1398 * node has only outputs and a constant value. The width is available
1399 * by getting the pin_count(), and the value bits are available one at
1400 * a time. There is no meaning to the aggregation of bits to form a
1401 * wide NetConst object, although some targets may have an easier time
1402 * detecting interesting constructs if they are combined.
1404 class NetLiteral
: public NetNode
{
1407 // A read-valued literal.
1408 explicit NetLiteral(NetScope
*s
, perm_string n
, const verireal
&val
);
1411 ivl_variable_type_t
data_type() const;
1413 const verireal
& value_real() const;
1415 virtual bool emit_node(struct target_t
*) const;
1416 virtual void functor_node(Design
*, functor_t
*);
1417 virtual void dump_node(ostream
&, unsigned ind
) const;
1424 * This class represents all manner of logic gates. Pin 0 is OUTPUT and
1425 * all the remaining pins are INPUT. The BUFIF[01] gates have the
1426 * more specific pinout as follows:
1433 * The pullup and pulldown gates have no inputs at all, and pin0 is
1434 * the output 1 or 0, depending on the gate type. It is the strength
1435 * of that value that is important.
1437 * All these devices process vectors bitwise, so each bit can be
1438 * logically seperated. The exception is the CONCAT gate, which is
1439 * really an abstract gate that takes the inputs and turns it into a
1442 class NetLogic
: public NetNode
{
1445 enum TYPE
{ AND
, BUF
, BUFIF0
, BUFIF1
, NAND
, NMOS
, NOR
, NOT
,
1446 NOTIF0
, NOTIF1
, OR
, PULLDOWN
, PULLUP
, RNMOS
, RPMOS
,
1449 explicit NetLogic(NetScope
*s
, perm_string n
, unsigned pins
,
1450 TYPE t
, unsigned wid
);
1453 unsigned width() const;
1455 virtual void dump_node(ostream
&, unsigned ind
) const;
1456 virtual bool emit_node(struct target_t
*) const;
1457 virtual void functor_node(Design
*, functor_t
*);
1465 * This class represents a structural sign extension. The pin-0 is a
1466 * vector of the input pin-1 sign-extended. The input is taken to be
1467 * signed. This generally matches a hardware implementation of
1468 * replicating the top bit enough times to create the desired output
1471 class NetSignExtend
: public NetNode
{
1474 explicit NetSignExtend(NetScope
*s
, perm_string n
, unsigned wid
);
1477 unsigned width() const;
1479 virtual void dump_node(ostream
&, unsigned ind
) const;
1480 virtual bool emit_node(struct target_t
*) const;
1481 virtual void functor_node(Design
*, functor_t
*);
1488 * This class represents *reduction* logic operators. Certain boolean
1489 * logic operators have reduction forms which take in a vector and
1490 * return a single bit that is calculated by applying the logic
1491 * operation through the width of the input vector. These correspond
1492 * to reduction unary operators in Verilog.
1494 class NetUReduce
: public NetNode
{
1497 enum TYPE
{NONE
, AND
, OR
, XOR
, NAND
, NOR
, XNOR
};
1499 NetUReduce(NetScope
*s
, perm_string n
, TYPE t
, unsigned wid
);
1502 unsigned width() const;
1504 virtual void dump_node(ostream
&, unsigned ind
) const;
1505 virtual bool emit_node(struct target_t
*) const;
1506 virtual void functor_node(Design
*, functor_t
*);
1514 * The UDP is a User Defined Primitive from the Verilog source. Do not
1515 * expand it out any further then this in the netlist, as this can be
1516 * used to represent target device primitives.
1518 * The UDP can be combinational or sequential. The sequential UDP
1519 * includes the current output in the truth table, and supports edges,
1520 * whereas the combinational does not and is entirely level sensitive.
1521 * In any case, pin 0 is an output, and all the remaining pins are
1524 * Set_table takes as input a string with one letter per pin. The
1525 * parser translates the written sequences to one of these. The
1526 * valid characters are:
1528 * 0, 1, x -- The levels
1536 * It also takes one of the following glob letters to represent more
1539 * p -- 01, 0x or x1 // check this with the lexer
1540 * n -- 10, 1x or x0 // check this with the lexer
1544 * _ -- 10 or x0 (Note that this is not the output '-'.)
1548 * These objects have a single bit of memory. The logic table includes
1549 * an entry for the current value, and allows edges on the inputs. In
1550 * canonical form, only the entries that generate 0, 1 or - (no change)
1554 * The logic table is a map between the input levels and the
1555 * output. Each input pin can have the value 0, 1 or x and the output
1556 * can have the values 0 or 1. If the input matches nothing, the
1557 * output is x. In canonical form, only the entries that generate 0 or
1563 class NetUDP
: public NetNode
{
1566 explicit NetUDP(NetScope
*s
, perm_string n
, unsigned pins
, PUdp
*u
);
1568 virtual bool emit_node(struct target_t
*) const;
1569 virtual void dump_node(ostream
&, unsigned ind
) const;
1571 /* Use these methods to scan the truth table of the
1572 device. "first" returns the first item in the table, and
1573 "next" returns the next item in the table. The method will
1574 return false when the scan is done. */
1575 bool first(string
&inp
, char&out
) const;
1576 bool next(string
&inp
, char&out
) const;
1577 unsigned rows() const { return udp
->tinput
.count(); }
1579 unsigned nin() const { return pin_count()-1; }
1580 bool is_sequential() const { return udp
->sequential
; }
1581 perm_string
udp_name() const { return udp
->name_
; }
1582 char get_initial() const;
1585 mutable unsigned table_idx
;
1591 * A process is a behavioral-model description. A process is a
1592 * statement that may be compound. the various statement types may
1593 * refer to places in a netlist (by pointing to nodes) but is not
1594 * linked into the netlist. However, elaborating a process may cause
1595 * special nodes to be created to handle things like events.
1597 class NetProc
: public virtual LineInfo
{
1603 // Find the Nexa that are input by the statement. This is used
1604 // for example by @* to find the inputs to the process for the
1605 // sensitivity list.
1606 virtual NexusSet
* nex_input();
1608 // Find the nexa that are set by the statement. Add the output
1609 // values to the set passed as a parameter.
1610 virtual void nex_output(NexusSet
&);
1612 // This method is called to emit the statement to the
1613 // target. The target returns true if OK, false for errors.
1614 virtual bool emit_proc(struct target_t
*) const;
1616 // This method is called by functors that want to scan a
1617 // process in search of matchable patterns.
1618 virtual int match_proc(struct proc_match_t
*);
1620 // Return true if this represents the root of a combinational
1621 // process. Most process types are not.
1622 virtual bool is_asynchronous();
1624 // Return true if this represents the root of a synchronous
1625 // process. Most process types are not.
1626 virtual bool is_synchronous();
1628 // synthesize as asynchronous logic, and return true.
1629 virtual bool synth_async(Design
*des
, NetScope
*scope
,
1630 const NetBus
&nex_map
, NetBus
&nex_out
);
1632 virtual bool synth_sync(Design
*des
, NetScope
*scope
, NetFF
*ff
,
1633 const NetBus
&nex_map
, NetBus
&nex_out
,
1634 const svector
<NetEvProbe
*>&events
);
1636 virtual void dump(ostream
&, unsigned ind
) const;
1639 friend class NetBlock
;
1642 private: // not implemented
1643 NetProc(const NetProc
&);
1644 NetProc
& operator= (const NetProc
&);
1648 * Procedural assignment is broken into a suite of classes. These
1649 * classes represent the various aspects of the assignment statement
1650 * in behavioral code. (The continuous assignment is *not*
1651 * represented here.)
1653 * The NetAssignBase carries the common aspects of an assignment,
1654 * including the r-value. This class has no cares of blocking vs
1655 * non-blocking, however it carries nearly all the other properties
1656 * of the assignment statement. It is abstract because it does not
1657 * differentiate the virtual behaviors.
1659 * The NetAssign and NetAssignNB classes are the concrete classes that
1660 * give the assignment its final, precise meaning. These classes fill
1661 * in the NetProc behaviors.
1663 * The l-value of the assignment is a collection of NetAssign_
1664 * objects that are connected to the structural netlist where the
1665 * assignment has its effect. The NetAssign_ class is not to be
1668 * The collection is arranged from lsb up to msb, and represents the
1669 * concatenation of l-values. The elaborator may collapse some
1670 * concatenations into a single NetAssign_. The "more" member of the
1671 * NetAssign_ object points to the next most significant bits of l-value.
1673 * NOTE: The elaborator will make an effort to match the width of the
1674 * r-value to the width of the l-value, but targets and functions
1675 * should know that this is not a guarantee.
1681 NetAssign_(NetNet
*sig
);
1684 // If this expression exists, then it is used to select a word
1685 // from an array/memory.
1687 const NetExpr
*word() const;
1689 // Get the base index of the part select, or 0 if there is no
1691 const NetExpr
* get_base() const;
1693 void set_word(NetExpr
*);
1694 void set_part(NetExpr
* loff
, unsigned wid
);
1696 // Get the width of the r-value that this node expects. This
1697 // method accounts for the presence of the mux, so it not
1698 // necessarily the same as the pin_count().
1699 unsigned lwidth() const;
1701 // Get the name of the underlying object.
1702 perm_string
name() const;
1704 NetNet
* sig() const;
1706 // Mark that the synthesizer has worked with this l-value, so
1707 // when it is released, the l-value signal should be turned
1709 void turn_sig_to_wire_on_release();
1711 // It is possible that l-values can have *inputs*, as well as
1712 // being outputs. For example foo[idx] = ... is the l-value
1713 // (NetAssign_ object) with a foo l-value and the input
1715 NexusSet
* nex_input();
1717 // This pointer is for keeping simple lists.
1720 void dump_lval(ostream
&o
) const;
1724 // Memory word index
1727 bool turn_sig_to_wire_on_release_
;
1728 // indexed part select base
1733 class NetAssignBase
: public NetProc
{
1736 NetAssignBase(NetAssign_
*lv
, NetExpr
*rv
);
1737 virtual ~NetAssignBase() =0;
1739 // This is the (procedural) value that is to be assigned when
1740 // the assignment is executed.
1742 const NetExpr
*rval() const;
1744 void set_rval(NetExpr
*);
1746 NetAssign_
* l_val(unsigned);
1747 const NetAssign_
* l_val(unsigned) const;
1748 unsigned l_val_count() const;
1750 void set_delay(NetExpr
*);
1751 const NetExpr
* get_delay() const;
1753 virtual NexusSet
* nex_input();
1754 virtual void nex_output(NexusSet
&o
);
1757 // This returns the total width of the accumulated l-value. It
1758 // accounts for any grouping of NetAssign_ objects that might happen.
1759 unsigned lwidth() const;
1761 bool synth_async(Design
*des
, NetScope
*scope
,
1762 const NetBus
&nex_map
, NetBus
&nex_out
);
1764 // This dumps all the lval structures.
1765 void dump_lval(ostream
&) const;
1766 virtual void dump(ostream
&, unsigned ind
) const;
1774 class NetAssign
: public NetAssignBase
{
1777 explicit NetAssign(NetAssign_
*lv
, NetExpr
*rv
);
1780 bool is_asynchronous();
1782 virtual bool emit_proc(struct target_t
*) const;
1783 virtual int match_proc(struct proc_match_t
*);
1784 virtual void dump(ostream
&, unsigned ind
) const;
1789 class NetAssignNB
: public NetAssignBase
{
1791 explicit NetAssignNB(NetAssign_
*lv
, NetExpr
*rv
);
1795 virtual bool emit_proc(struct target_t
*) const;
1796 virtual int match_proc(struct proc_match_t
*);
1797 virtual void dump(ostream
&, unsigned ind
) const;
1803 * A block is stuff like begin-end blocks, that contain an ordered
1804 * list of NetProc statements.
1806 * NOTE: The emit method calls the target->proc_block function but
1807 * does not recurse. It is up to the target-supplied proc_block
1808 * function to call emit_recurse.
1810 class NetBlock
: public NetProc
{
1813 enum Type
{ SEQU
, PARA
};
1815 NetBlock(Type t
, NetScope
*subscope
);
1818 Type
type() const { return type_
; }
1819 NetScope
* subscope() const { return subscope_
; }
1821 void append(NetProc
*);
1823 const NetProc
*proc_first() const;
1824 const NetProc
*proc_next(const NetProc
*cur
) const;
1827 // synthesize as asynchronous logic, and return true.
1828 bool synth_async(Design
*des
, NetScope
*scope
,
1829 const NetBus
&nex_map
, NetBus
&nex_out
);
1831 bool synth_sync(Design
*des
, NetScope
*scope
, NetFF
*ff
,
1832 const NetBus
&nex_map
, NetBus
&nex_out
,
1833 const svector
<NetEvProbe
*>&events
);
1835 // This version of emit_recurse scans all the statements of
1836 // the begin-end block sequentially. It is typically of use
1837 // for sequential blocks.
1838 void emit_recurse(struct target_t
*) const;
1840 virtual NexusSet
* nex_input();
1841 virtual void nex_output(NexusSet
&);
1842 virtual bool emit_proc(struct target_t
*) const;
1843 virtual int match_proc(struct proc_match_t
*);
1844 virtual void dump(ostream
&, unsigned ind
) const;
1854 * A CASE statement in the verilog source leads, eventually, to one of
1855 * these. This is different from a simple conditional because of the
1856 * way the comparisons are performed. Also, it is likely that the
1857 * target may be able to optimize differently.
1859 * Case can be one of three types:
1860 * EQ -- All bits must exactly match
1861 * EQZ -- z bits are don't care
1862 * EQX -- x and z bits are don't care.
1864 class NetCase
: public NetProc
{
1867 enum TYPE
{ EQ
, EQX
, EQZ
};
1868 NetCase(TYPE c
, NetExpr
*ex
, unsigned cnt
);
1871 void set_case(unsigned idx
, NetExpr
*ex
, NetProc
*st
);
1874 const NetExpr
*expr() const { return expr_
; }
1875 unsigned nitems() const { return nitems_
; }
1877 const NetExpr
*expr(unsigned idx
) const { return items_
[idx
].guard
;}
1878 const NetProc
*stat(unsigned idx
) const { return items_
[idx
].statement
; }
1880 virtual NexusSet
* nex_input();
1881 virtual void nex_output(NexusSet
&out
);
1883 bool synth_async(Design
*des
, NetScope
*scope
,
1884 const NetBus
&nex_map
, NetBus
&nex_out
);
1886 virtual bool emit_proc(struct target_t
*) const;
1887 virtual void dump(ostream
&, unsigned ind
) const;
1904 * The cassign statement causes the r-val net to be forced onto the
1905 * l-val reg when it is executed. The code generator is expected to
1906 * know what that means.
1908 class NetCAssign
: public NetAssignBase
{
1911 explicit NetCAssign(NetAssign_
*lv
, NetExpr
*rv
);
1914 virtual NexusSet
* nex_input();
1915 virtual void dump(ostream
&, unsigned ind
) const;
1916 virtual bool emit_proc(struct target_t
*) const;
1918 private: // not implemented
1919 NetCAssign(const NetCAssign
&);
1920 NetCAssign
& operator= (const NetCAssign
&);
1925 * A condit represents a conditional. It has an expression to test,
1926 * and a pair of statements to select from. If the original statement
1927 * has empty clauses, then the NetProc for it will be a null pointer.
1929 class NetCondit
: public NetProc
{
1932 explicit NetCondit(NetExpr
*ex
, NetProc
*i
, NetProc
*e
);
1935 const NetExpr
*expr() const;
1938 NetProc
* if_clause();
1939 NetProc
* else_clause();
1941 // Replace the condition expression.
1942 void set_expr(NetExpr
*ex
);
1944 bool emit_recurse_if(struct target_t
*) const;
1945 bool emit_recurse_else(struct target_t
*) const;
1947 virtual NexusSet
* nex_input();
1948 virtual void nex_output(NexusSet
&o
);
1950 bool is_asynchronous();
1951 bool synth_async(Design
*des
, NetScope
*scope
,
1952 const NetBus
&nex_map
, NetBus
&nex_out
);
1954 bool synth_sync(Design
*des
, NetScope
*scope
, NetFF
*ff
,
1955 const NetBus
&nex_map
, NetBus
&nex_out
,
1956 const svector
<NetEvProbe
*>&events
);
1958 virtual bool emit_proc(struct target_t
*) const;
1959 virtual int match_proc(struct proc_match_t
*);
1960 virtual void dump(ostream
&, unsigned ind
) const;
1969 * The procedural deassign statement (the opposite of assign) releases
1970 * any assign expressions attached to the bits of the reg. The
1971 * lval is the expression of the "deassign <expr>;" statement with the
1972 * expr elaborated to a net.
1974 class NetDeassign
: public NetAssignBase
{
1977 explicit NetDeassign(NetAssign_
*l
);
1980 virtual bool emit_proc(struct target_t
*) const;
1981 virtual void dump(ostream
&, unsigned ind
) const;
1983 private: // not implemented
1984 NetDeassign(const NetDeassign
&);
1985 NetDeassign
& operator= (const NetDeassign
&);
1989 * This node represents the behavioral disable statement. The Verilog
1990 * source that produces it looks like:
1994 * Where the scope is a named block or a task. It cannot be a module
1995 * instance scope because module instances cannot be disabled.
1997 class NetDisable
: public NetProc
{
2000 explicit NetDisable(NetScope
*tgt
);
2003 const NetScope
*target() const;
2005 virtual bool emit_proc(struct target_t
*) const;
2006 virtual void dump(ostream
&, unsigned ind
) const;
2011 private: // not implemented
2012 NetDisable(const NetDisable
&);
2013 NetDisable
& operator= (const NetDisable
&);
2017 * A NetEvent is an object that represents an event object, that is
2018 * objects declared like so in Verilog:
2022 * Once an object of this type exists, behavioral code can wait on the
2023 * event or trigger the event. Event waits refer to this object, as do
2024 * the event trigger statements. The NetEvent class may have a name and
2025 * a scope. The name is a simple name (no hierarchy) and the scope is
2026 * the NetScope that contains the object. The scope member is written
2027 * by the NetScope object when the NetEvent is stored.
2029 * The NetEvWait class represents a thread wait for an event. When
2030 * this statement is executed, it starts waiting on the
2031 * event. Conceptually, it puts itself on the event list for the
2032 * referenced event. When the event is triggered, the wait ends its
2033 * block and starts the associated statement.
2035 * The NetEvTrig class represents trigger statements. Executing this
2036 * statement causes the referenced event to be triggered, which it
2037 * turn awakens the waiting threads. Each NetEvTrig object references
2038 * exactly one event object.
2040 * The NetEvProbe class is the structural equivalent of the NetEvTrig,
2041 * in that it is a node and watches bit values that it receives. It
2042 * checks for edges then if appropriate triggers the associated
2043 * NetEvent. Each NetEvProbe references exactly one event object, and
2044 * the NetEvent objects have a list of NetEvProbe objects that
2047 class NetEvent
: public LineInfo
{
2049 friend class NetScope
;
2050 friend class NetEvProbe
;
2051 friend class NetEvTrig
;
2052 friend class NetEvWait
;
2053 friend class NetEEvent
;
2056 // The name of the event is the basename, and should not
2057 // include the scope. Also, the name passed here should be
2059 explicit NetEvent (perm_string n
);
2062 perm_string
name() const;
2064 // Get information about probes connected to me.
2065 unsigned nprobe() const;
2066 NetEvProbe
* probe(unsigned);
2067 const NetEvProbe
* probe(unsigned) const;
2069 // Return the number of NetEvWait nodes that reference me.
2070 unsigned nwait() const;
2071 unsigned ntrig() const;
2072 unsigned nexpr() const;
2075 const NetScope
* scope() const;
2077 void nex_output(NexusSet
&);
2079 // Locate the first event that matches my behavior and
2080 // monitors the same signals.
2081 void find_similar_event(list
<NetEvent
*>&);
2083 // This method replaces pointers to me with pointers to
2084 // that. It is typically used to replace similar events
2085 // located by the find_similar_event method.
2086 void replace_event(NetEvent
*that
);
2089 // This returns a nexus set if it represents possibly
2090 // asynchronous inputs, otherwise 0.
2091 NexusSet
*nex_async_();
2096 // The NetScope class uses these to list the events.
2100 // Use these methods to list the probes attached to me.
2103 // Use these methods to list the triggers attached to me.
2106 // Use This member to count references by NetEvWait objects.
2112 struct wcell_
*wlist_
;
2114 // expression references, ala. task/funcs
2117 private: // not implemented
2118 NetEvent(const NetEvent
&);
2119 NetEvent
& operator= (const NetEvent
&);
2122 class NetEvTrig
: public NetProc
{
2124 friend class NetEvent
;
2127 explicit NetEvTrig(NetEvent
*tgt
);
2130 const NetEvent
*event() const;
2132 virtual bool emit_proc(struct target_t
*) const;
2133 virtual void dump(ostream
&, unsigned ind
) const;
2137 // This is used to place me in the NetEvents lists of triggers.
2141 class NetEvWait
: public NetProc
{
2144 explicit NetEvWait(NetProc
*st
);
2147 void add_event(NetEvent
*tgt
);
2148 void replace_event(NetEvent
*orig
, NetEvent
*repl
);
2150 unsigned nevents() const;
2151 const NetEvent
*event(unsigned) const;
2152 NetEvent
*event(unsigned);
2154 NetProc
*statement();
2156 virtual bool emit_proc(struct target_t
*) const;
2157 bool emit_recurse(struct target_t
*) const;
2158 virtual int match_proc(struct proc_match_t
*);
2160 // It is possible that this is the root of a combinational
2161 // process. This method checks.
2162 virtual bool is_asynchronous();
2164 // It is possible that this is the root of a synchronous
2165 // process? This method checks.
2166 virtual bool is_synchronous();
2168 virtual void nex_output(NexusSet
&out
);
2170 virtual bool synth_async(Design
*des
, NetScope
*scope
,
2171 const NetBus
&nex_map
, NetBus
&nex_out
);
2173 virtual bool synth_sync(Design
*des
, NetScope
*scope
, NetFF
*ff
,
2174 const NetBus
&nex_map
, NetBus
&nex_out
,
2175 const svector
<NetEvProbe
*>&events
);
2177 virtual void dump(ostream
&, unsigned ind
) const;
2186 class NetEvProbe
: public NetNode
{
2188 friend class NetEvent
;
2191 enum edge_t
{ ANYEDGE
, POSEDGE
, NEGEDGE
};
2193 explicit NetEvProbe(NetScope
*s
, perm_string n
,
2194 NetEvent
*tgt
, edge_t t
, unsigned p
);
2197 edge_t
edge() const;
2199 const NetEvent
* event() const;
2201 void find_similar_probes(list
<NetEvProbe
*>&);
2203 virtual bool emit_node(struct target_t
*) const;
2204 virtual void dump_node(ostream
&, unsigned ind
) const;
2209 // The NetEvent class uses this to list me.
2214 * The force statement causes the r-val net to be forced onto the
2215 * l-val net when it is executed. The code generator is expected to
2216 * know what that means.
2218 class NetForce
: public NetAssignBase
{
2221 explicit NetForce(NetAssign_
*l
, NetExpr
*r
);
2224 virtual NexusSet
* nex_input();
2226 virtual void dump(ostream
&, unsigned ind
) const;
2227 virtual bool emit_proc(struct target_t
*) const;
2231 * A forever statement is executed over and over again forever. Or
2232 * until its block is disabled.
2234 class NetForever
: public NetProc
{
2237 explicit NetForever(NetProc
*s
);
2240 void emit_recurse(struct target_t
*) const;
2242 virtual NexusSet
* nex_input();
2243 virtual bool emit_proc(struct target_t
*) const;
2244 virtual void dump(ostream
&, unsigned ind
) const;
2251 * A function definition is elaborated just like a task, though by now
2252 * it is certain that the first parameter (a phantom parameter) is the
2253 * output and all the remaining parameters are the inputs. This makes
2254 * for easy code generation in targets that support behavioral
2257 * The NetNet array that is passed in as a parameter is the set of
2258 * signals that make up its parameter list. These are all internal to
2259 * the scope of the function.
2264 NetFuncDef(NetScope
*, NetNet
*result
, const svector
<NetNet
*>&po
);
2267 void set_proc(NetProc
*st
);
2269 //const string name() const;
2270 const NetProc
*proc() const;
2271 const NetScope
*scope() const;
2274 unsigned port_count() const;
2275 const NetNet
*port(unsigned idx
) const;
2277 const NetNet
*return_sig() const;
2279 void dump(ostream
&, unsigned ind
) const;
2285 svector
<NetNet
*>ports_
;
2289 * This class represents delay statements of the form:
2291 * #<expr> <statement>
2293 * Where the statement may be null. The delay is evaluated at
2294 * elaboration time to make a constant unsigned long that is the delay
2295 * in simulation ticks.
2297 * If the delay expression is non-constant, construct the NetPDelay
2298 * object with a NetExpr* instead of the d value, and use the expr()
2299 * method to get the expression. If expr() returns 0, use the delay()
2300 * method to get the constant delay.
2302 class NetPDelay
: public NetProc
{
2305 NetPDelay(uint64_t d
, NetProc
*st
);
2306 NetPDelay(NetExpr
* d
, NetProc
*st
);
2309 uint64_t delay() const;
2310 const NetExpr
*expr() const;
2312 virtual NexusSet
* nex_input();
2313 virtual void nex_output(NexusSet
&);
2315 virtual bool emit_proc(struct target_t
*) const;
2316 virtual void dump(ostream
&, unsigned ind
) const;
2318 bool emit_proc_recurse(struct target_t
*) const;
2327 * A repeat statement is executed some fixed number of times.
2329 class NetRepeat
: public NetProc
{
2332 explicit NetRepeat(NetExpr
*e
, NetProc
*s
);
2335 const NetExpr
*expr() const;
2336 void emit_recurse(struct target_t
*) const;
2338 virtual NexusSet
* nex_input();
2339 virtual bool emit_proc(struct target_t
*) const;
2340 virtual void dump(ostream
&, unsigned ind
) const;
2348 * The procedural release statement (the opposite of force) releases
2349 * any force expressions attached to the bits of the wire or reg. The
2350 * lval is the expression of the "release <expr>;" statement with the
2351 * expr elaborated to a net.
2353 class NetRelease
: public NetAssignBase
{
2356 explicit NetRelease(NetAssign_
*l
);
2359 virtual bool emit_proc(struct target_t
*) const;
2360 virtual void dump(ostream
&, unsigned ind
) const;
2367 * The NetSTask class is a call to a system task. These kinds of tasks
2368 * are generally handled very simply in the target. They certainly are
2369 * handled differently from user defined tasks because ivl knows all
2370 * about the user defined tasks.
2372 class NetSTask
: public NetProc
{
2375 NetSTask(const char*na
, const svector
<NetExpr
*>&);
2378 const char* name() const;
2380 unsigned nparms() const;
2382 const NetExpr
* parm(unsigned idx
) const;
2384 virtual NexusSet
* nex_input();
2385 virtual void nex_output(NexusSet
&);
2386 virtual bool emit_proc(struct target_t
*) const;
2387 virtual void dump(ostream
&, unsigned ind
) const;
2391 svector
<NetExpr
*>parms_
;
2395 * This class represents an elaborated class definition. NetUTask
2396 * classes may refer to objects of this type to get the meaning of the
2399 * The task also introduces a scope, and the parameters are actually
2400 * reg objects in the new scope. The task is called by the calling
2401 * thread assigning (blocking assignment) to the in and inout
2402 * parameters, then invoking the thread, and finally assigning out the
2403 * output and inout variables. The variables accessible as ports are
2404 * also elaborated and accessible as ordinary reg objects.
2409 NetTaskDef(NetScope
*n
, const svector
<NetNet
*>&po
);
2412 void set_proc(NetProc
*p
);
2414 //const string& name() const;
2415 const NetScope
* scope() const;
2416 const NetProc
*proc() const;
2418 unsigned port_count() const;
2419 NetNet
*port(unsigned idx
);
2421 void dump(ostream
&, unsigned) const;
2426 svector
<NetNet
*>ports_
;
2428 private: // not implemented
2429 NetTaskDef(const NetTaskDef
&);
2430 NetTaskDef
& operator= (const NetTaskDef
&);
2434 * This node represents a function call in an expression. The object
2435 * contains a pointer to the function definition, which is used to
2436 * locate the value register and input expressions.
2438 class NetEUFunc
: public NetExpr
{
2441 NetEUFunc(NetScope
*, NetESignal
*, svector
<NetExpr
*>&);
2444 const NetESignal
*result_sig() const;
2446 unsigned parm_count() const;
2447 const NetExpr
* parm(unsigned idx
) const;
2449 const NetScope
* func() const;
2451 virtual bool set_width(unsigned, bool last_chance
);
2452 virtual ivl_variable_type_t
expr_type() const;
2453 virtual void dump(ostream
&) const;
2455 virtual void expr_scan(struct expr_scan_t
*) const;
2456 virtual NetEUFunc
*dup_expr() const;
2457 virtual NexusSet
* nex_input();
2461 NetESignal
*result_sig_
;
2462 svector
<NetExpr
*> parms_
;
2464 private: // not implemented
2465 NetEUFunc(const NetEUFunc
&);
2466 NetEUFunc
& operator= (const NetEUFunc
&);
2470 * A call to a user defined task is elaborated into this object. This
2471 * contains a pointer to the elaborated task definition, but is a
2472 * NetProc object so that it can be linked into statements.
2474 class NetUTask
: public NetProc
{
2477 NetUTask(NetScope
*);
2480 const string
name() const;
2482 const NetScope
* task() const;
2484 virtual NexusSet
* nex_input();
2485 virtual void nex_output(NexusSet
&);
2486 virtual bool emit_proc(struct target_t
*) const;
2487 virtual void dump(ostream
&, unsigned ind
) const;
2494 * The while statement is a condition that is tested in the front of
2495 * each iteration, and a statement (a NetProc) that is executed as
2496 * long as the condition is true.
2498 class NetWhile
: public NetProc
{
2501 NetWhile(NetExpr
*c
, NetProc
*p
)
2502 : cond_(c
), proc_(p
) { }
2504 const NetExpr
*expr() const { return cond_
; }
2506 void emit_proc_recurse(struct target_t
*) const;
2508 virtual NexusSet
* nex_input();
2509 virtual void nex_output(NexusSet
&);
2510 virtual bool emit_proc(struct target_t
*) const;
2511 virtual void dump(ostream
&, unsigned ind
) const;
2520 * The is the top of any process. It carries the type (initial or
2521 * always) and a pointer to the statement, probably a block, that
2522 * makes up the process.
2524 class NetProcTop
: public LineInfo
, public Attrib
{
2527 enum Type
{ KINITIAL
, KALWAYS
};
2529 NetProcTop(NetScope
*s
, Type t
, class NetProc
*st
);
2532 Type
type() const { return type_
; }
2533 NetProc
*statement();
2534 const NetProc
*statement() const;
2537 const NetScope
*scope() const;
2539 /* Return true if this process represents combinational logic. */
2540 bool is_asynchronous();
2542 /* Create asynchronous logic from this thread and return true,
2543 or return false if that cannot be done. */
2544 bool synth_async(Design
*des
);
2546 /* Return true if this process represents synchronous logic. */
2547 bool is_synchronous();
2549 /* Create synchronous logic from this thread and return true,
2550 or return false if that cannot be done. */
2551 bool synth_sync(Design
*des
);
2553 void dump(ostream
&, unsigned ind
) const;
2554 bool emit(struct target_t
*tgt
) const;
2558 NetProc
*const statement_
;
2561 friend class Design
;
2566 * This class represents a binary operator, with the left and right
2567 * operands and a single character for the operator. The operator
2570 * ^ -- Bit-wise exclusive OR
2571 * + -- Arithmetic add
2572 * - -- Arithmetic minus
2573 * * -- Arithmetic multiply
2574 * / -- Arithmetic divide
2575 * % -- Arithmetic modulus
2576 * p -- Arithmetic power (**)
2581 * e -- Logical equality (==)
2582 * E -- Case equality (===)
2583 * L -- Less or equal
2584 * G -- Greater or equal
2585 * n -- Logical inequality (!=)
2586 * N -- Case inequality (!==)
2587 * a -- Logical AND (&&)
2588 * A -- Bitwise NAND (~&)
2589 * o -- Logical OR (||)
2590 * O -- Bit-wise NOR (~|)
2591 * l -- Left shift (<<)
2592 * r -- Right shift (>>)
2593 * R -- signed right shift (>>>)
2594 * X -- Bitwise exclusive NOR (~^)
2596 class NetEBinary
: public NetExpr
{
2599 NetEBinary(char op
, NetExpr
*l
, NetExpr
*r
);
2602 const NetExpr
*left() const { return left_
; }
2603 const NetExpr
*right() const { return right_
; }
2605 char op() const { return op_
; }
2607 virtual bool set_width(unsigned w
, bool last_chance
=false);
2609 // A binary expression node only has a definite
2610 // self-determinable width if the operands both have definite
2612 virtual bool has_width() const;
2614 virtual NetEBinary
* dup_expr() const;
2615 virtual NexusSet
* nex_input();
2617 virtual void expr_scan(struct expr_scan_t
*) const;
2618 virtual void dump(ostream
&) const;
2625 void eval_sub_tree_();
2626 bool get_real_arguments_(verireal
&lv
, verireal
&rv
);
2630 * The addition operators have slightly more complex width
2631 * calculations because there is the optional carry bit that can be
2632 * used. The operators covered by this class are:
2633 * + -- Arithmetic add
2634 * - -- Arithmetic minus
2636 class NetEBAdd
: public NetEBinary
{
2639 NetEBAdd(char op
, NetExpr
*l
, NetExpr
*r
, bool lossless_flag
=false);
2642 virtual ivl_variable_type_t
expr_type() const;
2644 virtual bool set_width(unsigned w
, bool last_chance
);
2645 virtual NetEBAdd
* dup_expr() const;
2646 virtual NetExpr
* eval_tree(int prune_to_width
= -1);
2647 virtual NetNet
* synthesize(Design
*);
2650 NetECReal
* eval_tree_real_();
2654 * This class represents the integer division operators.
2658 class NetEBDiv
: public NetEBinary
{
2661 NetEBDiv(char op
, NetExpr
*l
, NetExpr
*r
);
2664 virtual ivl_variable_type_t
expr_type() const;
2666 virtual bool set_width(unsigned w
, bool last_chance
);
2667 virtual NetEBDiv
* dup_expr() const;
2668 virtual NetExpr
* eval_tree(int prune_to_width
= -1);
2669 virtual NetNet
* synthesize(Design
*);
2673 * The bitwise binary operators are represented by this class. This is
2674 * a specialization of the binary operator, so is derived from
2675 * NetEBinary. The particular constraints on these operators are that
2676 * operand and result widths match exactly, and each bit slice of the
2677 * operation can be represented by a simple gate. The operators
2678 * covered by this class are:
2680 * ^ -- Bit-wise exclusive OR
2684 * X -- Bit-wise XNOR (~^)
2686 class NetEBBits
: public NetEBinary
{
2689 NetEBBits(char op
, NetExpr
*l
, NetExpr
*r
);
2692 virtual bool set_width(unsigned w
, bool last_chance
);
2693 virtual NetEBBits
* dup_expr() const;
2694 virtual NetEConst
* eval_tree(int prune_to_width
= -1);
2696 virtual NetNet
* synthesize(Design
*);
2700 * The binary comparison operators are handled by this class. This
2701 * this case the bit width of the expression is 1 bit, and the
2702 * operands take their natural widths. The supported operators are:
2706 * e -- Logical equality (==)
2707 * E -- Case equality (===)
2708 * L -- Less or equal (<=)
2709 * G -- Greater or equal (>=)
2710 * n -- Logical inequality (!=)
2711 * N -- Case inequality (!==)
2713 class NetEBComp
: public NetEBinary
{
2716 NetEBComp(char op
, NetExpr
*l
, NetExpr
*r
);
2719 virtual bool set_width(unsigned w
, bool last_chance
);
2721 /* A compare expression has a definite width. */
2722 virtual bool has_width() const;
2723 virtual ivl_variable_type_t
expr_type() const;
2724 virtual NetEBComp
* dup_expr() const;
2725 virtual NetEConst
* eval_tree(int prune_to_width
= -1);
2727 virtual NetNet
* synthesize(Design
*);
2730 NetEConst
*eval_eqeq_(bool ne_flag
);
2731 NetEConst
*eval_less_();
2732 NetEConst
*eval_leeq_();
2733 NetEConst
*eval_leeq_real_();
2734 NetEConst
*eval_gt_();
2735 NetEConst
*eval_gteq_();
2736 NetEConst
*eval_eqeqeq_();
2737 NetEConst
*eval_neeqeq_();
2741 * The binary logical operators are those that return boolean
2742 * results. The supported operators are:
2744 * a -- Logical AND (&&)
2745 * o -- Logical OR (||)
2747 class NetEBLogic
: public NetEBinary
{
2750 NetEBLogic(char op
, NetExpr
*l
, NetExpr
*r
);
2753 virtual bool set_width(unsigned w
, bool last_chance
);
2754 virtual NetEBLogic
* dup_expr() const;
2755 virtual NetEConst
* eval_tree(int prune_to_width
= -1);
2756 virtual NetNet
* synthesize(Design
*);
2763 * Support the binary multiplication (*) operator.
2765 class NetEBMult
: public NetEBinary
{
2768 NetEBMult(char op
, NetExpr
*l
, NetExpr
*r
);
2771 virtual ivl_variable_type_t
expr_type() const;
2773 virtual bool set_width(unsigned w
, bool last_chance
);
2774 virtual NetEBMult
* dup_expr() const;
2775 virtual NetExpr
* eval_tree(int prune_to_width
= -1);
2776 virtual NetNet
* synthesize(Design
*);
2780 NetExpr
* eval_tree_real_();
2785 * Support the binary multiplication (*) operator.
2787 class NetEBPow
: public NetEBinary
{
2790 NetEBPow(char op
, NetExpr
*l
, NetExpr
*r
);
2793 virtual ivl_variable_type_t
expr_type() const;
2795 virtual bool set_width(unsigned w
, bool last_chance
);
2796 virtual NetEBPow
* dup_expr() const;
2797 virtual NetExpr
* eval_tree(int prune_to_width
= -1);
2798 virtual NetNet
* synthesize(Design
*);
2802 NetExpr
* eval_tree_real_();
2808 * The binary logical operators are those that return boolean
2809 * results. The supported operators are:
2811 * l -- left shift (<<)
2812 * r -- right shift (>>)
2813 * R -- right shift arithmetic (>>>)
2815 class NetEBShift
: public NetEBinary
{
2818 NetEBShift(char op
, NetExpr
*l
, NetExpr
*r
);
2821 virtual bool set_width(unsigned w
, bool last_chance
);
2823 // A shift expression only needs the left expression to have a
2824 // definite width to give the expression a definite width.
2825 virtual bool has_width() const;
2827 virtual NetEBShift
* dup_expr() const;
2828 virtual NetEConst
* eval_tree(int prune_to_width
= -1);
2830 virtual NetNet
* synthesize(Design
*);
2837 * This expression node supports the concat expression. This is an
2838 * operator that just glues the results of many expressions into a
2841 * Note that the class stores the parameter expressions in source code
2842 * order. That is, the parm(0) is placed in the most significant
2843 * position of the result.
2845 class NetEConcat
: public NetExpr
{
2848 NetEConcat(unsigned cnt
, NetExpr
* repeat
=0);
2851 // Manipulate the parameters.
2852 void set(unsigned idx
, NetExpr
*e
);
2855 unsigned repeat() const;
2856 unsigned nparms() const { return parms_
.count() ; }
2857 NetExpr
* parm(unsigned idx
) const { return parms_
[idx
]; }
2859 virtual NexusSet
* nex_input();
2860 virtual bool has_width() const;
2861 virtual bool set_width(unsigned w
, bool last_chance
=false);
2862 virtual NetEConcat
* dup_expr() const;
2863 virtual NetEConst
* eval_tree(int prune_to_width
= -1);
2864 virtual NetNet
*synthesize(Design
*);
2865 virtual void expr_scan(struct expr_scan_t
*) const;
2866 virtual void dump(ostream
&) const;
2869 svector
<NetExpr
*>parms_
;
2871 unsigned repeat_value_
;
2872 bool repeat_calculated_
;
2877 * This class is a placeholder for a parameter expression. When
2878 * parameters are first created, an instance of this object is used to
2879 * hold the place where the parameter expression goes. Then, when the
2880 * parameters are resolved, these objects are removed.
2882 * If the parameter object is created with a path and name, then the
2883 * object represents a reference to a parameter that is known to exist.
2885 class NetEParam
: public NetExpr
{
2888 NetEParam(class Design
*des
, NetScope
*scope
, perm_string name
);
2891 virtual NexusSet
* nex_input();
2892 virtual bool set_width(unsigned w
, bool last_chance
);
2893 virtual bool has_width() const;
2894 virtual void expr_scan(struct expr_scan_t
*) const;
2895 virtual NetExpr
* eval_tree(int prune_to_width
= -1);
2896 virtual NetEParam
* dup_expr() const;
2898 virtual void dump(ostream
&) const;
2908 * This expression node supports bit/part selects from general
2909 * expressions. The sub-expression is self-sized, and has bits
2910 * selected from it. The base is the expression that identifies the
2911 * lsb of the expression, and the wid is the width of the part select,
2912 * or 1 for a bit select. No matter what the subexpression is, the
2913 * base is translated in canonical bits. It is up to the elaborator
2914 * to figure this out and adjust the expression if the subexpression
2915 * has a non-canonical base or direction.
2917 * If the base expression is null, then this expression node can be
2918 * used to express width expansion, signed or unsigned depending on
2919 * the has_sign() flag.
2921 class NetESelect
: public NetExpr
{
2924 NetESelect(NetExpr
*exp
, NetExpr
*base
, unsigned wid
);
2927 const NetExpr
*sub_expr() const;
2928 const NetExpr
*select() const;
2930 virtual NexusSet
* nex_input();
2931 virtual bool set_width(unsigned w
, bool last_chance
=false);
2932 virtual bool has_width() const;
2933 virtual void expr_scan(struct expr_scan_t
*) const;
2934 virtual NetEConst
* eval_tree(int prune_to_width
= -1);
2935 virtual NetESelect
* dup_expr() const;
2936 virtual NetNet
*synthesize(Design
*des
);
2937 virtual void dump(ostream
&) const;
2945 * This node is for representation of named events.
2947 class NetEEvent
: public NetExpr
{
2950 NetEEvent(NetEvent
*);
2953 const NetEvent
* event() const;
2955 virtual void expr_scan(struct expr_scan_t
*) const;
2956 virtual NetEEvent
* dup_expr() const;
2957 virtual NexusSet
* nex_input();
2959 virtual void dump(ostream
&os
) const;
2966 * This class is a special (and magical) expression node type that
2967 * represents scope names. These can only be found as parameters to
2970 class NetEScope
: public NetExpr
{
2973 NetEScope(NetScope
*);
2976 const NetScope
* scope() const;
2978 virtual void expr_scan(struct expr_scan_t
*) const;
2979 virtual NetEScope
* dup_expr() const;
2980 virtual NexusSet
* nex_input();
2982 virtual void dump(ostream
&os
) const;
2989 * This node represents a system function call in an expression. The
2990 * object contains the name of the system function, which the backend
2991 * uses to do VPI matching.
2993 class NetESFunc
: public NetExpr
{
2996 NetESFunc(const char*name
, ivl_variable_type_t t
,
2997 unsigned width
, unsigned nprms
);
3000 const char* name() const;
3002 unsigned nparms() const;
3003 void parm(unsigned idx
, NetExpr
*expr
);
3004 NetExpr
* parm(unsigned idx
);
3005 const NetExpr
* parm(unsigned idx
) const;
3007 virtual ivl_variable_type_t
expr_type() const;
3008 virtual NexusSet
* nex_input();
3009 virtual bool set_width(unsigned, bool last_chance
);
3010 virtual void dump(ostream
&) const;
3012 virtual void expr_scan(struct expr_scan_t
*) const;
3013 virtual NetESFunc
*dup_expr() const;
3017 ivl_variable_type_t type_
;
3021 private: // not implemented
3022 NetESFunc(const NetESFunc
&);
3023 NetESFunc
& operator= (const NetESFunc
&);
3027 * This class represents the ternary (?:) operator. It has 3
3028 * expressions, one of which is a condition used to select which of
3029 * the other two expressions is the result.
3031 class NetETernary
: public NetExpr
{
3034 NetETernary(NetExpr
*c
, NetExpr
*t
, NetExpr
*f
);
3037 virtual bool set_width(unsigned w
, bool last_chance
);
3039 const NetExpr
*cond_expr() const;
3040 const NetExpr
*true_expr() const;
3041 const NetExpr
*false_expr() const;
3043 virtual NetETernary
* dup_expr() const;
3044 virtual NetExpr
* eval_tree(int prune_to_width
= -1);
3046 virtual ivl_variable_type_t
expr_type() const;
3047 virtual NexusSet
* nex_input();
3048 virtual void expr_scan(struct expr_scan_t
*) const;
3049 virtual void dump(ostream
&) const;
3050 virtual NetNet
*synthesize(Design
*);
3059 * This class represents a unary operator, with the single operand
3060 * and a single character for the operator. The operator values are:
3062 * ~ -- Bit-wise negation
3063 * ! -- Logical negation
3064 * & -- Reduction AND
3066 * ^ -- Reduction XOR
3069 * A -- Reduction NAND (~&)
3070 * N -- Reduction NOR (~|)
3071 * X -- Reduction NXOR (~^ or ^~)
3073 class NetEUnary
: public NetExpr
{
3076 NetEUnary(char op
, NetExpr
*ex
);
3079 char op() const { return op_
; }
3080 const NetExpr
* expr() const { return expr_
; }
3082 virtual bool set_width(unsigned w
, bool last_chance
);
3084 virtual NetEUnary
* dup_expr() const;
3085 virtual NetEConst
* eval_tree(int prune_to_width
= -1);
3087 virtual ivl_variable_type_t
expr_type() const;
3088 virtual NexusSet
* nex_input();
3089 virtual void expr_scan(struct expr_scan_t
*) const;
3090 virtual void dump(ostream
&) const;
3099 class NetEUBits
: public NetEUnary
{
3102 NetEUBits(char op
, NetExpr
*ex
);
3105 virtual NetNet
* synthesize(Design
*);
3107 virtual NetEConst
* eval_tree(int prune_to_width
= -1);
3108 virtual ivl_variable_type_t
expr_type() const;
3111 class NetEUReduce
: public NetEUnary
{
3114 NetEUReduce(char op
, NetExpr
*ex
);
3117 virtual bool set_width(unsigned w
, bool last_chance
);
3118 virtual NetNet
* synthesize(Design
*);
3119 virtual NetEUReduce
* dup_expr() const;
3120 virtual NetEConst
* eval_tree(int prune_to_width
= -1);
3121 virtual ivl_variable_type_t
expr_type() const;
3125 * When a signal shows up in an expression, this type represents
3126 * it. From this the expression can get any kind of access to the
3127 * structural signal, including arrays.
3129 * The NetESignal may refer to an array, if the word_index is
3130 * included. This expression calculates the index of the word in the
3131 * array. It may only be nil if the expression refers to the whole
3132 * array, and that is legal only in limited situation.
3134 class NetESignal
: public NetExpr
{
3137 NetESignal(NetNet
*n
);
3138 NetESignal(NetNet
*n
, NetExpr
*word_index
);
3141 perm_string
name() const;
3142 virtual bool set_width(unsigned, bool last_chance
);
3144 virtual NetESignal
* dup_expr() const;
3145 NetNet
* synthesize(Design
*des
);
3146 NexusSet
* nex_input();
3148 // This is the expression for selecting an array word, if this
3149 // signal refers to an array.
3150 const NetExpr
* word_index() const;
3152 // This is the width of the vector that this signal refers to.
3153 unsigned vector_width() const;
3154 // Point back to the signal that this expression node references.
3155 const NetNet
* sig() const;
3157 // Declared vector dimensions for the signal.
3158 unsigned msi() const;
3159 unsigned lsi() const;
3161 virtual ivl_variable_type_t
expr_type() const;
3163 virtual void expr_scan(struct expr_scan_t
*) const;
3164 virtual void dump(ostream
&) const;
3168 // Expression to select a word from the net.
3174 * This object type is used to contain a logical scope within a
3175 * design. The scope doesn't represent any executable hardware, but is
3176 * just a handle that netlist processors can use to grab at the design.
3178 class NetScope
: public Attrib
{
3181 enum TYPE
{ MODULE
, TASK
, FUNC
, BEGIN_END
, FORK_JOIN
, GENBLOCK
};
3183 /* Create a new scope, and attach it to the given parent. The
3184 name is expected to have been permallocated. */
3185 NetScope(NetScope
*up
, const hname_t
&name
, TYPE t
);
3188 /* Parameters exist within a scope, and these methods allow
3189 one to manipulate the set. In these cases, the name is the
3190 *simple* name of the parameter, the hierarchy is implicit in
3191 the scope. The return value from set_parameter is the
3192 previous expression, if there was one. */
3194 NetExpr
* set_parameter(perm_string name
, NetExpr
*val
,
3195 NetExpr
*msb
, NetExpr
*lsb
, bool signed_flag
);
3196 NetExpr
* set_localparam(perm_string name
, NetExpr
*val
);
3198 const NetExpr
*get_parameter(const char* name
,
3200 const NetExpr
*&lsb
) const;
3202 /* These are used by defparam elaboration to replace the
3203 expression with a new expression, without affecting the
3204 range or signed_flag. Return false if the name does not
3206 bool replace_parameter(perm_string name
, NetExpr
*val
);
3208 /* These methods set or access events that live in this
3211 void add_event(NetEvent
*);
3212 void rem_event(NetEvent
*);
3213 NetEvent
*find_event(const char*name
);
3216 /* These methods manage signals. The add_ and rem_signal
3217 methods are used by the NetNet objects to make themselves
3218 available to the scope, and the find_signal method can be
3219 used to locate signals within a scope. */
3221 void add_signal(NetNet
*);
3222 void rem_signal(NetNet
*);
3223 NetNet
* find_signal(const char*name
);
3225 /* The parent and child() methods allow users of NetScope
3226 objects to locate nearby scopes. */
3228 NetScope
* child(const hname_t
&name
);
3229 const NetScope
* parent() const;
3230 const NetScope
* child(const hname_t
&name
) const;
3234 void set_task_def(NetTaskDef
*);
3235 void set_func_def(NetFuncDef
*);
3236 void set_module_name(perm_string
);
3238 NetTaskDef
* task_def();
3239 NetFuncDef
* func_def();
3241 const NetTaskDef
* task_def() const;
3242 const NetFuncDef
* func_def() const;
3244 /* If the scope represents a module instance, the module_name
3245 is the name of the module itself. */
3246 perm_string
module_name() const;
3248 /* Scopes have their own time units and time precision. The
3249 unit and precision are given as power of 10, i.e., -3 is
3250 units of milliseconds.
3252 If a NetScope is created with a parent scope, the new scope
3253 will initially inherit the unit and precision of the
3256 void time_unit(int);
3257 void time_precision(int);
3259 int time_unit() const;
3260 int time_precision() const;
3262 void default_nettype(NetNet::Type
);
3263 NetNet::Type
default_nettype() const;
3265 /* The name of the scope is the fully qualified hierarchical
3266 name, whereas the basename is just my name within my parent
3268 perm_string
basename() const;
3269 const hname_t
& fullname() const { return name_
; }
3271 void run_defparams(class Design
*);
3272 void evaluate_parameters(class Design
*);
3274 /* This method generates a non-hierarchical name that is
3275 guaranteed to be unique within this scope. */
3276 perm_string
local_symbol();
3278 void dump(ostream
&) const;
3279 void emit_scope(struct target_t
*tgt
) const;
3280 bool emit_defs(struct target_t
*tgt
) const;
3282 /* This method runs the functor on me. Recurse through the
3283 children of this node as well. */
3284 void run_functor(Design
*des
, functor_t
*fun
);
3287 /* This member is used during elaboration to pass defparam
3288 assignments from the scope pass to the parameter evaluation
3289 step. After that, it is not used. */
3291 map
<pform_name_t
,NetExpr
*>defparams
;
3294 /* After everything is all set up, the code generators like
3295 access to these things to make up the parameter lists. */
3296 struct param_expr_t
{
3302 map
<perm_string
,param_expr_t
>parameters
;
3303 map
<perm_string
,param_expr_t
>localparams
;
3306 ivl_variable_type_t type
;
3308 double real_val
; // type == IVL_VT_REAL
3309 long integer
; // type == IVL_VT_BOOL
3312 map
<perm_string
,spec_val_t
>specparams
;
3314 /* Module instance arrays are collected here for access during
3315 the multiple elaboration passes. */
3316 typedef svector
<NetScope
*> scope_vec_t
;
3317 map
<perm_string
, scope_vec_t
>instance_arrays
;
3319 /* Loop generate uses this as scratch space during
3320 elaboration. Expression evaluation can use this to match
3322 perm_string genvar_tmp
;
3323 long genvar_tmp_val
;
3329 signed char time_unit_
, time_prec_
;
3330 NetNet::Type default_nettype_
;
3334 perm_string module_name_
;
3348 * This class contains an entire design. It includes processes and a
3349 * netlist, and can be passed around from function to function.
3358 /* The flags are a generic way of accepting command line
3359 parameters/flags and passing them to the processing steps
3360 that deal with the design. The compilation driver sets the
3361 entire flags map after elaboration is done. Subsequent
3362 steps can then use the get_flag() function to get the value
3363 of an interesting key. */
3365 void set_flags(const map
<string
,const char*>&f
) { flags_
= f
; }
3367 const char* get_flag(const string
&key
) const;
3369 NetScope
* make_root_scope(perm_string name
);
3370 NetScope
* find_root_scope();
3371 list
<NetScope
*> find_root_scopes();
3373 const list
<NetScope
*> find_root_scopes() const;
3375 /* Attempt to set the precision to the specified value. If the
3376 precision is already more precise, the keep the precise
3377 setting. This is intended to hold the simulation precision
3378 for use throughout the entire design. */
3380 void set_precision(int val
);
3381 int get_precision() const;
3383 /* This function takes a delay value and a scope, and returns
3384 the delay value scaled to the precision of the design. */
3385 uint64_t scale_to_precision(uint64_t, const NetScope
*)const;
3387 /* Look up a scope. If no starting scope is passed, then the
3388 path is taken as an absolute scope name. Otherwise, the
3389 scope is located starting at the passed scope and working
3391 NetScope
* find_scope(const std::list
<hname_t
>&path
) const;
3392 NetScope
* find_scope(NetScope
*, const std::list
<hname_t
>&path
) const;
3396 void run_defparams();
3397 void evaluate_parameters();
3399 /* This method locates a signal, starting at a given
3400 scope. The name parameter may be partially hierarchical, so
3401 this method, unlike the NetScope::find_signal method,
3402 handles global name binding. */
3404 NetNet
*find_signal(NetScope
*scope
, pform_name_t path
);
3407 NetFuncDef
* find_function(NetScope
*scope
, const pform_name_t
&key
);
3410 NetScope
* find_task(NetScope
*scope
, const pform_name_t
&name
);
3413 void add_node(NetNode
*);
3414 void del_node(NetNode
*);
3417 void add_process(NetProcTop
*);
3418 void delete_process(NetProcTop
*);
3420 // Iterate over the design...
3421 void dump(ostream
&) const;
3422 void functor(struct functor_t
*);
3423 int emit(struct target_t
*) const;
3425 // This is incremented by elaboration when an error is
3426 // detected. It prevents code being emitted.
3430 string
local_symbol(const string
&path
);
3433 // Keep a tree of scopes. The NetScope class handles the wide
3434 // tree and per-hop searches for me.
3435 list
<NetScope
*>root_scopes_
;
3437 // List the nodes in the design.
3439 // These are in support of the node functor iterator.
3440 NetNode
*nodes_functor_cur_
;
3441 NetNode
*nodes_functor_nxt_
;
3443 // List the processes in the design.
3445 NetProcTop
*procs_idx_
;
3447 map
<string
,const char*> flags_
;
3453 private: // not implemented
3454 Design(const Design
&);
3455 Design
& operator= (const Design
&);
3462 inline bool operator == (const Link
&l
, const Link
&r
)
3463 { return l
.is_equal(r
); }
3465 inline bool operator != (const Link
&l
, const Link
&r
)
3466 { return ! l
.is_equal(r
); }
3468 /* Connect the pins of two nodes together. Either may already be
3469 connected to other things, connect is transitive. */
3470 extern void connect(Link
&, Link
&);
3472 /* Return true if l and r are connected. */
3473 inline bool connected(const Link
&l
, const Link
&r
)
3474 { return l
.is_linked(r
); }
3476 /* Return the number of links in the ring that are of the specified
3478 extern unsigned count_inputs(const Link
&pin
);
3479 extern unsigned count_outputs(const Link
&pin
);
3480 extern unsigned count_signals(const Link
&pin
);
3482 /* Find the next link that is an output into the nexus. */
3483 extern Link
* find_next_output(Link
*lnk
);
3485 /* Find the signal connected to the given node pin. There should
3486 always be exactly one signal. The bidx parameter gets filled with
3487 the signal index of the Net, in case it is a vector. */
3488 const NetNet
* find_link_signal(const NetObj
*net
, unsigned pin
,
3491 inline ostream
& operator << (ostream
&o
, const NetExpr
&exp
)
3492 { exp
.dump(o
); return o
; }
3494 extern ostream
& operator << (ostream
&, NetNet::Type
);
3497 * Manipulator to dump a scope complete path to the output. The
3498 * manipulator is "scope_path" and works like this:
3500 * out << .... << scope_path(sc) << ... ;
3502 struct __ScopePathManip
{ const NetScope
*scope
; };
3503 inline __ScopePathManip
scope_path(const NetScope
*scope
)
3504 { __ScopePathManip tmp
; tmp
.scope
= scope
; return tmp
; }
3506 extern ostream
& operator << (ostream
&o
, __ScopePathManip
);
3510 * $Log: netlist.h,v $
3511 * Revision 1.380 2007/06/02 03:42:13 steve
3512 * Properly evaluate scope path expressions.
3514 * Revision 1.379 2007/05/24 04:07:12 steve
3515 * Rework the heirarchical identifier parse syntax and pform
3516 * to handle more general combinations of heirarch and bit selects.
3518 * Revision 1.378 2007/04/26 03:06:22 steve
3519 * Rework hname_t to use perm_strings.
3521 * Revision 1.377 2007/04/17 04:34:23 steve
3522 * Fix handling calls to tasks in combinational always block
3524 * Revision 1.376 2007/04/07 04:46:18 steve
3525 * Handle evaluate of addition of real valued constants.
3527 * Revision 1.375 2007/04/02 01:12:34 steve
3528 * Seperate arrayness from word count
3530 * Revision 1.374 2007/03/26 18:17:50 steve
3531 * Remove pretense of general use for t_cookie.
3533 * Revision 1.373 2007/03/22 16:08:16 steve
3534 * Spelling fixes from Larry
3536 * Revision 1.372 2007/03/08 05:30:03 steve
3537 * Limit the calculated widths of constants.
3539 * Revision 1.371 2007/03/02 06:13:22 steve
3540 * Add support for edge sensitive spec paths.
3542 * Revision 1.370 2007/03/01 06:19:38 steve
3543 * Add support for conditional specify delay paths.
3545 * Revision 1.369 2007/02/20 05:58:36 steve
3546 * Handle unary minus of real valued expressions.
3548 * Revision 1.368 2007/02/14 05:59:46 steve
3549 * Handle type of ternary expressions properly.
3551 * Revision 1.367 2007/02/02 04:33:00 steve
3552 * Use inttypes.h instead of stdint.h for portability.
3554 * Revision 1.366 2007/01/16 05:44:15 steve
3555 * Major rework of array handling. Memories are replaced with the
3556 * more general concept of arrays. The NetMemory and NetEMemory
3557 * classes are removed from the ivl core program, and the IVL_LPM_RAM
3558 * lpm type is removed from the ivl_target API.
3560 * Revision 1.365 2006/11/04 06:19:25 steve
3561 * Remove last bits of relax_width methods, and use test_width
3562 * to calculate the width of an r-value expression that may
3563 * contain unsized numbers.
3565 * Revision 1.364 2006/10/30 05:44:49 steve
3566 * Expression widths with unsized literals are pseudo-infinite width.
3568 * Revision 1.363 2006/10/03 05:06:00 steve
3569 * Support real valued specify delays, properly scaled.
3571 * Revision 1.362 2006/09/26 19:48:40 steve
3572 * Missing PSpec.cc file.
3574 * Revision 1.361 2006/09/23 04:57:19 steve
3575 * Basic support for specify timing.
3577 * Revision 1.360 2006/08/08 05:11:37 steve
3578 * Handle 64bit delay constants.
3580 * Revision 1.359 2006/07/31 03:50:17 steve
3581 * Add support for power in constant expressions.
3583 * Revision 1.358 2006/06/18 04:15:50 steve
3584 * Add support for system functions in continuous assignments.
3586 * Revision 1.357 2006/04/10 00:37:42 steve
3587 * Add support for generate loops w/ wires and gates.
3589 * Revision 1.356 2006/03/18 22:53:04 steve
3590 * Properly handle signedness in compare.
3592 * Revision 1.355 2006/02/02 02:43:58 steve
3593 * Allow part selects of memory words in l-values.
3595 * Revision 1.354 2006/01/02 05:33:19 steve
3596 * Node delays can be more general expressions in structural contexts.
3598 * Revision 1.353 2005/11/27 05:56:20 steve
3599 * Handle bit select of parameter with ranges.
3601 * Revision 1.352 2005/11/26 00:35:43 steve
3602 * More precise about r-value width of constants.
3604 * Revision 1.351 2005/09/19 21:45:36 steve
3605 * Spelling patches from Larry.
3607 * Revision 1.350 2005/09/14 02:53:14 steve
3608 * Support bool expressions and compares handle them optimally.
3610 * Revision 1.349 2005/09/01 04:11:37 steve
3611 * Generate code to handle real valued muxes.
3613 * Revision 1.348 2005/08/31 05:07:31 steve
3614 * Handle memory references is continuous assignments.
3616 * Revision 1.347 2005/07/14 23:34:19 steve
3617 * gcc4 compile errors.
3619 * Revision 1.346 2005/07/11 16:56:50 steve
3620 * Remove NetVariable and ivl_variable_t structures.
3622 * Revision 1.345 2005/07/07 16:22:49 steve
3623 * Generalize signals to carry types.
3625 * Revision 1.344 2005/05/24 01:44:28 steve
3626 * Do sign extension of structuran nets.
3628 * Revision 1.343 2005/05/17 20:56:55 steve
3629 * Parameters cannot have their width changed.
3631 * Revision 1.342 2005/05/08 23:44:08 steve
3632 * Add support for variable part select.
3634 * Revision 1.341 2005/04/24 23:44:02 steve
3635 * Update DFF support to new data flow.
3637 * Revision 1.340 2005/04/08 04:51:16 steve
3638 * All memory addresses are signed.
3640 * Revision 1.339 2005/04/06 05:29:08 steve
3641 * Rework NetRamDq and IVL_LPM_RAM nodes.
3643 * Revision 1.338 2005/03/18 02:56:03 steve
3644 * Add support for LPM_UFUNC user defined functions.
3646 * Revision 1.337 2005/03/12 06:43:36 steve
3647 * Update support for LPM_MOD.
3649 * Revision 1.336 2005/03/09 05:52:04 steve
3650 * Handle case inequality in netlists.
3652 * Revision 1.335 2005/02/19 02:43:38 steve
3653 * Support shifts and divide.
3655 * Revision 1.334 2005/02/12 06:25:40 steve
3656 * Restructure NetMux devices to pass vectors.
3657 * Generate NetMux devices from ternary expressions,
3658 * Reduce NetMux devices to bufif when appropriate.
3660 * Revision 1.333 2005/02/08 00:12:36 steve
3661 * Add the NetRepeat node, and code generator support.
3663 * Revision 1.332 2005/02/03 04:56:20 steve
3664 * laborate reduction gates into LPM_RED_ nodes.
3666 * Revision 1.331 2005/01/30 01:43:48 steve
3667 * Clarify width argument to NetNet constructor.
3669 * Revision 1.330 2005/01/28 05:39:33 steve
3670 * Simplified NetMult and IVL_LPM_MULT.
3672 * Revision 1.329 2005/01/24 05:28:31 steve
3673 * Remove the NetEBitSel and combine all bit/part select
3674 * behavior into the NetESelect node and IVL_EX_SELECT
3675 * ivl_target expression type.
3677 * Revision 1.328 2005/01/22 18:16:01 steve
3678 * Remove obsolete NetSubnet class.
3680 * Revision 1.327 2005/01/22 01:06:55 steve
3681 * Change case compare from logic to an LPM node.
3683 * Revision 1.326 2005/01/16 04:20:32 steve
3684 * Implement LPM_COMPARE nodes as two-input vector functors.
3686 * Revision 1.325 2005/01/12 03:17:37 steve
3687 * Properly pad vector widths in pgassign.
3689 * Revision 1.324 2005/01/09 20:16:01 steve
3690 * Use PartSelect/PV and VP to handle part selects through ports.
3692 * Revision 1.323 2004/12/29 23:55:43 steve
3693 * Unify elaboration of l-values for all proceedural assignments,
3694 * including assing, cassign and force.
3696 * Generate NetConcat devices for gate outputs that feed into a
3697 * vector results. Use this to hande gate arrays. Also let gate
3698 * arrays handle vectors of gates when the outputs allow for it.
3700 * Revision 1.322 2004/12/11 02:31:27 steve
3701 * Rework of internals to carry vectors through nexus instead
3702 * of single bits. Make the ivl, tgt-vvp and vvp initial changes
3705 * Revision 1.321 2004/10/04 01:10:54 steve
3706 * Clean up spurious trailing white space.
3708 * Revision 1.320 2004/10/04 00:25:18 steve
3709 * Remove inaccurate comment.
3711 * Revision 1.319 2004/09/05 17:44:42 steve
3712 * Add support for module instance arrays.
3714 * Revision 1.318 2004/09/04 04:24:15 steve
3715 * PR1026: assignment statements can have sensitivities in the l-values.
3717 * Revision 1.317 2004/08/28 16:23:05 steve
3718 * Fix use of system tasks in AT_STAR statements.
3720 * Revision 1.316 2004/08/28 15:08:31 steve
3721 * Do not change reg to wire in NetAssign_ unless synthesizing.
3723 * Revision 1.315 2004/06/30 15:32:18 steve
3724 * nex_output for NetPDelay statements.
3726 * Revision 1.314 2004/06/30 02:16:26 steve
3727 * Implement signed divide and signed right shift in nets.
3729 * Revision 1.313 2004/06/13 04:56:55 steve
3730 * Add support for the default_nettype directive.
3732 * Revision 1.312 2004/05/31 23:34:38 steve
3733 * Rewire/generalize parsing an elaboration of
3734 * function return values to allow for better
3735 * speed and more type support.
3737 * Revision 1.311 2004/02/20 06:22:57 steve
3738 * parameter keys are per_strings.
3740 * Revision 1.310 2004/02/19 07:06:57 steve
3741 * LPM, logic and Variables have perm_string names.
3743 * Revision 1.309 2004/02/19 06:57:10 steve
3744 * Memory and Event names use perm_string.
3746 * Revision 1.308 2004/02/18 17:11:57 steve
3747 * Use perm_strings for named langiage items.
3749 * Revision 1.307 2003/12/17 16:52:39 steve
3750 * Debug dumps for synth2.
3752 * Revision 1.306 2003/11/10 20:59:03 steve
3753 * Design::get_flag returns const char* instead of string.
3755 * Revision 1.305 2003/11/08 20:06:21 steve
3756 * Spelling fixes in comments.
3758 * Revision 1.304 2003/10/31 02:47:11 steve
3759 * NetEUReduce has its own dup_expr method.