Proper syntax for method pointers.
This commit is contained in:
parent
470b0d3d34
commit
6d7ac5d67b
69
t-vvm.cc
69
t-vvm.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: t-vvm.cc,v 1.46 1999/09/28 01:13:15 steve Exp $"
|
||||
#ident "$Id: t-vvm.cc,v 1.47 1999/09/28 01:21:27 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <iostream>
|
||||
|
|
@ -1007,7 +1007,8 @@ void target_vvm::start_process(ostream&os, const NetProcTop*proc)
|
|||
os << " public:" << endl;
|
||||
os << " thread" << process_counter <<
|
||||
"_t(vvm_simulation*sim)" << endl;
|
||||
os << " : vvm_thread(sim), step_(&step_0_)" << endl;
|
||||
os << " : vvm_thread(sim), step_(&thread" <<
|
||||
process_counter << "_t::step_0_)" << endl;
|
||||
os << " { }" << endl;
|
||||
os << " ~thread" << process_counter << "_t() { }" << endl;
|
||||
os << endl;
|
||||
|
|
@ -1148,8 +1149,8 @@ void target_vvm::proc_case(ostream&os, const NetCase*net)
|
|||
|
||||
os << " if (" << expr << ".eequal(" << guard <<
|
||||
")) {" << endl;
|
||||
os << " step_ = &step_" <<
|
||||
thread_step_ << "_;" << endl;
|
||||
os << " step_ = &thread" << process_counter <<
|
||||
"_t::step_" << thread_step_ << "_;" << endl;
|
||||
os << " return true;" << endl;
|
||||
os << " }" << endl;
|
||||
|
||||
|
|
@ -1157,7 +1158,8 @@ void target_vvm::proc_case(ostream&os, const NetCase*net)
|
|||
sc << " {" << endl;
|
||||
if (net->stat(idx))
|
||||
net->stat(idx)->emit_proc(sc, this);
|
||||
sc << " step_ = &step_" << exit_step << "_;" << endl;
|
||||
sc << " step_ = &thread" << process_counter <<
|
||||
"_t::step_" << exit_step << "_;" << endl;
|
||||
sc << " return true;" << endl;
|
||||
sc << " }" << endl;
|
||||
}
|
||||
|
|
@ -1172,13 +1174,15 @@ void target_vvm::proc_case(ostream&os, const NetCase*net)
|
|||
sc << " {" << endl;
|
||||
if (net->stat(default_idx))
|
||||
net->stat(default_idx)->emit_proc(sc, this);
|
||||
sc << " step_ = &step_" << exit_step << "_;" << endl;
|
||||
sc << " step_ = &thread" << process_counter <<
|
||||
"_t::step_" << exit_step << "_;" << endl;
|
||||
sc << " return true;" << endl;
|
||||
sc << " }" << endl;
|
||||
|
||||
} else {
|
||||
os << " /* no default ... fall out of case. */" << endl;
|
||||
os << " step_ = &step_" << exit_step << "_;" << endl;
|
||||
os << " step_ = &thread" << process_counter <<
|
||||
"_t::step_" << exit_step << "_;" << endl;
|
||||
}
|
||||
|
||||
os << " /* endcase */" << endl;
|
||||
|
|
@ -1198,23 +1202,27 @@ void target_vvm::proc_condit(ostream&os, const NetCondit*net)
|
|||
unsigned out_step = ++thread_step_;
|
||||
|
||||
os << " if (" << expr << "[0] == V1)" << endl;
|
||||
os << " step_ = &step_" << if_step << "_;" << endl;
|
||||
os << " step_ = &thread" << process_counter <<
|
||||
"_t::step_" << if_step << "_;" << endl;
|
||||
os << " else" << endl;
|
||||
os << " step_ = &step_" << else_step << "_;" << endl;
|
||||
os << " step_ = &thread" << process_counter <<
|
||||
"_t::step_" << else_step << "_;" << endl;
|
||||
os << " return true;" << endl;
|
||||
os << " };" << endl;
|
||||
|
||||
os << " bool step_" << if_step << "_()" << endl;
|
||||
os << " {" << endl;
|
||||
net->emit_recurse_if(os, this);
|
||||
os << " step_ = &step_" << out_step << "_;" << endl;
|
||||
os << " step_ = &thread" << process_counter <<
|
||||
"_t::step_" << out_step << "_;" << endl;
|
||||
os << " return true;" << endl;
|
||||
os << " }" << endl;
|
||||
|
||||
os << " bool step_" << else_step << "_()" << endl;
|
||||
os << " {" << endl;
|
||||
net->emit_recurse_else(os, this);
|
||||
os << " step_ = &step_" << out_step << "_;" << endl;
|
||||
os << " step_ = &thread" << process_counter <<
|
||||
"_t::step_" << out_step << "_;" << endl;
|
||||
os << " return true;" << endl;
|
||||
os << " }" << endl;
|
||||
|
||||
|
|
@ -1231,13 +1239,15 @@ void target_vvm::proc_forever(ostream&os, const NetForever*net)
|
|||
unsigned top_step = ++thread_step_;
|
||||
unsigned out_step = ++thread_step_;
|
||||
|
||||
os << " step_ = &step_" << top_step << "_;" << endl;
|
||||
os << " step_ = &thread" << process_counter <<
|
||||
"_t::step_" << top_step << "_;" << endl;
|
||||
os << " return true;" << endl;
|
||||
os << " }" << endl;
|
||||
os << " bool step_" << top_step << "_()" << endl;
|
||||
os << " {" << endl;
|
||||
net->emit_recurse(os, this);
|
||||
os << " step_ = &step_" << top_step << "_;" << endl;
|
||||
os << " step_ = &thread" << process_counter <<
|
||||
"_t::step_" << top_step << "_;" << endl;
|
||||
os << " return true;" << endl;
|
||||
os << " }" << endl;
|
||||
|
||||
|
|
@ -1253,7 +1263,8 @@ void target_vvm::proc_repeat(ostream&os, const NetRepeat*net)
|
|||
|
||||
os << " step_" << top_step << "_idx_ = " << expr <<
|
||||
".as_unsigned();" << endl;
|
||||
os << " step_ = &step_" << top_step << "_;" << endl;
|
||||
os << " step_ = &thread" << process_counter <<
|
||||
"_t::step_" << top_step << "_;" << endl;
|
||||
os << " return true;" << endl;
|
||||
os << " }" << endl;
|
||||
|
||||
|
|
@ -1262,14 +1273,16 @@ void target_vvm::proc_repeat(ostream&os, const NetRepeat*net)
|
|||
os << " bool step_" << top_step << "_()" << endl;
|
||||
os << " {" << endl;
|
||||
os << " if (step_" << top_step << "_idx_ == 0) {" << endl;
|
||||
os << " step_ = &step_" << out_step << "_;" << endl;
|
||||
os << " step_ = &thread" << process_counter <<
|
||||
"_t::step_" << out_step << "_;" << endl;
|
||||
os << " return true;" << endl;
|
||||
os << " }" << endl;
|
||||
os << " step_" << top_step << "_idx_ -= 1;" << endl;
|
||||
|
||||
net->emit_recurse(os,this);
|
||||
|
||||
os << " step_ = &step_" << top_step << "_;" << endl;
|
||||
os << " step_ = &thread" << process_counter <<
|
||||
"_t::step_" << top_step << "_;" << endl;
|
||||
os << " return true;" << endl;
|
||||
os << " }" << endl;
|
||||
|
||||
|
|
@ -1314,7 +1327,8 @@ void target_vvm::proc_utask(ostream&os, const NetUTask*net)
|
|||
unsigned out_step = ++thread_step_;
|
||||
const string name = mangle(net->name());
|
||||
os << " callee_ = new " << name << "(sim_, this);" << endl;
|
||||
os << " step_ = &step_" << out_step << "_;" << endl;
|
||||
os << " step_ = &thread" << process_counter <<
|
||||
"_t::step_" << out_step << "_;" << endl;
|
||||
os << " return false;" << endl;
|
||||
os << " }" << endl;
|
||||
os << " bool step_" << out_step << "_()" << endl;
|
||||
|
|
@ -1340,7 +1354,8 @@ void target_vvm::proc_while(ostream&os, const NetWhile*net)
|
|||
unsigned head_step = ++thread_step_;
|
||||
unsigned out_step = ++thread_step_;
|
||||
|
||||
os << " step_ = &step_" << head_step << "_;" << endl;
|
||||
os << " step_ = &thread" << process_counter <<
|
||||
"_t::step_" << head_step << "_;" << endl;
|
||||
os << " return true;" << endl;
|
||||
os << " }" << endl;
|
||||
|
||||
|
|
@ -1353,7 +1368,8 @@ void target_vvm::proc_while(ostream&os, const NetWhile*net)
|
|||
os << " // " << net->expr()->get_line() <<
|
||||
": test while condition." << endl;
|
||||
os << " if (" << expr << "[0] != V1) {" << endl;
|
||||
os << " step_ = &step_" << out_step << "_;" << endl;
|
||||
os << " step_ = &thread" << process_counter <<
|
||||
"_t::step_" << out_step << "_;" << endl;
|
||||
os << " return true;" << endl;
|
||||
os << " }" << endl;
|
||||
|
||||
|
|
@ -1361,7 +1377,8 @@ void target_vvm::proc_while(ostream&os, const NetWhile*net)
|
|||
|
||||
os << " // " << net->expr()->get_line() <<
|
||||
": end of while loop." << endl;
|
||||
os << " step_ = &step_" << head_step << "_;" << endl;
|
||||
os << " step_ = &thread" << process_counter <<
|
||||
"_t::step_" << head_step << "_;" << endl;
|
||||
os << " return true;" << endl;
|
||||
os << " }" << endl;
|
||||
|
||||
|
|
@ -1376,7 +1393,8 @@ void target_vvm::proc_while(ostream&os, const NetWhile*net)
|
|||
void target_vvm::proc_event(ostream&os, const NetPEvent*proc)
|
||||
{
|
||||
thread_step_ += 1;
|
||||
os << " step_ = &step_" << thread_step_ << "_;" << endl;
|
||||
os << " step_ = &thread" << process_counter <<
|
||||
"_t::step_" << thread_step_ << "_;" << endl;
|
||||
|
||||
/* POSITIVE is for the wait construct, and needs to be handled
|
||||
specially. The structure of the generated code is:
|
||||
|
|
@ -1432,7 +1450,8 @@ void target_vvm::proc_event(ostream&os, const NetPEvent*proc)
|
|||
void target_vvm::proc_delay(ostream&os, const NetPDelay*proc)
|
||||
{
|
||||
thread_step_ += 1;
|
||||
os << " step_ = &step_" << thread_step_ << "_;" << endl;
|
||||
os << " step_ = &thread" << process_counter <<
|
||||
"_t::step_" << thread_step_ << "_;" << endl;
|
||||
os << " sim_->thread_delay(" << proc->delay() << ", this);"
|
||||
<< endl;
|
||||
os << " return false;" << endl;
|
||||
|
|
@ -1446,7 +1465,8 @@ void target_vvm::proc_delay(ostream&os, const NetPDelay*proc)
|
|||
void target_vvm::end_process(ostream&os, const NetProcTop*proc)
|
||||
{
|
||||
if (proc->type() == NetProcTop::KALWAYS) {
|
||||
os << " step_ = &step_0_;" << endl;
|
||||
os << " step_ = &thread" << process_counter <<
|
||||
"_t::step_0_;" << endl;
|
||||
os << " return true;" << endl;
|
||||
} else {
|
||||
os << " step_ = 0;" << endl;
|
||||
|
|
@ -1466,6 +1486,9 @@ extern const struct target tgt_vvm = {
|
|||
};
|
||||
/*
|
||||
* $Log: t-vvm.cc,v $
|
||||
* Revision 1.47 1999/09/28 01:21:27 steve
|
||||
* Proper syntax for method pointers.
|
||||
*
|
||||
* Revision 1.46 1999/09/28 01:13:15 steve
|
||||
* Support in vvm > and >= behavioral operators.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue