2 * Copyright (c) 2000 Stephen Williams (steve@icarus.com)
4 * This source code is free software; you can redistribute it
5 * and/or modify it in source code form under the terms of the GNU
6 * General Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or (at your option)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20 #ident "$Id: Attrib.cc,v 1.6 2004/02/20 18:53:33 steve Exp $"
40 const verinum
& Attrib::attribute(perm_string key
) const
42 for (unsigned idx
= 0 ; idx
< nlist_
; idx
+= 1) {
44 if (key
== list_
[idx
].key
)
45 return list_
[idx
].val
;
48 static const verinum null
;
52 void Attrib::attribute(perm_string key
, const verinum
&value
)
56 for (idx
= 0 ; idx
< nlist_
; idx
+= 1) {
57 if (key
== list_
[idx
].key
) {
58 list_
[idx
].val
= value
;
63 struct cell_
*tmp
= new struct cell_
[nlist_
+1];
64 for (idx
= 0 ; idx
< nlist_
; idx
+= 1)
65 tmp
[idx
] = list_
[idx
];
67 tmp
[nlist_
].key
= key
;
68 tmp
[nlist_
].val
= value
;
75 bool Attrib::has_compat_attributes(const Attrib
&that
) const
79 for (idx
= 0 ; idx
< that
.nlist_
; idx
+= 1) {
81 verinum tmp
= attribute(that
.list_
[idx
].key
);
82 if (tmp
!= that
.list_
[idx
].val
)
89 unsigned Attrib::attr_cnt() const
94 perm_string
Attrib::attr_key(unsigned idx
) const
97 return list_
[idx
].key
;
100 const verinum
& Attrib::attr_value(unsigned idx
) const
102 assert(idx
< nlist_
);
103 return list_
[idx
].val
;
108 * $Log: Attrib.cc,v $
109 * Revision 1.6 2004/02/20 18:53:33 steve
110 * Addtrbute keys are perm_strings.
112 * Revision 1.5 2002/08/12 01:34:58 steve
113 * conditional ident string using autoconfig.
115 * Revision 1.4 2002/05/26 01:39:02 steve
116 * Carry Verilog 2001 attributes with processes,
117 * all the way through to the ivl_target API.
119 * Divide signal reference counts between rval
120 * and lval references.
122 * Revision 1.3 2002/05/23 03:08:50 steve
123 * Add language support for Verilog-2001 attribute
124 * syntax. Hook this support into existing $attribute
125 * handling, and add number and void value types.
127 * Add to the ivl_target API new functions for access
128 * of complex attributes attached to gates.
130 * Revision 1.2 2001/07/25 03:10:48 steve
131 * Create a config.h.in file to hold all the config
132 * junk, and support gcc 3.0. (Stephan Boettcher)
134 * Revision 1.1 2000/12/04 17:37:03 steve
135 * Add Attrib class for holding NetObj attributes.