Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 150 lines (128 sloc) 3.305 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)
b1fd927 Named events really should be expressed with PEIdent
steve authored
20 #ident "$Id: net_event.cc,v 1.3 2000/04/12 04:23:58 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;
30 }
31
32 NetEvent::~NetEvent()
33 {
34 }
35
36 string NetEvent::name() const
37 {
38 return name_;
39 }
40
41 string NetEvent::full_name() const
42 {
43 assert(scope_);
44 return scope_->name() + "." + name_;
45 }
46
47 NetEvTrig::NetEvTrig(NetEvent*ev)
48 : event_(ev)
49 {
50 }
51
52 NetEvTrig::~NetEvTrig()
53 {
54 }
55
56 const NetEvent* NetEvTrig::event() const
57 {
58 return event_;
59 }
60
8dbd641 All events now use the NetEvent class.
steve authored
61 NetEvProbe::NetEvProbe(const string&n, NetEvent*tgt,
62 edge_t t, unsigned p)
63 : NetNode(n, p), event_(tgt), edge_(t)
64 {
65 for (unsigned idx = 0 ; idx < p ; idx += 1) {
66 pin(idx).set_dir(Link::INPUT);
67 pin(idx).set_name("P", idx);
68 }
69 }
70
71 NetEvProbe::~NetEvProbe()
72 {
73 }
74
75 NetEvProbe::edge_t NetEvProbe::edge() const
76 {
77 return edge_;
78 }
79
80 const NetEvent* NetEvProbe::event() const
81 {
82 return event_;
83 }
84
b1fd927 Named events really should be expressed with PEIdent
steve authored
85 NetEvWait::NetEvWait(NetProc*pr)
86 : statement_(pr), nevents_(0), events_(0)
30e8289 Simulate named event trigger and waits.
steve authored
87 {
88 }
89
90 NetEvWait::~NetEvWait()
91 {
b1fd927 Named events really should be expressed with PEIdent
steve authored
92 if (events_) delete[]events_;
30e8289 Simulate named event trigger and waits.
steve authored
93 delete statement_;
94 }
95
b1fd927 Named events really should be expressed with PEIdent
steve authored
96 void NetEvWait::add_event(NetEvent*tgt)
30e8289 Simulate named event trigger and waits.
steve authored
97 {
b1fd927 Named events really should be expressed with PEIdent
steve authored
98 assert(tgt);
99 if (nevents_ == 0) {
100 events_ = new NetEvent*[1];
101
102 } else {
103 NetEvent**tmp = new NetEvent*[nevents_+1];
104 for (unsigned idx = 0 ; idx < nevents_ ; idx += 1) {
105 tmp[idx] = events_[idx];
106 assert(tmp[idx] != tgt);
107 }
108 delete[]events_;
109 events_ = tmp;
110 }
111
112 events_[nevents_] = tgt;
113 nevents_ += 1;
114 }
115
116 unsigned NetEvWait::nevents() const
117 {
118 return nevents_;
119 }
120
121 const NetEvent* NetEvWait::event(unsigned idx) const
122 {
123 assert(idx < nevents_);
124 return events_[idx];
30e8289 Simulate named event trigger and waits.
steve authored
125 }
126
127 /*
128 * $Log: net_event.cc,v $
b1fd927 Named events really should be expressed with PEIdent
steve authored
129 * Revision 1.3 2000/04/12 04:23:58 steve
130 * Named events really should be expressed with PEIdent
131 * objects in the pform,
132 *
133 * Handle named events within the mix of net events
134 * and edges. As a unified lot they get caught together.
135 * wait statements are broken into more complex statements
136 * that include a conditional.
137 *
138 * Do not generate NetPEvent or NetNEvent objects in
139 * elaboration. NetEvent, NetEvWait and NetEvProbe
140 * take over those functions in the netlist.
141 *
8dbd641 All events now use the NetEvent class.
steve authored
142 * Revision 1.2 2000/04/10 05:26:06 steve
143 * All events now use the NetEvent class.
144 *
30e8289 Simulate named event trigger and waits.
steve authored
145 * Revision 1.1 2000/04/04 03:20:15 steve
146 * Simulate named event trigger and waits.
147 *
148 */
149
Something went wrong with that request. Please try again.