NOR device.

This commit is contained in:
steve 1999-10-09 19:24:36 +00:00
parent aa11f57b57
commit a4298df776
1 changed files with 45 additions and 1 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.12 1999/07/17 03:07:27 steve Exp $"
#ident "$Id: vvm_gates.h,v 1.13 1999/10/09 19:24:36 steve Exp $"
#endif
# include "vvm.h"
@ -131,6 +131,47 @@ template <unsigned WIDTH, unsigned long DELAY> class vvm_or {
vvm_out_event::action_t output_;
};
template <unsigned WIDTH, unsigned long DELAY> class vvm_nor {
public:
explicit vvm_nor(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 not(outval);
}
vvm_bit_t input_[WIDTH];
vvm_out_event::action_t output_;
};
template <unsigned long DELAY> class vvm_bufif1 {
public:
@ -455,6 +496,9 @@ template <unsigned WIDTH> class vvm_pevent {
/*
* $Log: vvm_gates.h,v $
* Revision 1.13 1999/10/09 19:24:36 steve
* NOR device.
*
* Revision 1.12 1999/07/17 03:07:27 steve
* pevent objects have initial values.
*