Implement $ftell, $fseek and $rewind system functions.
[iverilog.git] / elab_scope.cc
blob2ed50504e7f7e83713d85c271485d1e34cfb6700
1 /*
2 * Copyright (c) 2000-2003 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)
8 * any later version.
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
19 #ifdef HAVE_CVS_IDENT
20 #ident "$Id: elab_scope.cc,v 1.46 2007/06/02 03:42:12 steve Exp $"
21 #endif
23 # include "config.h"
24 # include "compiler.h"
25 # include "netmisc.h"
26 # include <iostream>
27 # include <stdio.h>
30 * Elaboration happens in two passes, generally. The first scans the
31 * pform to generate the NetScope tree and attach it to the Design
32 * object. The methods in this source file implement the elaboration
33 * of the scopes.
36 # include "Module.h"
37 # include "PEvent.h"
38 # include "PExpr.h"
39 # include "PGate.h"
40 # include "PGenerate.h"
41 # include "PTask.h"
42 # include "PWire.h"
43 # include "Statement.h"
44 # include "netlist.h"
45 # include "util.h"
46 # include <typeinfo>
47 # include <assert.h>
49 bool Module::elaborate_scope(Design*des, NetScope*scope,
50 const replace_t&replacements) const
52 if (debug_scopes) {
53 cerr << get_line() << ": debug: Elaborate scope "
54 << scope_path(scope) << "." << endl;
57 // Generate all the parameters that this instance of this
58 // module introduces to the design. This loop elaborates the
59 // parameters, but doesn't evaluate references to
60 // parameters. This scan practically locates all the
61 // parameters and puts them in the parameter table in the
62 // design.
64 // No expressions are evaluated, yet. For now, leave them in
65 // the pform and just place a NetEParam placeholder in the
66 // place of the elaborated expression.
68 typedef map<perm_string,param_expr_t>::const_iterator mparm_it_t;
69 typedef map<pform_name_t,PExpr*>::const_iterator pform_parm_it_t;
72 // This loop scans the parameters in the module, and creates
73 // stub parameter entries in the scope for the parameter name.
75 for (mparm_it_t cur = parameters.begin()
76 ; cur != parameters.end() ; cur ++) {
78 NetEParam*tmp = new NetEParam;
79 tmp->set_line(*((*cur).second.expr));
80 tmp->cast_signed( (*cur).second.signed_flag );
82 scope->set_parameter((*cur).first, tmp, 0, 0, false);
85 for (mparm_it_t cur = localparams.begin()
86 ; cur != localparams.end() ; cur ++) {
88 NetEParam*tmp = new NetEParam;
89 tmp->set_line(*((*cur).second.expr));
90 if ((*cur).second.msb)
91 tmp->cast_signed( (*cur).second.signed_flag );
93 scope->set_parameter((*cur).first, tmp, 0, 0, false);
97 // Now scan the parameters again, this time elaborating them
98 // for use as parameter values. This is after the previous
99 // scan so that local parameter names can be used in the
100 // r-value expressions.
102 for (mparm_it_t cur = parameters.begin()
103 ; cur != parameters.end() ; cur ++) {
105 PExpr*ex = (*cur).second.expr;
106 assert(ex);
108 NetExpr*val = ex->elaborate_pexpr(des, scope);
109 NetExpr*msb = 0;
110 NetExpr*lsb = 0;
111 bool signed_flag = (*cur).second.signed_flag;
113 /* If the parameter declaration includes msb and lsb,
114 then use them to calculate a width for the
115 result. Then make sure the constant expression of the
116 parameter value is coerced to have the correct
117 and defined width. */
118 if ((*cur).second.msb) {
119 msb = (*cur).second.msb ->elaborate_pexpr(des, scope);
120 assert(msb);
121 lsb = (*cur).second.lsb ->elaborate_pexpr(des, scope);
124 if (signed_flag) {
125 /* If explicitly signed, then say so. */
126 val->cast_signed(true);
127 } else if ((*cur).second.msb) {
128 /* If there is a range, then the signedness comes
129 from the type and not the expression. */
130 val->cast_signed(signed_flag);
131 } else {
132 /* otherwise, let the expression describe
133 itself. */
134 signed_flag = val->has_sign();
137 val = scope->set_parameter((*cur).first, val,
138 msb, lsb, signed_flag);
139 assert(val);
140 delete val;
143 /* run parameter replacements that were collected from the
144 containing scope and meant for me. */
145 for (replace_t::const_iterator cur = replacements.begin()
146 ; cur != replacements.end() ; cur ++) {
148 NetExpr*val = (*cur).second;
149 if (val == 0) {
150 cerr << get_line() << ": internal error: "
151 << "Missing expression in parameter replacement for "
152 << (*cur).first;
154 assert(val);
155 if (debug_scopes) {
156 cerr << get_line() << ": debug: "
157 << "Replace " << (*cur).first
158 << " with expression " << *val
159 << " from " << val->get_line() << "." << endl;
161 bool flag = scope->replace_parameter((*cur).first, val);
162 if (! flag) {
163 cerr << val->get_line() << ": warning: parameter "
164 << (*cur).first << " not found in "
165 << scope_path(scope) << "." << endl;
169 for (mparm_it_t cur = localparams.begin()
170 ; cur != localparams.end() ; cur ++) {
172 PExpr*ex = (*cur).second.expr;
173 assert(ex);
175 NetExpr*val = ex->elaborate_pexpr(des, scope);
176 NetExpr*msb = 0;
177 NetExpr*lsb = 0;
178 bool signed_flag = false;
180 /* If the parameter declaration includes msb and lsb,
181 then use them to calculate a width for the
182 result. Then make sure the constant expression of the
183 parameter value is coerced to have the correct
184 and defined width. */
185 if ((*cur).second.msb) {
186 msb = (*cur).second.msb ->elaborate_pexpr(des, scope);
187 assert(msb);
188 lsb = (*cur).second.lsb ->elaborate_pexpr(des, scope);
189 signed_flag = (*cur).second.signed_flag;
192 val->cast_signed(signed_flag);
193 val = scope->set_parameter((*cur).first, val,
194 msb, lsb, signed_flag);
195 assert(val);
196 delete val;
199 // Run through the defparams for this module, elaborate the
200 // expressions in this context and save the result is a table
201 // for later final override.
203 // It is OK to elaborate the expressions of the defparam here
204 // because Verilog requires that the expressions only use
205 // local parameter names. It is *not* OK to do the override
206 // here because the parameter receiving the assignment may be
207 // in a scope not discovered by this pass.
209 for (pform_parm_it_t cur = defparms.begin()
210 ; cur != defparms.end() ; cur ++ ) {
212 PExpr*ex = (*cur).second;
213 assert(ex);
215 NetExpr*val = ex->elaborate_pexpr(des, scope);
216 if (val == 0) continue;
217 scope->defparams[(*cur).first] = val;
220 // Evaluate the attributes. Evaluate them in the scope of the
221 // module that the attribute is attached to. Is this correct?
222 unsigned nattr;
223 attrib_list_t*attr = evaluate_attributes(attributes, nattr, des, scope);
225 for (unsigned idx = 0 ; idx < nattr ; idx += 1)
226 scope->attribute(attr[idx].key, attr[idx].val);
228 delete[]attr;
230 // Generate schemes can create new scopes in the form of
231 // generated code. Scan the generate schemes, and *generate*
232 // new scopes, which is slightly different from simple
233 // elaboration.
235 typedef list<PGenerate*>::const_iterator generate_it_t;
236 for (generate_it_t cur = generate_schemes.begin()
237 ; cur != generate_schemes.end() ; cur ++ ) {
238 (*cur) -> generate_scope(des, scope);
242 // Tasks introduce new scopes, so scan the tasks in this
243 // module. Create a scope for the task and pass that to the
244 // elaborate_scope method of the PTask for detailed
245 // processing.
247 typedef map<perm_string,PTask*>::const_iterator tasks_it_t;
249 for (tasks_it_t cur = tasks_.begin()
250 ; cur != tasks_.end() ; cur ++ ) {
252 hname_t use_name( (*cur).first );
253 NetScope*task_scope = new NetScope(scope, use_name,
254 NetScope::TASK);
255 (*cur).second->elaborate_scope(des, task_scope);
259 // Functions are very similar to tasks, at least from the
260 // perspective of scopes. So handle them exactly the same
261 // way.
263 typedef map<perm_string,PFunction*>::const_iterator funcs_it_t;
265 for (funcs_it_t cur = funcs_.begin()
266 ; cur != funcs_.end() ; cur ++ ) {
268 hname_t use_name( (*cur).first );
269 NetScope*func_scope = new NetScope(scope, use_name,
270 NetScope::FUNC);
271 (*cur).second->elaborate_scope(des, func_scope);
275 // Gates include modules, which might introduce new scopes, so
276 // scan all of them to create those scopes.
278 typedef list<PGate*>::const_iterator gates_it_t;
279 for (gates_it_t cur = gates_.begin()
280 ; cur != gates_.end() ; cur ++ ) {
282 (*cur) -> elaborate_scope(des, scope);
286 // initial and always blocks may contain begin-end and
287 // fork-join blocks that can introduce scopes. Therefore, I
288 // get to scan processes here.
290 typedef list<PProcess*>::const_iterator proc_it_t;
292 for (proc_it_t cur = behaviors_.begin()
293 ; cur != behaviors_.end() ; cur ++ ) {
295 (*cur) -> statement() -> elaborate_scope(des, scope);
298 // Scan through all the named events in this scope. We do not
299 // need anything more than the current scope to do this
300 // elaboration, so do it now. This allows for normal
301 // elaboration to reference these events.
303 for (map<perm_string,PEvent*>::const_iterator et = events.begin()
304 ; et != events.end() ; et ++ ) {
306 (*et).second->elaborate_scope(des, scope);
309 return des->errors == 0;
312 bool PGenerate::generate_scope(Design*des, NetScope*container)
314 switch (scheme_type) {
315 case GS_LOOP:
316 return generate_scope_loop_(des, container);
318 case GS_CONDIT:
319 return generate_scope_condit_(des, container, false);
321 case GS_ELSE:
322 return generate_scope_condit_(des, container, true);
324 default:
325 cerr << get_line() << ": sorry: Generate of this sort"
326 << " is not supported yet!" << endl;
327 return false;
332 * This is the elaborate scope method for a generate loop.
334 bool PGenerate::generate_scope_loop_(Design*des, NetScope*container)
336 // We're going to need a genvar...
337 int genvar;
339 // The initial value for the genvar does not need (nor can it
340 // use) the genvar itself, so we can evaluate this expression
341 // the same way any other paramter value is evaluated.
342 NetExpr*init_ex = elab_and_eval(des, container, loop_init, -1);
343 NetEConst*init = dynamic_cast<NetEConst*> (init_ex);
344 if (init == 0) {
345 cerr << get_line() << ": error: Cannot evaluate genvar"
346 << " init expression: " << *loop_init << endl;
347 des->errors += 1;
348 return false;
351 genvar = init->value().as_long();
352 delete init_ex;
354 if (debug_elaborate)
355 cerr << get_line() << ": debug: genvar init = " << genvar << endl;
357 container->genvar_tmp = loop_index;
358 container->genvar_tmp_val = 0;
359 NetExpr*test_ex = elab_and_eval(des, container, loop_test, -1);
360 NetEConst*test = dynamic_cast<NetEConst*>(test_ex);
361 assert(test);
362 while (test->value().as_long()) {
364 // The actual name of the scope includes the genvar so
365 // that each instance has a unique name in the
366 // container. The format of using [] is part of the
367 // Verilog standard.
368 hname_t use_name (scope_name, genvar);
369 if (debug_elaborate)
370 cerr << get_line() << ": debug: "
371 << "Create generated scope " << use_name << endl;
373 NetScope*scope = new NetScope(container, use_name,
374 NetScope::GENBLOCK);
376 // Set in the scope a localparam for the value of the
377 // genvar within this instance of the generate
378 // block. Code within this scope thus has access to the
379 // genvar as a constant.
381 verinum genvar_verinum(genvar);
382 genvar_verinum.has_sign(true);
383 NetEConstParam*gp = new NetEConstParam(scope,
384 loop_index,
385 genvar_verinum);
386 scope->set_localparam(loop_index, gp);
388 if (debug_elaborate)
389 cerr << get_line() << ": debug: "
390 << "Create implicit localparam "
391 << loop_index << " = " << genvar_verinum << endl;
394 elaborate_subscope_(des, scope);
396 // Calculate the step for the loop variable.
397 NetExpr*step_ex = elab_and_eval(des, container, loop_step, -1);
398 NetEConst*step = dynamic_cast<NetEConst*>(step_ex);
399 assert(step);
400 if (debug_elaborate)
401 cerr << get_line() << ": debug: genvar step from "
402 << genvar << " to " << step->value().as_long() << endl;
404 genvar = step->value().as_long();
405 container->genvar_tmp_val = genvar;
406 delete step;
407 delete test_ex;
408 test_ex = elab_and_eval(des, container, loop_test, -1);
409 test = dynamic_cast<NetEConst*>(test_ex);
410 assert(test);
413 // Clear the genvar_tmp field in the scope to reflect that the
414 // genvar is no longer value for evaluating expressions.
415 container->genvar_tmp = perm_string();
417 return true;
420 bool PGenerate::generate_scope_condit_(Design*des, NetScope*container, bool else_flag)
422 NetExpr*test_ex = elab_and_eval(des, container, loop_test, -1);
423 NetEConst*test = dynamic_cast<NetEConst*> (test_ex);
424 assert(test);
426 // If the condition evaluates as false, then do not create the
427 // scope.
428 if (test->value().as_long() == 0 && !else_flag
429 || test->value().as_long() != 0 && else_flag) {
430 if (debug_elaborate)
431 cerr << get_line() << ": debug: Generate condition "
432 << (else_flag? "(else)" : "(if)")
433 << " value=" << test->value() << ": skip generation"
434 << endl;
435 delete test_ex;
436 return true;
439 hname_t use_name (scope_name);
440 if (debug_elaborate)
441 cerr << get_line() << ": debug: Generate condition "
442 << (else_flag? "(else)" : "(if)")
443 << " value=" << test->value() << ": Generate scope="
444 << use_name << endl;
446 NetScope*scope = new NetScope(container, use_name,
447 NetScope::GENBLOCK);
449 elaborate_subscope_(des, scope);
451 return true;
454 void PGenerate::elaborate_subscope_(Design*des, NetScope*scope)
456 // Scan the generated scope for gates that may create
457 // their own scopes.
458 typedef list<PGate*>::const_iterator pgate_list_it_t;
459 for (pgate_list_it_t cur = gates.begin()
460 ; cur != gates.end() ; cur ++) {
461 (*cur) ->elaborate_scope(des, scope);
464 // Save the scope that we created, for future use.
465 scope_list_.push_back(scope);
468 void PGModule::elaborate_scope_mod_(Design*des, Module*mod, NetScope*sc) const
470 if (get_name() == "") {
471 cerr << get_line() << ": error: Instantiation of module "
472 << mod->mod_name() << " requires an instance name." << endl;
473 des->errors += 1;
474 return;
477 // Missing module instance names have already been rejected.
478 assert(get_name() != "");
480 // Check for duplicate scopes. Simply look up the scope I'm
481 // about to create, and if I find it then somebody beat me to
482 // it.
484 if (sc->child(hname_t(get_name()))) {
485 cerr << get_line() << ": error: Instance/Scope name " <<
486 get_name() << " already used in this context." <<
487 endl;
488 des->errors += 1;
489 return;
492 // check for recursive instantiation by scanning the current
493 // scope and its parents. Look for a module instantiation of
494 // the same module, but farther up in the scope.
496 for (NetScope*scn = sc ; scn ; scn = scn->parent()) {
497 if (scn->type() != NetScope::MODULE)
498 continue;
500 if (strcmp(mod->mod_name(), scn->module_name()) != 0)
501 continue;
503 cerr << get_line() << ": error: You cannot instantiate "
504 << "module " << mod->mod_name() << " within itself." << endl;
506 cerr << get_line() << ": : The offending instance is "
507 << scope_path(sc) << "." << get_name() << " within "
508 << scope_path(scn) << "." << endl;
510 des->errors += 1;
511 return;
514 NetExpr*mse = msb_ ? elab_and_eval(des, sc, msb_, -1) : 0;
515 NetExpr*lse = lsb_ ? elab_and_eval(des, sc, lsb_, -1) : 0;
516 NetEConst*msb = dynamic_cast<NetEConst*> (mse);
517 NetEConst*lsb = dynamic_cast<NetEConst*> (lse);
519 assert( (msb == 0) || (lsb != 0) );
521 long instance_low = 0;
522 long instance_high = 0;
523 long instance_count = 1;
524 bool instance_array = false;
526 if (msb) {
527 instance_array = true;
528 instance_high = msb->value().as_long();
529 instance_low = lsb->value().as_long();
530 if (instance_high > instance_low)
531 instance_count = instance_high - instance_low + 1;
532 else
533 instance_count = instance_low - instance_high + 1;
535 delete mse;
536 delete lse;
539 NetScope::scope_vec_t instances (instance_count);
540 if (debug_scopes) {
541 cerr << get_line() << ": debug: Create " << instance_count
542 << " instances of " << get_name()
543 << "." << endl;
546 // Run through the module instances, and make scopes out of
547 // them. Also do parameter overrides that are done on the
548 // instantiation line.
549 for (int idx = 0 ; idx < instance_count ; idx += 1) {
551 hname_t use_name (get_name());
553 if (instance_array) {
554 int instance_idx = idx;
555 if (instance_low < instance_high)
556 instance_idx = instance_low + idx;
557 else
558 instance_idx = instance_low - idx;
560 use_name = hname_t(get_name(), instance_idx);
563 if (debug_scopes) {
564 cerr << get_line() << ": debug: Module instance " << use_name
565 << " becomes child of " << scope_path(sc)
566 << "." << endl;
569 // Create the new scope as a MODULE with my name.
570 NetScope*my_scope = new NetScope(sc, use_name, NetScope::MODULE);
571 my_scope->set_module_name(mod->mod_name());
572 my_scope->default_nettype(mod->default_nettype);
574 instances[idx] = my_scope;
576 // Set time units and precision.
577 my_scope->time_unit(mod->time_unit);
578 my_scope->time_precision(mod->time_precision);
579 des->set_precision(mod->time_precision);
581 // Look for module parameter replacements. The "replace" map
582 // maps parameter name to replacement expression that is
583 // passed. It is built up by the ordered overrides or named
584 // overrides.
586 typedef map<perm_string,PExpr*>::const_iterator mparm_it_t;
587 map<perm_string,PExpr*> replace;
590 // Positional parameter overrides are matched to parameter
591 // names by using the param_names list of parameter
592 // names. This is an ordered list of names so the first name
593 // is parameter 0, the second parameter 1, and so on.
595 if (overrides_) {
596 assert(parms_ == 0);
597 list<perm_string>::const_iterator cur
598 = mod->param_names.begin();
599 unsigned idx = 0;
600 for (;;) {
601 if (idx >= overrides_->count())
602 break;
603 if (cur == mod->param_names.end())
604 break;
606 replace[*cur] = (*overrides_)[idx];
608 idx += 1;
609 cur ++;
613 // Named parameter overrides carry a name with each override
614 // so the mapping into the replace list is much easier.
615 if (parms_) {
616 assert(overrides_ == 0);
617 for (unsigned idx = 0 ; idx < nparms_ ; idx += 1)
618 replace[parms_[idx].name] = parms_[idx].parm;
623 Module::replace_t replace_net;
625 // And here we scan the replacements we collected. Elaborate
626 // the expression in my context, then replace the sub-scope
627 // parameter value with the new expression.
629 for (mparm_it_t cur = replace.begin()
630 ; cur != replace.end() ; cur ++ ) {
632 PExpr*tmp = (*cur).second;
633 // No expression means that the parameter is not
634 // replaced at all.
635 if (tmp == 0)
636 continue;
637 NetExpr*val = tmp->elaborate_pexpr(des, sc);
638 replace_net[(*cur).first] = val;
641 // This call actually arranges for the description of the
642 // module type to process this instance and handle parameters
643 // and sub-scopes that might occur. Parameters are also
644 // created in that scope, as they exist. (I'll override them
645 // later.)
646 mod->elaborate_scope(des, my_scope, replace_net);
650 /* Stash the instance array of scopes into the parent
651 scope. Later elaboration passes will use this vector to
652 further elaborate the array. */
653 sc->instance_arrays[get_name()] = instances;
657 * The isn't really able to create new scopes, but it does create the
658 * event name in the current scope, so can be done during the
659 * elaborate_scope scan. Note that the name_ of the PEvent object has
660 * no hierarchy, but neither does the NetEvent, until it is stored in
661 * the NetScope object.
663 void PEvent::elaborate_scope(Design*des, NetScope*scope) const
665 NetEvent*ev = new NetEvent(name_);
666 ev->set_line(*this);
667 scope->add_event(ev);
670 void PFunction::elaborate_scope(Design*des, NetScope*scope) const
672 assert(scope->type() == NetScope::FUNC);
674 if (statement_)
675 statement_->elaborate_scope(des, scope);
678 void PTask::elaborate_scope(Design*des, NetScope*scope) const
680 assert(scope->type() == NetScope::TASK);
682 if (statement_)
683 statement_->elaborate_scope(des, scope);
688 * The base statement does not have sub-statements and does not
689 * introduce any scope, so this is a no-op.
691 void Statement::elaborate_scope(Design*, NetScope*) const
696 * When I get a behavioral block, check to see if it has a name. If it
697 * does, then create a new scope for the statements within it,
698 * otherwise use the current scope. Use the selected scope to scan the
699 * statements that I contain.
701 void PBlock::elaborate_scope(Design*des, NetScope*scope) const
703 NetScope*my_scope = scope;
705 if (name_ != 0) {
706 my_scope = new NetScope(scope, hname_t(name_), bl_type_==BL_PAR
707 ? NetScope::FORK_JOIN
708 : NetScope::BEGIN_END);
711 for (unsigned idx = 0 ; idx < list_.count() ; idx += 1)
712 list_[idx] -> elaborate_scope(des, my_scope);
717 * The case statement itself does not introduce scope, but contains
718 * other statements that may be named blocks. So scan the case items
719 * with the elaborate_scope method.
721 void PCase::elaborate_scope(Design*des, NetScope*scope) const
723 assert(items_);
724 for (unsigned idx = 0 ; idx < (*items_).count() ; idx += 1) {
725 assert( (*items_)[idx] );
727 if (Statement*sp = (*items_)[idx]->stat)
728 sp -> elaborate_scope(des, scope);
733 * The conditional statement (if-else) does not introduce scope, but
734 * the statements of the clauses may, so elaborate_scope the contained
735 * statements.
737 void PCondit::elaborate_scope(Design*des, NetScope*scope) const
739 if (if_)
740 if_ -> elaborate_scope(des, scope);
742 if (else_)
743 else_ -> elaborate_scope(des, scope);
747 * Statements that contain a further statement but do not
748 * intrinsically add a scope need to elaborate_scope the contained
749 * statement.
751 void PDelayStatement::elaborate_scope(Design*des, NetScope*scope) const
753 if (statement_)
754 statement_ -> elaborate_scope(des, scope);
758 * Statements that contain a further statement but do not
759 * intrinsically add a scope need to elaborate_scope the contained
760 * statement.
762 void PEventStatement::elaborate_scope(Design*des, NetScope*scope) const
764 if (statement_)
765 statement_ -> elaborate_scope(des, scope);
769 * Statements that contain a further statement but do not
770 * intrinsically add a scope need to elaborate_scope the contained
771 * statement.
773 void PForever::elaborate_scope(Design*des, NetScope*scope) const
775 if (statement_)
776 statement_ -> elaborate_scope(des, scope);
780 * Statements that contain a further statement but do not
781 * intrinsically add a scope need to elaborate_scope the contained
782 * statement.
784 void PForStatement::elaborate_scope(Design*des, NetScope*scope) const
786 if (statement_)
787 statement_ -> elaborate_scope(des, scope);
791 * Statements that contain a further statement but do not
792 * intrinsically add a scope need to elaborate_scope the contained
793 * statement.
795 void PRepeat::elaborate_scope(Design*des, NetScope*scope) const
797 if (statement_)
798 statement_ -> elaborate_scope(des, scope);
802 * Statements that contain a further statement but do not
803 * intrinsically add a scope need to elaborate_scope the contained
804 * statement.
806 void PWhile::elaborate_scope(Design*des, NetScope*scope) const
808 if (statement_)
809 statement_ -> elaborate_scope(des, scope);