Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 193 lines (165 sloc) 4.128 kb
30e8289 Simulate named event trigger and waits.
steve authored
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 */
19 #if !defined(WINNT) && !defined(macintosh)
4493e96 Finally remove the NetNEvent and NetPEvent classes,
steve authored
20 #ident "$Id: net_event.cc,v 1.4 2000/04/12 20:02:53 steve Exp $"
30e8289 Simulate named event trigger and waits.
steve authored
21 #endif
22
23 # include "netlist.h"
24
25 NetEvent::NetEvent(const string&n)
26 : name_(n)
27 {
28 scope_ = 0;
29 snext_ = 0;
4493e96 Finally remove the NetNEvent and NetPEvent classes,
steve authored
30 probes_ = 0;
30e8289 Simulate named event trigger and waits.
steve authored
31 }
32
33 NetEvent::~NetEvent()
34 {
35 }
36
37 string NetEvent::name() const
38 {
39 return name_;
40 }
41
42 string NetEvent::full_name() const
43 {
44 assert(scope_);
45 return scope_->name() + "." + name_;
46 }
47
4493e96 Finally remove the NetNEvent and NetPEvent classes,
steve authored
48 unsigned NetEvent::nprobe() const
49 {
50 unsigned cnt = 0;
51 NetEvProbe*cur = probes_;
52 while (cur) {
53 cnt += 1;
54 cur = cur->enext_;
55 }
56
57 return cnt;
58 }
59
60 NetEvProbe* NetEvent::probe(unsigned idx)
61 {
62 NetEvProbe*cur = probes_;
63 while (cur && idx) {
64 cur = cur->enext_;
65 idx -= 1;
66 }
67 return cur;
68 }
69
30e8289 Simulate named event trigger and waits.
steve authored
70 NetEvTrig::NetEvTrig(NetEvent*ev)
71 : event_(ev)
72 {
73 }
74
75 NetEvTrig::~NetEvTrig()
76 {
77 }
78
79 const NetEvent* NetEvTrig::event() const
80 {
81 return event_;
82 }
83
8dbd641 All events now use the NetEvent class.
steve authored
84 NetEvProbe::NetEvProbe(const string&n, NetEvent*tgt,
85 edge_t t, unsigned p)
86 : NetNode(n, p), event_(tgt), edge_(t)
87 {
88 for (unsigned idx = 0 ; idx < p ; idx += 1) {
89 pin(idx).set_dir(Link::INPUT);
90 pin(idx).set_name("P", idx);
91 }
4493e96 Finally remove the NetNEvent and NetPEvent classes,
steve authored
92
93 enext_ = event_->probes_;
94 event_->probes_ = this;
8dbd641 All events now use the NetEvent class.
steve authored
95 }
96
97 NetEvProbe::~NetEvProbe()
98 {
99 }
100
101 NetEvProbe::edge_t NetEvProbe::edge() const
102 {
103 return edge_;
104 }
105
106 const NetEvent* NetEvProbe::event() const
107 {
108 return event_;
109 }
110
b1fd927 Named events really should be expressed with PEIdent
steve authored
111 NetEvWait::NetEvWait(NetProc*pr)
112 : statement_(pr), nevents_(0), events_(0)
30e8289 Simulate named event trigger and waits.
steve authored
113 {
114 }
115
116 NetEvWait::~NetEvWait()
117 {
b1fd927 Named events really should be expressed with PEIdent
steve authored
118 if (events_) delete[]events_;
30e8289 Simulate named event trigger and waits.
steve authored
119 delete statement_;
120 }
121
b1fd927 Named events really should be expressed with PEIdent
steve authored
122 void NetEvWait::add_event(NetEvent*tgt)
30e8289 Simulate named event trigger and waits.
steve authored
123 {
b1fd927 Named events really should be expressed with PEIdent
steve authored
124 assert(tgt);
125 if (nevents_ == 0) {
126 events_ = new NetEvent*[1];
127
128 } else {
129 NetEvent**tmp = new NetEvent*[nevents_+1];
130 for (unsigned idx = 0 ; idx < nevents_ ; idx += 1) {
131 tmp[idx] = events_[idx];
132 assert(tmp[idx] != tgt);
133 }
134 delete[]events_;
135 events_ = tmp;
136 }
137
138 events_[nevents_] = tgt;
139 nevents_ += 1;
140 }
141
142 unsigned NetEvWait::nevents() const
143 {
144 return nevents_;
145 }
146
147 const NetEvent* NetEvWait::event(unsigned idx) const
148 {
149 assert(idx < nevents_);
150 return events_[idx];
30e8289 Simulate named event trigger and waits.
steve authored
151 }
152
4493e96 Finally remove the NetNEvent and NetPEvent classes,
steve authored
153 NetEvent* NetEvWait::event(unsigned idx)
154 {
155 assert(idx < nevents_);
156 return events_[idx];
157 }
158
159 NetProc* NetEvWait::statement()
160 {
161 return statement_;
162 }
163
30e8289 Simulate named event trigger and waits.
steve authored
164 /*
165 * $Log: net_event.cc,v $
4493e96 Finally remove the NetNEvent and NetPEvent classes,
steve authored
166 * Revision 1.4 2000/04/12 20:02:53 steve
167 * Finally remove the NetNEvent and NetPEvent classes,
168 * Get synthesis working with the NetEvWait class,
169 * and get started supporting multiple events in a
170 * wait in vvm.
171 *
b1fd927 Named events really should be expressed with PEIdent
steve authored
172 * Revision 1.3 2000/04/12 04:23:58 steve
173 * Named events really should be expressed with PEIdent
174 * objects in the pform,
175 *
176 * Handle named events within the mix of net events
177 * and edges. As a unified lot they get caught together.
178 * wait statements are broken into more complex statements
179 * that include a conditional.
180 *
181 * Do not generate NetPEvent or NetNEvent objects in
182 * elaboration. NetEvent, NetEvWait and NetEvProbe
183 * take over those functions in the netlist.
184 *
8dbd641 All events now use the NetEvent class.
steve authored
185 * Revision 1.2 2000/04/10 05:26:06 steve
186 * All events now use the NetEvent class.
187 *
30e8289 Simulate named event trigger and waits.
steve authored
188 * Revision 1.1 2000/04/04 03:20:15 steve
189 * Simulate named event trigger and waits.
190 *
191 */
192
Something went wrong with that request. Please try again.