Missing start methods.

This commit is contained in:
steve 1999-01-31 18:15:55 +00:00
parent fb439c78b9
commit 15ff852487
1 changed files with 22 additions and 6 deletions

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.5 1999/01/01 01:44:56 steve Exp $"
#ident "$Id: vvm_gates.h,v 1.6 1999/01/31 18:15:55 steve Exp $"
#endif
# include "vvm.h"
@ -157,16 +157,21 @@ template <unsigned WIDTH, unsigned long DELAY> class vvm_xnor {
: 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_bit_t outval = input_[0];
for (unsigned i = 1 ; i < WIDTH ; i += 1)
outval = outval ^ input_[i];
outval = not(outval);
vvm_bit_t outval = compute_();
vvm_event*ev = new vvm_out_event(sim, outval, output_);
if (DELAY > 0)
sim->insert_event(DELAY, ev);
@ -175,6 +180,14 @@ template <unsigned WIDTH, unsigned long DELAY> class vvm_xnor {
}
private:
vvm_bit_t compute_() const
{ vvm_bit_t outval = input_[0];
for (unsigned i = 1 ; i < WIDTH ; i += 1)
outval = outval ^ input_[i];
outval = not(outval);
return outval;
}
vvm_bit_t input_[WIDTH];
vvm_out_event::action_t output_;
};
@ -315,6 +328,9 @@ class vvm_pevent {
/*
* $Log: vvm_gates.h,v $
* Revision 1.6 1999/01/31 18:15:55 steve
* Missing start methods.
*
* Revision 1.5 1999/01/01 01:44:56 steve
* Support the start() method.
*