2 * Copyright (c) 2000-2002 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: net_proc.cc,v 1.7 2006/08/08 05:11:37 steve Exp $"
28 NetBlock::NetBlock(Type t
, NetScope
*ss
)
29 : type_(t
), subscope_(ss
), last_(0)
36 if (last_
->next_
== last_
) {
40 NetProc
*cur
= last_
->next_
;
41 last_
->next_
= cur
->next_
;
48 void NetBlock::append(NetProc
*cur
)
54 cur
->next_
= last_
->next_
;
60 const NetProc
* NetBlock::proc_first() const
68 const NetProc
* NetBlock::proc_next(const NetProc
*cur
) const
76 NetCase::NetCase(NetCase::TYPE c
, NetExpr
*ex
, unsigned cnt
)
77 : type_(c
), expr_(ex
), nitems_(cnt
)
80 items_
= new Item
[nitems_
];
81 for (unsigned idx
= 0 ; idx
< nitems_
; idx
+= 1) {
82 items_
[idx
].statement
= 0;
89 for (unsigned idx
= 0 ; idx
< nitems_
; idx
+= 1) {
90 delete items_
[idx
].guard
;
91 if (items_
[idx
].statement
) delete items_
[idx
].statement
;
96 NetCase::TYPE
NetCase::type() const
101 void NetCase::set_case(unsigned idx
, NetExpr
*e
, NetProc
*p
)
103 assert(idx
< nitems_
);
104 items_
[idx
].guard
= e
;
105 items_
[idx
].statement
= p
;
106 if (items_
[idx
].guard
)
107 items_
[idx
].guard
->set_width(expr_
->expr_width());
110 NetDisable::NetDisable(NetScope
*tgt
)
115 NetDisable::~NetDisable()
119 const NetScope
* NetDisable::target() const
124 NetForever::NetForever(NetProc
*p
)
129 NetForever::~NetForever()
134 NetPDelay::NetPDelay(uint64_t d
, NetProc
*st
)
135 : delay_(d
), expr_(0), statement_(st
)
139 NetPDelay::NetPDelay(NetExpr
*d
, NetProc
*st
)
140 : delay_(0), expr_(d
), statement_(st
)
144 NetPDelay::~NetPDelay()
146 if (expr_
) delete expr_
;
149 uint64_t NetPDelay::delay() const
155 const NetExpr
* NetPDelay::expr() const
160 NetRepeat::NetRepeat(NetExpr
*e
, NetProc
*p
)
161 : expr_(e
), statement_(p
)
165 NetRepeat::~NetRepeat()
171 const NetExpr
* NetRepeat::expr() const
179 * $Log: net_proc.cc,v $
180 * Revision 1.7 2006/08/08 05:11:37 steve
181 * Handle 64bit delay constants.
183 * Revision 1.6 2002/08/12 01:34:59 steve
184 * conditional ident string using autoconfig.
186 * Revision 1.5 2002/07/28 23:58:45 steve
187 * Fix NetBlock destructor to delete substatements.
189 * Revision 1.4 2002/04/21 04:59:08 steve
190 * Add support for conbinational events by finding
191 * the inputs to expressions and some statements.
192 * Get case and assignment statements working.
194 * Revision 1.3 2001/07/25 03:10:49 steve
195 * Create a config.h.in file to hold all the config
196 * junk, and support gcc 3.0. (Stephan Boettcher)
198 * Revision 1.2 2000/07/27 05:13:44 steve
199 * Support elaboration of disable statements.
201 * Revision 1.1 2000/07/07 04:53:54 steve
202 * Add support for non-constant delays in delay statements,
203 * Support evaluating ! in constant expressions, and
204 * move some code from netlist.cc to net_proc.cc.