Skip to content
This repository
Newer
Older
100644 139 lines (115 sloc) 3.374 kb
4f638882 »
2000-12-04 Add Attrib class for holding NetObj attributes.
1 /*
2 * Copyright (c) 2000 Stephen Williams (steve@icarus.com)
3 *
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)
8 * any later version.
9 *
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.
14 *
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
18 */
52bf4e61 »
2002-08-12 conditional ident string using autoconfig.
19 #ifdef HAVE_CVS_IDENT
177b6ffb »
2004-02-20 Addtrbute keys are perm_strings.
20 #ident "$Id: Attrib.cc,v 1.6 2004/02/20 18:53:33 steve Exp $"
4f638882 »
2000-12-04 Add Attrib class for holding NetObj attributes.
21 #endif
22
b825f8d2 »
2001-07-25 Create a config.h.in file to hold all the config
23 # include "config.h"
24
4f638882 »
2000-12-04 Add Attrib class for holding NetObj attributes.
25 # include "Attrib.h"
26 # include <assert.h>
27
28 Attrib::Attrib()
29 {
30 nlist_ = 0;
31 list_ = 0;
32 }
33
34 Attrib::~Attrib()
35 {
36 delete[] list_;
37 }
38
39
177b6ffb »
2004-02-20 Addtrbute keys are perm_strings.
40 const verinum& Attrib::attribute(perm_string key) const
4f638882 »
2000-12-04 Add Attrib class for holding NetObj attributes.
41 {
42 for (unsigned idx = 0 ; idx < nlist_ ; idx += 1) {
43
44 if (key == list_[idx].key)
45 return list_[idx].val;
46 }
47
e6c06296 »
2002-05-23 Add language support for Verilog-2001 attribute
48 static const verinum null;
49 return null;
4f638882 »
2000-12-04 Add Attrib class for holding NetObj attributes.
50 }
51
177b6ffb »
2004-02-20 Addtrbute keys are perm_strings.
52 void Attrib::attribute(perm_string key, const verinum&value)
4f638882 »
2000-12-04 Add Attrib class for holding NetObj attributes.
53 {
54 unsigned idx;
55
56 for (idx = 0 ; idx < nlist_ ; idx += 1) {
57 if (key == list_[idx].key) {
58 list_[idx].val = value;
59 return;
60 }
61 }
62
63 struct cell_*tmp = new struct cell_[nlist_+1];
64 for (idx = 0 ; idx < nlist_ ; idx += 1)
65 tmp[idx] = list_[idx];
66
67 tmp[nlist_].key = key;
68 tmp[nlist_].val = value;
69
70 nlist_ += 1;
71 delete[]list_;
72 list_ = tmp;
73 }
74
75 bool Attrib::has_compat_attributes(const Attrib&that) const
76 {
77 unsigned idx;
78
79 for (idx = 0 ; idx < that.nlist_ ; idx += 1) {
80
e6c06296 »
2002-05-23 Add language support for Verilog-2001 attribute
81 verinum tmp = attribute(that.list_[idx].key);
4f638882 »
2000-12-04 Add Attrib class for holding NetObj attributes.
82 if (tmp != that.list_[idx].val)
83 return false;
84 }
85
86 return true;
87 }
88
bfad382f »
2002-05-26 Carry Verilog 2001 attributes with processes,
89 unsigned Attrib::attr_cnt() const
4f638882 »
2000-12-04 Add Attrib class for holding NetObj attributes.
90 {
91 return nlist_;
92 }
93
177b6ffb »
2004-02-20 Addtrbute keys are perm_strings.
94 perm_string Attrib::attr_key(unsigned idx) const
4f638882 »
2000-12-04 Add Attrib class for holding NetObj attributes.
95 {
96 assert(idx < nlist_);
177b6ffb »
2004-02-20 Addtrbute keys are perm_strings.
97 return list_[idx].key;
4f638882 »
2000-12-04 Add Attrib class for holding NetObj attributes.
98 }
99
bfad382f »
2002-05-26 Carry Verilog 2001 attributes with processes,
100 const verinum& Attrib::attr_value(unsigned idx) const
4f638882 »
2000-12-04 Add Attrib class for holding NetObj attributes.
101 {
102 assert(idx < nlist_);
103 return list_[idx].val;
104 }
105
106
107 /*
108 * $Log: Attrib.cc,v $
177b6ffb »
2004-02-20 Addtrbute keys are perm_strings.
109 * Revision 1.6 2004/02/20 18:53:33 steve
110 * Addtrbute keys are perm_strings.
111 *
52bf4e61 »
2002-08-12 conditional ident string using autoconfig.
112 * Revision 1.5 2002/08/12 01:34:58 steve
113 * conditional ident string using autoconfig.
114 *
bfad382f »
2002-05-26 Carry Verilog 2001 attributes with processes,
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.
118 *
119 * Divide signal reference counts between rval
120 * and lval references.
121 *
e6c06296 »
2002-05-23 Add language support for Verilog-2001 attribute
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.
126 *
127 * Add to the ivl_target API new functions for access
128 * of complex attributes attached to gates.
129 *
b825f8d2 »
2001-07-25 Create a config.h.in file to hold all the config
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)
133 *
4f638882 »
2000-12-04 Add Attrib class for holding NetObj attributes.
134 * Revision 1.1 2000/12/04 17:37:03 steve
135 * Add Attrib class for holding NetObj attributes.
136 *
137 */
138
Something went wrong with that request. Please try again.