Support for binary | (Stephen Tell)

This commit is contained in:
steve 1999-06-09 00:58:06 +00:00
parent f039b472d4
commit 1fe8e93e5c
2 changed files with 62 additions and 2 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: elaborate.cc,v 1.36 1999/06/07 02:23:31 steve Exp $"
#ident "$Id: elaborate.cc,v 1.37 1999/06/09 00:58:06 steve Exp $"
#endif
/*
@ -606,6 +606,19 @@ NetNet* PEBinary::elaborate_net(Design*des, const string&path) const
des->add_node(gate);
break;
case '|': // OR
assert(lsig->pin_count() == 1);
assert(rsig->pin_count() == 1);
gate = new NetLogic(des->local_symbol(path), 3, NetLogic::OR);
connect(gate->pin(1), lsig->pin(0));
connect(gate->pin(2), rsig->pin(0));
osig = new NetNet(des->local_symbol(path), NetNet::WIRE);
osig->local_flag(true);
connect(gate->pin(0), osig->pin(0));
des->add_signal(osig);
des->add_node(gate);
break;
case 'e': // ==
assert(lsig->pin_count() == 1);
assert(rsig->pin_count() == 1);
@ -1369,6 +1382,9 @@ Design* elaborate(const map<string,Module*>&modules,
/*
* $Log: elaborate.cc,v $
* Revision 1.37 1999/06/09 00:58:06 steve
* Support for binary | (Stephen Tell)
*
* Revision 1.36 1999/06/07 02:23:31 steve
* Support non-blocking assignment down to vvm.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: vvm_gates.h,v 1.10 1999/05/03 01:51:29 steve Exp $"
#ident "$Id: vvm_gates.h,v 1.11 1999/06/09 00:58:29 steve Exp $"
#endif
# include "vvm.h"
@ -90,6 +90,47 @@ template <unsigned WIDTH, unsigned long DELAY> class vvm_and {
vvm_out_event::action_t output_;
};
template <unsigned WIDTH, unsigned long DELAY> class vvm_or {
public:
explicit vvm_or(vvm_out_event::action_t o)
: output_(o) { }
void init(unsigned idx, vvm_bit_t val)
{ input_[idx-1] = val; }
void start(vvm_simulation*sim)
{ vvm_event*ev = new vvm_out_event(sim, compute_(), output_);
if (DELAY > 0)
sim->insert_event(DELAY, ev);
else
sim->active_event(ev);
}
void set(vvm_simulation*sim, unsigned idx, vvm_bit_t val)
{ if (input_[idx-1] == val)
return;
input_[idx-1] = val;
vvm_event*ev = new vvm_out_event(sim, compute_(), output_);
if (DELAY > 0)
sim->insert_event(DELAY, ev);
else
sim->active_event(ev);
}
private:
vvm_bit_t compute_() const
{ vvm_bit_t outval = input_[0];
for (unsigned i = 1 ; i < WIDTH ; i += 1)
outval = outval | input_[i];
return outval;
}
vvm_bit_t input_[WIDTH];
vvm_out_event::action_t output_;
};
template <unsigned long DELAY> class vvm_bufif1 {
public:
@ -409,6 +450,9 @@ template <unsigned WIDTH> class vvm_pevent {
/*
* $Log: vvm_gates.h,v $
* Revision 1.11 1999/06/09 00:58:29 steve
* Support for binary | (Stephen Tell)
*
* Revision 1.10 1999/05/03 01:51:29 steve
* Restore support for wait event control.
*