Representation of
Verilog-2005 and SystemVerilog-2012 allow many constructs, (e.g., module instances, wire declarations, assignments, subexpressions, and so on) to be annotated with attributes.
Each individual attribute can either be a single key with no value (e.g.,
We represent attributes as alists mapping names to their values. We use
ordinary ACL2 strings to represent the keys. These strings are typically
honsed to improve memory sharing. Each explicit value is represented by an
ordinary vl-expr-p, and keys with no values are bound to
Function:
(defun vl-atts-p (x) (declare (xargs :guard t)) (let ((__function__ 'vl-atts-p)) (declare (ignorable __function__)) (if (atom x) (eq x nil) (and (consp (car x)) (stringp (caar x)) (vl-maybe-expr-p (cdar x)) (vl-atts-p (cdr x))))))
Verilog-2005 doesn't say anything about the types of attribute expressions.
SystemVerilog-2012 says (Section 5.12) that the type of an attribute with no
value is
This is not really an adequate spec. Consider for instance an attribute like:
(* foo = a + b *)
Attributes live in their own namespace and are generally not very
well-specified. It isn't clear what
Well, no matter. Attributes are not used for much and if their sizes and types aren't well specified, that's not necessarily any kind of problem. For VL's part, our sizing code simply ignores attributes and does not try to determine their sizes and types at all.
Note that both Verilog-2005 and SystemVerilog-2012 prohibit the nesting of attributes. That is, expressions like the following are not allowed:
(* foo = a + (* bar *) b *)
VL's parser enforces this restriction and will not allow expressions to have nested attributes; see vl-parse-0+-attribute-instances.
Internally we make no such restriction. Our vl-expr-p structures can have attributes nested to any arbitrary depth.
When the same attribute name is given repeatedly, both Verilog-2005 and
SystemVerilog-2012 agree that the last occurrences of the attribute should be
used. That is, the value of
(* foo = 1, foo = 5 *) assign w = a + b;
VL's parser properly handles this case. It issues warnings when duplicate
attributes are used, and always produces
Internally we make no such restriction. We treat
VL transformations occasionally add attributes throughout modules. As a couple of examples:
As a general rule, attributes added by VL should be prefixed with