From a9e11d6546e5d4e06959385508380e13d799775f Mon Sep 17 00:00:00 2001 From: steve Date: Wed, 22 Mar 2000 04:26:40 +0000 Subject: [PATCH] Replace the vpip_bit_t with a typedef and define values for all the different bit values, including strengths. --- t-vvm.cc | 92 +++++++++++++------- vvm/vpi_bit.c | 107 +++++++++++++++++++++++ vvm/vpi_const.c | 103 +++++++++------------- vvm/vpi_memory.c | 19 ++-- vvm/vpi_priv.h | 69 +++++++++++++-- vvm/vvm.h | 72 ++++++++-------- vvm/vvm_add_sub.cc | 17 ++-- vvm/vvm_bit.cc | 117 ++++++++++++------------- vvm/vvm_clshift.cc | 35 ++++---- vvm/vvm_compare.cc | 21 +++-- vvm/vvm_ff.cc | 9 +- vvm/vvm_func.cc | 211 +++++++++++++++++++++++---------------------- vvm/vvm_func.h | 57 ++++++------ vvm/vvm_gates.cc | 59 ++++++++----- vvm/vvm_gates.h | 13 ++- vvm/vvm_mult.cc | 43 ++++----- vvm/vvm_mux.cc | 27 +++--- vvm/vvm_nexus.cc | 13 ++- vvm/vvm_signal.h | 11 ++- 19 files changed, 668 insertions(+), 427 deletions(-) create mode 100644 vvm/vpi_bit.c diff --git a/t-vvm.cc b/t-vvm.cc index c19afeb3f..b2babeffa 100644 --- a/t-vvm.cc +++ b/t-vvm.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-vvm.cc,v 1.119 2000/03/20 17:40:33 steve Exp $" +#ident "$Id: t-vvm.cc,v 1.120 2000/03/22 04:26:40 steve Exp $" #endif # include @@ -235,16 +235,16 @@ void vvm_proc_rval::expr_const(const NetEConst*expr) os_ << setw(indent_) << "" << tname << "[" << idx << "] = "; switch (expr->value().get(idx)) { case verinum::V0: - os_ << "V0"; + os_ << "St0"; break; case verinum::V1: - os_ << "V1"; + os_ << "St1"; break; case verinum::Vx: - os_ << "Vx"; + os_ << "StX"; break; case verinum::Vz: - os_ << "Vz"; + os_ << "HiZ"; break; } os_ << ";" << endl; @@ -561,16 +561,16 @@ void vvm_parm_rval::expr_const(const NetEConst*expr) tgt_->init_code << " bits[" << idx << "] = "; switch(expr->value().get(idx)) { case verinum::V0: - tgt_->init_code << "V0;" << endl; + tgt_->init_code << "St0;" << endl; break; case verinum::V1: - tgt_->init_code << "V1;" << endl; + tgt_->init_code << "St1;" << endl; break; case verinum::Vx: - tgt_->init_code << "Vx;" << endl; + tgt_->init_code << "StX;" << endl; break; case verinum::Vz: - tgt_->init_code << "Vz;" << endl; + tgt_->init_code << "HiZ;" << endl; break; } } @@ -826,8 +826,22 @@ void target_vvm::signal(ostream&os, const NetNet*sig) continue; init_code << " " << mangle(sig->name()) << ".init_P(" - << idx << ", V" << sig->get_ival(idx) << ");" - << endl; + << idx << ", "; + switch (sig->get_ival(idx)) { + case verinum::V0: + init_code << "St0"; + break; + case verinum::V1: + init_code << "St1"; + break; + case verinum::Vx: + init_code << "StX"; + break; + case verinum::Vz: + init_code << "HiZ"; + break; + } + init_code << ");" << endl; // Propogate the initial value to inputs throughout. emit_init_value_(sig->pin(idx), sig->get_ival(idx)); @@ -932,9 +946,24 @@ void target_vvm::emit_init_value_(const NetObj::Link&lnk, verinum::V val) // Build an init statement for the link, that writes the // value. ostrstream line; - line << " " << mangle(cur->get_obj()->name()) << - ".init_" << cur->get_name() << "(" << - cur->get_inst() << ", V" << val << ");" << endl << ends; + line << " " << mangle(cur->get_obj()->name()) + << ".init_" << cur->get_name() << "(" << cur->get_inst() + << ", "; + switch (val) { + case verinum::V0: + line << "St0"; + break; + case verinum::V1: + line << "St1"; + break; + case verinum::Vx: + line << "StX"; + break; + case verinum::Vz: + line << "HiZ"; + break; + } + line << ");" << endl << ends; // Check to see if the line has already been @@ -1019,11 +1048,11 @@ void target_vvm::lpm_add_sub(ostream&os, const NetAddSub*gate) if (gate->attribute("LPM_Direction") == "ADD") { init_code << " " << mangle(gate->name()) << - ".init_Add_Sub(0, V1);" << endl; + ".init_Add_Sub(0, St1);" << endl; } else if (gate->attribute("LPM_Direction") == "SUB") { init_code << " " << mangle(gate->name()) << - ".init_Add_Sub(0, V0);" << endl; + ".init_Add_Sub(0, St0);" << endl; } @@ -1581,16 +1610,16 @@ void target_vvm::proc_assign(ostream&os, const NetAssign*net) defn << " nexus_wire_table[" <expr(idx) << " */" << endl; string guard = emit_proc_rval(defn, 8, net->expr(idx)); - defn << " if (V1 == " << test_func << "(" << guard << "," - << expr << ")[0]) {" << endl; + defn << " if (B_IS1(" << test_func << "(" << guard << "," + << expr << ")[0])) {" << endl; defn << " step_ = &" << thread_class_ << "::step_" << thread_step_ << "_;" << endl; defn << " return true;" << endl; @@ -1919,8 +1948,8 @@ void target_vvm::proc_case_fun(ostream&os, const NetCase*net) string guard = emit_proc_rval(defn, 6, net->expr(idx)); - defn << " if (V1 == " << test_func << "(" << - guard << "," << expr << ")[0]) {" << endl; + defn << " if (B_IS1(" << test_func << "(" << + guard << "," << expr << ")[0])) {" << endl; if (net->stat(idx)) net->stat(idx)->emit_proc(os, this); defn << " break; }" << endl; @@ -1948,7 +1977,7 @@ void target_vvm::proc_condit(ostream&os, const NetCondit*net) unsigned else_step = ++thread_step_; unsigned out_step = ++thread_step_; - defn << " if (" << expr << "[0] == V1)" << endl; + defn << " if (B_IS1(" << expr << "[0]))" << endl; defn << " step_ = &" << thread_class_ << "::step_" << if_step << "_;" << endl; defn << " else" << endl; @@ -1989,7 +2018,7 @@ void target_vvm::proc_condit_fun(ostream&os, const NetCondit*net) defn << " // " << net->get_line() << ": conditional (if-else)" << endl; - defn << " if (" << expr << "[0] == V1) {" << endl; + defn << " if (B_IS1(" << expr << "[0])) {" << endl; net->emit_recurse_if(os, this); defn << " } else {" << endl; net->emit_recurse_else(os, this); @@ -2142,7 +2171,7 @@ void target_vvm::proc_while(ostream&os, const NetWhile*net) defn << "// " << net->expr()->get_line() << ": test while condition." << endl; - defn << " if (" << expr << "[0] != V1) {" << endl; + defn << " if (!B_IS1(" << expr << "[0])) {" << endl; defn << " step_ = &" << thread_class_ << "::step_" << out_step << "_;" << endl; defn << " return true;" << endl; @@ -2195,8 +2224,8 @@ void target_vvm::proc_event(ostream&os, const NetPEvent*proc) svector*list = proc->back_list(); if ((list->count()==1) && ((*list)[0]->type() == NetNEvent::POSITIVE)) { - defn << " if (" << mangle((*list)[0]->name()) << - ".get()[0]==V1) {" << endl; + defn << " if (B_IS1(" << mangle((*list)[0]->name()) << + ".get()[0])) {" << endl; defn << " return true;" << endl; defn << " } else {" << endl; defn << " " << mangle(proc->name()) << @@ -2268,6 +2297,11 @@ extern const struct target tgt_vvm = { }; /* * $Log: t-vvm.cc,v $ + * Revision 1.120 2000/03/22 04:26:40 steve + * Replace the vpip_bit_t with a typedef and + * define values for all the different bit + * values, including strengths. + * * Revision 1.119 2000/03/20 17:40:33 steve * Do not link adder pins that ar unconnected. * diff --git a/vvm/vpi_bit.c b/vvm/vpi_bit.c new file mode 100644 index 000000000..d5bd2a778 --- /dev/null +++ b/vvm/vpi_bit.c @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2000 Stephen Williams (steve@icarus.com) + * + * This source code is free software; you can redistribute it + * and/or modify it in source code form under the terms of the GNU + * General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) + * any later version + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ +#if !defined(WINNT) && !defined(macintosh) +#ident "$Id: vpi_bit.c,v 1.1 2000/03/22 04:26:40 steve Exp $" +#endif + +# include "vpi_priv.h" + +#define UNAMBIG(v) ((v)&0x0f == (v)>>4) + + +# define STREN1(v) ( ((v)&0x80)? ((v)&0xf0) : (0x70 - ((v)&0xf0)) ) +# define STREN0(v) ( ((v)&0x08)? ((v)&0x0f) : (0x07 - ((v)&0x0f)) ) + +vpip_bit_t vpip_bits_resolve(const vpip_bit_t*bits, unsigned nbits) +{ + vpip_bit_t res = bits[0]; + + for (idx = 1 ; idx < nbits ; idx += 1) { + /* High-impedence drives do not affect the result. */ + if (bits[idx] == HiZ) + continue; + + if (UNAMBIG(res) && UNAMBIG(bits[idx])) { + + /* If both signals are unambiguous, simply choose + the stronger. */ + + if (bits[idx]&0x77 > res&0x77) + res = bits[idx]; + else if (bits[idx]*0x77 == res&0x77) + res = (res&0xf0) + (bits[idx]&0x0f); + else + ; + + } else if (UNAMBIG(res) || UNAMBIG(bits[idx])) { + + /* If one of the signals is unambiguous, then it + will sweep up the weaker parts of the ambiguous + signal. The result may be ambiguous, or maybe + not. */ + + vpip_bit_t tmp = 0; + + if (res&0x70 > bits[idx]&0x70) + tmp |= res&0xf0; + else + tmp |= bits[idx]&0xf0; + + if (res&0x07 > bits[idx]&0x07) + tmp |= res&0x0f; + else + tmp |= bits[idx]&0x0f; + + } else { + + /* If both signals are ambiguous, then the result + has an even wider ambiguity. */ + + vpip_bit_t tmp = 0; + + if (STREN1(bits[idx]) > STREN1(res)) + tmp |= bits[idx]&0xf0; + else + tmp |= res&0xf0; + + if (STREN0(bits[idx]) < STREN0(res)) + tmp |= bits[idx]&0x0f; + else + tmp |= res&0x0f; + + res = tmp; + } + + } + + if (res&0x77 == 0) + res = HiZ; + + return res; +} + +/* + * $Log: vpi_bit.c,v $ + * Revision 1.1 2000/03/22 04:26:40 steve + * Replace the vpip_bit_t with a typedef and + * define values for all the different bit + * values, including strengths. + * + */ + diff --git a/vvm/vpi_const.c b/vvm/vpi_const.c index 88076307b..436f468b5 100644 --- a/vvm/vpi_const.c +++ b/vvm/vpi_const.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2000 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vpi_const.c,v 1.6 2000/02/23 02:56:56 steve Exp $" +#ident "$Id: vpi_const.c,v 1.7 2000/03/22 04:26:41 steve Exp $" #endif # include "vpi_priv.h" @@ -30,7 +30,7 @@ * This function is used in a couple places to interpret a bit string * as a value. */ -void vpip_bits_get_value(enum vpip_bit_t*bits, unsigned nbits, s_vpi_value*vp) +void vpip_bits_get_value(vpip_bit_t*bits, unsigned nbits, s_vpi_value*vp) { static char buff[1024]; char*cp; @@ -42,20 +42,15 @@ void vpip_bits_get_value(enum vpip_bit_t*bits, unsigned nbits, s_vpi_value*vp) switch (vp->format) { case vpiObjTypeVal: case vpiBinStrVal: - for (idx = 0 ; idx < nbits ; idx += 1) - switch (bits[nbits-idx-1]) { - case V0: + for (idx = 0 ; idx < nbits ; idx += 1) { + if (B_IS0(bits[nbits-idx-1])) *cp++ = '0'; - break; - case V1: + else if (B_IS1(bits[nbits-idx-1])) *cp++ = '1'; - break; - case Vx: - *cp++ = 'x'; - break; - case Vz: + else if (B_ISZ(bits[nbits-idx-1])) *cp++ = 'z'; - break; + else + *cp++ = 'x'; } vp->format = vpiBinStrVal; break; @@ -64,15 +59,8 @@ void vpip_bits_get_value(enum vpip_bit_t*bits, unsigned nbits, s_vpi_value*vp) val = 0; for (idx = 0 ; idx < nbits ; idx += 1) { val *= 2; - switch (bits[nbits-idx-1]) { - case V0: - case Vx: - case Vz: - break; - case V1: + if (B_IS1(bits[nbits-idx-1])) val += 1; - break; - } } sprintf(cp, "%u", val); cp += strlen(cp); @@ -86,19 +74,14 @@ void vpip_bits_get_value(enum vpip_bit_t*bits, unsigned nbits, s_vpi_value*vp) unsigned i; for (i = 0 ; i < nbits%3 ; i += 1) { v *= 2; - switch (bits[nbits-i-1]) { - case V0: - break; - case V1: + if (B_IS0(bits[nbits-i-1])) + ; + else if (B_IS1(bits[nbits-i-1])) v += 1; - break; - case Vx: + else if (B_ISX(bits[nbits-i-1])) x += 1; - break; - case Vz: + else if (B_ISZ(bits[nbits-i-1])) z += 1; - break; - } } if (x == nbits%3) *cp++ = 'x'; @@ -119,19 +102,15 @@ void vpip_bits_get_value(enum vpip_bit_t*bits, unsigned nbits, s_vpi_value*vp) unsigned i; for (i = idx ; i < idx+3 ; i += 1) { v *= 2; - switch (bits[nbits-i-1]) { - case V0: - break; - case V1: + if (B_IS0(bits[nbits-i-1])) + ; + else if (B_IS1(bits[nbits-i-1])) v += 1; - break; - case Vx: + else if (B_ISX(bits[nbits-i-1])) x += 1; - break; - case Vz: + else if (B_ISZ(bits[nbits-i-1])) z += 1; - break; - } + } if (x == 3) *cp++ = 'x'; @@ -154,19 +133,15 @@ void vpip_bits_get_value(enum vpip_bit_t*bits, unsigned nbits, s_vpi_value*vp) unsigned i; for (i = 0 ; i < nbits%4 ; i += 1) { v *= 2; - switch (bits[nbits-i-1]) { - case V0: - break; - case V1: + if (B_IS0(bits[nbits-i-1])) + ; + else if (B_IS1(bits[nbits-i-1])) v += 1; - break; - case Vx: + else if (B_ISX(bits[nbits-i-1])) x += 1; - break; - case Vz: + else if (B_ISZ(bits[nbits-i-1])) z += 1; - break; - } + } if (x == nbits%4) *cp++ = 'x'; @@ -187,19 +162,16 @@ void vpip_bits_get_value(enum vpip_bit_t*bits, unsigned nbits, s_vpi_value*vp) unsigned i; for (i = idx ; i < idx+4 ; i += 1) { v *= 2; - switch (bits[nbits-i-1]) { - case V0: - break; - case V1: + if (B_IS0(bits[nbits-i-1])) + ; + else if (B_IS1(bits[nbits-i-1])) v += 1; - break; - case Vx: + else if (B_ISX(bits[nbits-i-1])) x += 1; - break; - case Vz: + else if (B_ISZ(bits[nbits-i-1])) z += 1; - break; - } + + } if (x == 4) *cp++ = 'x'; @@ -308,7 +280,7 @@ vpiHandle vpip_make_string_const(struct __vpiStringConst*ref, const char*val) } vpiHandle vpip_make_number_const(struct __vpiNumberConst*ref, - const enum vpip_bit_t*bits, + const vpip_bit_t*bits, unsigned nbits) { ref->base.vpi_type = &vpip_number_rt; @@ -319,6 +291,11 @@ vpiHandle vpip_make_number_const(struct __vpiNumberConst*ref, /* * $Log: vpi_const.c,v $ + * Revision 1.7 2000/03/22 04:26:41 steve + * Replace the vpip_bit_t with a typedef and + * define values for all the different bit + * values, including strengths. + * * Revision 1.6 2000/02/23 02:56:56 steve * Macintosh compilers do not support ident. * diff --git a/vvm/vpi_memory.c b/vvm/vpi_memory.c index d248b542a..d2dd92ce6 100644 --- a/vvm/vpi_memory.c +++ b/vvm/vpi_memory.c @@ -26,7 +26,7 @@ * Picture Elements, Inc., 777 Panoramic Way, Berkeley, CA 94704. */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vpi_memory.c,v 1.6 2000/02/29 01:41:32 steve Exp $" +#ident "$Id: vpi_memory.c,v 1.7 2000/03/22 04:26:41 steve Exp $" #endif # include "vpi_priv.h" @@ -117,7 +117,7 @@ static vpiHandle memory_word_put(vpiHandle ref, p_vpi_value val, p_vpi_time tim, int flags) { unsigned idx; - enum vpip_bit_t*base; + vpip_bit_t*base; struct __vpiMemoryWord*rfp = (struct __vpiMemoryWord*)ref; assert(ref->vpi_type->type_code==vpiMemoryWord); @@ -131,14 +131,14 @@ static vpiHandle memory_word_put(vpiHandle ref, p_vpi_value val, if (bval & 1) { if (aval & 1) - *base = Vx; + *base = StX; else - *base = Vz; + *base = HiZ; } else { if (aval & 1) - *base = V1; + *base = St1; else - *base = V0; + *base = St0; } base += 1; } @@ -183,7 +183,7 @@ vpiHandle vpip_make_memory(struct __vpiMemory*ref, const char*name, ref->base.vpi_type = &vpip_memory_rt; ref->name = name; - ref->bits = calloc(wid*siz, sizeof(enum vpip_bit_t)); + ref->bits = calloc(wid*siz, sizeof(vpip_bit_t)); ref->words = calloc(siz, sizeof(struct __vpiMemoryWord)); ref->args = 0; ref->width = wid; @@ -199,6 +199,11 @@ vpiHandle vpip_make_memory(struct __vpiMemory*ref, const char*name, } /* * $Log: vpi_memory.c,v $ + * Revision 1.7 2000/03/22 04:26:41 steve + * Replace the vpip_bit_t with a typedef and + * define values for all the different bit + * values, including strengths. + * * Revision 1.6 2000/02/29 01:41:32 steve * Fix warning and typo. * diff --git a/vvm/vpi_priv.h b/vvm/vpi_priv.h index 6270a129a..09c592d1b 100644 --- a/vvm/vpi_priv.h +++ b/vvm/vpi_priv.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vpi_priv.h,v 1.11 2000/02/23 02:56:56 steve Exp $" +#ident "$Id: vpi_priv.h,v 1.12 2000/03/22 04:26:41 steve Exp $" #endif /* @@ -35,9 +35,59 @@ extern "C" { #endif struct __vpirt; -enum vpip_bit_t { V0 = 0, V1, Vx, Vz }; -extern void vpip_bits_get_value(enum vpip_bit_t*bits, unsigned nbits, +/* + * The simulation engine internally carries the strengths along with + * the bit values, and that includes ambiguous strengths. The complete + * bit value (including ambiguity) is encoded in 8 bits like so: + * + * VSSSvsss + * + * The V and v bits encode the bit logic values, and the SSS and sss + * bits encode the strength range. The logic values are like so: + * + * 0SSS0sss - Logic 0 + * 1SSS1sss - Logic 1 + * 1xxx0xxx - Logic X + * 00001000 - Logic Z + * + * So as you can see, logic values can be quickly compared by masking + * the strength bits. + * + * If the value is unambiguous, then the SSS and sss bits have the + * same value, and encode the strength of the driven value. If the + * value is logic X, then "unambiguous" in this context means the + * strength is well known, even though the logic value is + * not. However, it is treated as ambiguous by the resolver. + * + * If the strength is ambiguous, then the high 4 bits are always + * arithmetically larger then the low 4 bits. For logic 0 and logic 1 + * values, this means that the SSS value is >= the sss value. For + * logic X values, the 'V' bit is set and SSS is the strength toward 1, + * and the 'v' bit is 0 and sss is the strength toward 0. + */ +typedef unsigned char vpip_bit_t; + +# define St1 0xee +# define St0 0x66 +# define StX 0xe6 +# define HiZ 0x08 + + /* Compare the logic values of two vpip_bit_t variables, or test + the logical value of the bit. */ +# define B_EQ(l,r) (((l)&0x88) == ((r)&0x88)) +# define B_IS0(v) (((v)&0x88) == 0x00) +# define B_IS1(v) (((v)&0x88) == 0x88) +# define B_ISX(v) (((v)&0x88) == 0x80) +# define B_ISZ(v) ((v) == HiZ) +# define B_ISXZ(v) (1 & (((v)>>7) ^ ((v)>>3))) + + /* Take as input an array of bits, and return the resolved + value. The result accounts for the strengths involved. */ +extern vpip_bit_t vpip_bits_resolve(const vpip_bit_t*bits, unsigned nbits); + + +extern void vpip_bits_get_value(vpip_bit_t*bits, unsigned nbits, s_vpi_value*vp); /* @@ -102,7 +152,7 @@ struct __vpiMemory { struct __vpiHandle base; /* The signal has a name (this points to static memory.) */ const char*name; - enum vpip_bit_t*bits; + vpip_bit_t*bits; struct __vpiMemoryWord*words; vpiHandle*args; unsigned width; @@ -152,7 +202,7 @@ struct __vpiSignal { /* The signal has a name (this points to static memory.) */ const char*name; /* The signal has a value and dimension. */ - enum vpip_bit_t*bits; + vpip_bit_t*bits; unsigned nbits; /* monitors are added here. */ struct __vpiCallback*monitor; @@ -197,7 +247,7 @@ struct __vpiStringConst { struct __vpiNumberConst { struct __vpiHandle base; - enum vpip_bit_t*bits; + vpip_bit_t*bits; unsigned nbits; }; @@ -215,7 +265,7 @@ extern vpiHandle vpip_make_scope(struct __vpiScope*ref, extern vpiHandle vpip_make_string_const(struct __vpiStringConst*ref, const char*val); extern vpiHandle vpip_make_number_const(struct __vpiNumberConst*ref, - const enum vpip_bit_t*bits, + const vpip_bit_t*bits, unsigned nbits); extern vpiHandle vpip_make_memory(struct __vpiMemory*ref, const char*name, unsigned width, unsigned size); @@ -285,6 +335,11 @@ extern int vpip_finished(); /* * $Log: vpi_priv.h,v $ + * Revision 1.12 2000/03/22 04:26:41 steve + * Replace the vpip_bit_t with a typedef and + * define values for all the different bit + * values, including strengths. + * * Revision 1.11 2000/02/23 02:56:56 steve * Macintosh compilers do not support ident. * diff --git a/vvm/vvm.h b/vvm/vvm.h index 7624b8424..5d042584f 100644 --- a/vvm/vvm.h +++ b/vvm/vvm.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvm.h,v 1.33 2000/03/16 19:03:04 steve Exp $" +#ident "$Id: vvm.h,v 1.34 2000/03/22 04:26:41 steve Exp $" #endif # include @@ -37,62 +37,57 @@ class vvm_thread; class ostream; -inline vpip_bit_t operator & (vpip_bit_t l, vpip_bit_t r) +inline vpip_bit_t B_AND(vpip_bit_t l, vpip_bit_t r) { - if (l == V0) return V0; - if (r == V0) return V0; - if ((l == V1) && (r == V1)) return V1; - return Vx; + if (B_IS0(l)) return St0; + if (B_IS0(r)) return St0; + if (B_IS1(l) && B_IS1(r)) return St1; + return StX; } -inline vpip_bit_t operator | (vpip_bit_t l, vpip_bit_t r) +inline vpip_bit_t B_OR(vpip_bit_t l, vpip_bit_t r) { - if (l == V1) return V1; - if (r == V1) return V1; - if ((l == V0) && (r == V0)) return V0; - return Vx; + if (B_IS1(l)) return St1; + if (B_IS1(r)) return St1; + if (B_IS0(l) && B_IS0(r)) return St0; + return StX; } -inline vpip_bit_t operator ^ (vpip_bit_t l, vpip_bit_t r) +inline vpip_bit_t B_XOR(vpip_bit_t l, vpip_bit_t r) { - if (l == Vx) return Vx; - if (l == Vz) return Vx; - if (r == Vx) return Vx; - if (r == Vz) return Vx; - if (l == V0) return r; - return (r == V0)? V1 : V0; + if (B_ISZ(l)) return StX; + if (B_ISZ(r)) return StX; + if (B_ISX(l)) return StX; + if (B_ISX(r)) return StX; + if (B_IS0(l)) return r; + return B_IS0(r)? St1 : St0; } inline vpip_bit_t less_with_cascade(vpip_bit_t l, vpip_bit_t r, vpip_bit_t c) { - if (l == Vx) return Vx; - if (r == Vx) return Vx; - if (l > r) return V0; - if (l < r) return V1; + if (B_ISXZ(l)) return StX; + if (B_ISXZ(r)) return StX; + if ((l&0x80) > (r&0x80)) return St0; + if ((l&0x80) < (r&0x80)) return St1; return c; } inline vpip_bit_t greater_with_cascade(vpip_bit_t l, vpip_bit_t r, vpip_bit_t c) { - if (l == Vx) return Vx; - if (r == Vx) return Vx; - if (l > r) return V1; - if (l < r) return V0; + if (B_ISXZ(l)) return StX; + if (B_ISXZ(r)) return StX; + if ((l&0x80) > (r&0x80)) return St1; + if ((l&0x80) < (r&0x80)) return St0; return c; } extern vpip_bit_t add_with_carry(vpip_bit_t l, vpip_bit_t r, vpip_bit_t&carry); -inline vpip_bit_t v_not(vpip_bit_t l) +inline vpip_bit_t B_NOT(vpip_bit_t l) { - switch (l) { - case V0: - return V1; - case V1: - return V0; - default: - return Vx; - } + if (B_IS0(l)) return St1; + if (B_IS1(l)) return St0; + return StX; } extern bool posedge(vpip_bit_t from, vpip_bit_t to); @@ -107,7 +102,7 @@ class vvm_bits_t { unsigned as_unsigned() const; }; -extern ostream& operator << (ostream&os, vpip_bit_t); +extern ostream& b_output (ostream&os, vpip_bit_t); extern ostream& operator << (ostream&os, const vvm_bits_t&str); /* @@ -137,6 +132,11 @@ class vvm_event { /* * $Log: vvm.h,v $ + * Revision 1.34 2000/03/22 04:26:41 steve + * Replace the vpip_bit_t with a typedef and + * define values for all the different bit + * values, including strengths. + * * Revision 1.33 2000/03/16 19:03:04 steve * Revise the VVM backend to use nexus objects so that * drivers and resolution functions can be used, and diff --git a/vvm/vvm_add_sub.cc b/vvm/vvm_add_sub.cc index 81402f4ca..419a81349 100644 --- a/vvm/vvm_add_sub.cc +++ b/vvm/vvm_add_sub.cc @@ -17,21 +17,21 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvm_add_sub.cc,v 1.1 2000/03/17 17:25:53 steve Exp $" +#ident "$Id: vvm_add_sub.cc,v 1.2 2000/03/22 04:26:41 steve Exp $" #endif # include "vvm_gates.h" # include vvm_add_sub::vvm_add_sub(unsigned wid) -: width_(wid), ndir_(V0) +: width_(wid), ndir_(St0) { ibits_ = new vpip_bit_t[width_*3]; ro_ = new vvm_nexus::drive_t[width_]; - c_ = Vx; + c_ = StX; for (unsigned idx = 0 ; idx < width_*3 ; idx += 1) - ibits_[idx] = Vx; + ibits_[idx] = StX; } vvm_add_sub::~vvm_add_sub() @@ -77,7 +77,7 @@ void vvm_add_sub::init_DataB(unsigned idx, vpip_bit_t val) void vvm_add_sub::init_Add_Sub(unsigned, vpip_bit_t val) { - ndir_ = v_not(val); + ndir_ = B_NOT(val); } void vvm_add_sub::start() @@ -102,7 +102,7 @@ void vvm_add_sub::compute_() for (unsigned idx = 0 ; idx < width_ ; idx += 1) { vpip_bit_t val; - val = add_with_carry(a[idx], b[idx] ^ ndir_, carry); + val = add_with_carry(a[idx], B_XOR(b[idx],ndir_), carry); if (val == r[idx]) continue; r[idx] = val; vvm_event*ev = new vvm_out_event(val, ro_+idx); @@ -114,6 +114,11 @@ void vvm_add_sub::compute_() /* * $Log: vvm_add_sub.cc,v $ + * Revision 1.2 2000/03/22 04:26:41 steve + * Replace the vpip_bit_t with a typedef and + * define values for all the different bit + * values, including strengths. + * * Revision 1.1 2000/03/17 17:25:53 steve * Adder and comparator in nexus style. * diff --git a/vvm/vvm_bit.cc b/vvm/vvm_bit.cc index 47e943eea..9105bce52 100644 --- a/vvm/vvm_bit.cc +++ b/vvm/vvm_bit.cc @@ -17,42 +17,48 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvm_bit.cc,v 1.9 2000/03/16 19:03:04 steve Exp $" +#ident "$Id: vvm_bit.cc,v 1.10 2000/03/22 04:26:41 steve Exp $" #endif # include "vvm.h" # include -ostream& operator << (ostream&os, vpip_bit_t bit) +ostream& b_output (ostream&os, vpip_bit_t bit) { - switch (bit) { - case V0: + if (B_IS0(bit)) { os << "0"; - break; - case V1: - os << "1"; - break; - case Vx: - os << "x"; - break; - case Vz: - os << "z"; - break; + return os; } + + if (B_IS1(bit)) { + os << "1"; + return os; + } + + if (B_ISX(bit)) { + os << "x"; + return os; + } + + if (B_ISZ(bit)) { + os << "z"; + return os; + } + return os; } bool posedge(vpip_bit_t from, vpip_bit_t to) { - switch (from) { - case V1: + if (B_IS1(from)) return false; - case V0: - return from != to; - case Vx: - case Vz: - return to == V1; - } + + if (B_ISX(from) || B_ISZ(from)) + return B_IS1(to); + + if (B_IS0(from)) + return ! B_IS0(to); + return false; } @@ -60,7 +66,7 @@ ostream& operator << (ostream&os, const vvm_bits_t&str) { os << str.get_width() << "b'"; for (unsigned idx = str.get_width() ; idx > 0 ; idx -= 1) - os << str.get_bit(idx); + b_output(os, str.get_bit(idx)); return os; } @@ -75,15 +81,9 @@ unsigned vvm_bits_t::as_unsigned() const unsigned width = get_width(); for (unsigned idx = width ; idx > 0 ; idx -= 1) { result <<= 1; - switch (get_bit(idx-1)) { - case V0: - case Vx: - case Vz: - break; - case V1: + + if (B_IS1(get_bit(idx-1))) result |= 1; - break; - } } return result; } @@ -91,49 +91,46 @@ unsigned vvm_bits_t::as_unsigned() const vpip_bit_t add_with_carry(vpip_bit_t l, vpip_bit_t r, vpip_bit_t&carry) { unsigned li, ri, ci; - switch (l) { - case V0: - li = 0; - break; - case V1: + + if (B_IS1(l)) { li = 1; - break; - default: - carry = Vx; - return Vx; + } else if (B_IS0(l)) { + li = 0; + } else { + carry = StX; + return StX; } - switch (r) { - case V0: - ri = 0; - break; - case V1: + if (B_IS1(r)) { ri = 1; - break; - default: - carry = Vx; - return Vx; + } else if (B_IS0(r)) { + ri = 0; + } else { + carry = StX; + return StX; } - switch (carry) { - case V0: - ci = 0; - break; - case V1: + if (B_IS1(carry)) { ci = 1; - break; - default: - carry = Vx; - return Vx; + } else if (B_IS0(carry)) { + ci = 0; + } else { + carry = StX; + return StX; } unsigned sum = li + ri + ci; - carry = (sum & 2)? V1 : V0; - return (sum & 1)? V1 : V0; + carry = (sum & 2)? St1 : St0; + return (sum & 1)? St1 : St0; } /* * $Log: vvm_bit.cc,v $ + * Revision 1.10 2000/03/22 04:26:41 steve + * Replace the vpip_bit_t with a typedef and + * define values for all the different bit + * values, including strengths. + * * Revision 1.9 2000/03/16 19:03:04 steve * Revise the VVM backend to use nexus objects so that * drivers and resolution functions can be used, and diff --git a/vvm/vvm_clshift.cc b/vvm/vvm_clshift.cc index 171c57321..79ddc1d34 100644 --- a/vvm/vvm_clshift.cc +++ b/vvm/vvm_clshift.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvm_clshift.cc,v 1.1 2000/03/17 02:22:03 steve Exp $" +#ident "$Id: vvm_clshift.cc,v 1.2 2000/03/22 04:26:41 steve Exp $" #endif # include "vvm_gates.h" @@ -36,10 +36,10 @@ vvm_clshift::vvm_clshift(unsigned wid, unsigned wid_dist) ibits_ = new vpip_bit_t[width_ + wdist_]; out_ = new vvm_nexus::drive_t[width_]; dist_val_ = width_; - dir_ = V0; + dir_ = St0; for (unsigned idx = 0 ; idx < width_+wdist_ ; idx += 1) - ibits_[idx] = Vx; + ibits_[idx] = StX; } vvm_clshift::~vvm_clshift() @@ -116,14 +116,14 @@ void vvm_clshift::compute_() if (dist_val_ == (int)width_) { for (unsigned idx = 0 ; idx < width_ ; idx += 1) - out_[idx].set_value(Vx); + out_[idx].set_value(StX); return; } for (unsigned idx = 0 ; idx < width_ ; idx += 1) { vpip_bit_t val; - if ((idx-dist_val_) >= width_) val = V0; - else if ((idx-dist_val_) < 0) val = V0; + if ((idx-dist_val_) >= width_) val = St0; + else if ((idx-dist_val_) < 0) val = St0; else val = ibits_[idx-dist_val_]; out_[idx].set_value(val); } @@ -132,17 +132,17 @@ void vvm_clshift::compute_() void vvm_clshift::calculate_dist_() { int tmp = 0; - for (unsigned idx = 0 ; idx < wdist_ ; idx += 1) - switch (ibits_[width_+idx]) { - case V0: - break; - case V1: - tmp |= 1< (int)width_) tmp = width_; - else if (dir_ == V1) + else if (B_IS1(dir_)) tmp = -tmp; dist_val_ = tmp; } /* * $Log: vvm_clshift.cc,v $ + * Revision 1.2 2000/03/22 04:26:41 steve + * Replace the vpip_bit_t with a typedef and + * define values for all the different bit + * values, including strengths. + * * Revision 1.1 2000/03/17 02:22:03 steve * vvm_clshift implementation without templates. * diff --git a/vvm/vvm_compare.cc b/vvm/vvm_compare.cc index a935f3ad9..cb105ca70 100644 --- a/vvm/vvm_compare.cc +++ b/vvm/vvm_compare.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvm_compare.cc,v 1.1 2000/03/17 17:25:53 steve Exp $" +#ident "$Id: vvm_compare.cc,v 1.2 2000/03/22 04:26:41 steve Exp $" #endif # include "vvm_gates.h" @@ -26,12 +26,12 @@ vvm_compare::vvm_compare(unsigned wid) : width_(wid) { - gt_ = Vx; - lt_ = Vx; + gt_ = StX; + lt_ = StX; ibits_ = new vpip_bit_t[2*width_]; for (unsigned idx = 0 ; idx < 2*width_ ; idx += 1) - ibits_[idx] = Vx; + ibits_[idx] = StX; } vvm_compare::~vvm_compare() @@ -94,8 +94,8 @@ void vvm_compare::take_value(unsigned key, vpip_bit_t val) void vvm_compare::compute_() { - vpip_bit_t gt = V0; - vpip_bit_t lt = V0; + vpip_bit_t gt = St0; + vpip_bit_t lt = St0; vpip_bit_t*a = ibits_; vpip_bit_t*b = ibits_+width_; @@ -109,13 +109,18 @@ void vvm_compare::compute_() gt_ = gt; lt_ = lt; out_lt_.set_value(lt_); - out_le_.set_value(v_not(gt_)); + out_le_.set_value(B_NOT(gt_)); out_gt_.set_value(gt_); - out_ge_.set_value(v_not(lt_)); + out_ge_.set_value(B_NOT(lt_)); } /* * $Log: vvm_compare.cc,v $ + * Revision 1.2 2000/03/22 04:26:41 steve + * Replace the vpip_bit_t with a typedef and + * define values for all the different bit + * values, including strengths. + * * Revision 1.1 2000/03/17 17:25:53 steve * Adder and comparator in nexus style. * diff --git a/vvm/vvm_ff.cc b/vvm/vvm_ff.cc index 3684d4b27..0f0d74907 100644 --- a/vvm/vvm_ff.cc +++ b/vvm/vvm_ff.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvm_ff.cc,v 1.1 2000/03/18 23:22:37 steve Exp $" +#ident "$Id: vvm_ff.cc,v 1.2 2000/03/22 04:26:41 steve Exp $" #endif # include "vvm_gates.h" @@ -28,7 +28,7 @@ vvm_ff::vvm_ff(unsigned w) out_ = new vvm_nexus::drive_t[width_]; bits_ = new vpip_bit_t[width_*2]; for (unsigned idx = 0 ; idx < width_*2 ; idx += 1) - bits_[idx] = Vx; + bits_[idx] = StX; } vvm_ff::~vvm_ff() @@ -96,6 +96,11 @@ void vvm_ff::latch_() /* * $Log: vvm_ff.cc,v $ + * Revision 1.2 2000/03/22 04:26:41 steve + * Replace the vpip_bit_t with a typedef and + * define values for all the different bit + * values, including strengths. + * * Revision 1.1 2000/03/18 23:22:37 steve * Update the FF device to nexus style. * diff --git a/vvm/vvm_func.cc b/vvm/vvm_func.cc index 691641917..d1f8561c0 100644 --- a/vvm/vvm_func.cc +++ b/vvm/vvm_func.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvm_func.cc,v 1.1 2000/03/13 00:02:34 steve Exp $" +#ident "$Id: vvm_func.cc,v 1.2 2000/03/22 04:26:41 steve Exp $" #endif # include "vvm_func.h" @@ -28,7 +28,7 @@ vvm_bitset_t<1> vvm_unop_and(const vvm_bits_t&r) res[0] = r.get_bit(0); for (unsigned idx = 1 ; idx < r.get_width() ; idx += 1) - res[0] = res[0] & r.get_bit(idx); + res[0] = B_AND(res[0], r.get_bit(idx)); return res; } @@ -36,39 +36,39 @@ vvm_bitset_t<1> vvm_unop_and(const vvm_bits_t&r) vvm_bitset_t<1> vvm_unop_nand(const vvm_bits_t&r) { vvm_bitset_t<1>res = vvm_unop_and(r); - res[0] = v_not(res[0]); + res[0] = B_NOT(res[0]); return res; } vvm_bitset_t<1> vvm_unop_or(const vvm_bits_t&r) { vvm_bitset_t<1> res; - res[0] = V1; + res[0] = St1; for (unsigned idx = 0 ; idx < r.get_width() ; idx += 1) { - if (r.get_bit(idx) == V1) + if (B_IS1(r.get_bit(idx))) return res; } - res[0] = V0; + res[0] = St0; return res; } vvm_bitset_t<1> vvm_unop_nor(const vvm_bits_t&r) { vvm_bitset_t<1>res = vvm_unop_or(r); - res[0] = v_not(res[0]); + res[0] = B_NOT(res[0]); return res; } vvm_bitset_t<1> vvm_unop_xor(const vvm_bits_t&r) { vvm_bitset_t<1> res; - res[0] = V0; + res[0] = St0; for (unsigned idx = 0 ; idx < r.get_width() ; idx += 1) { - if (r.get_bit(idx) == V1) - res[0] = v_not(res[0]); + if (B_IS1(r.get_bit(idx))) + res[0] = B_NOT(res[0]); } return res; @@ -77,73 +77,77 @@ vvm_bitset_t<1> vvm_unop_xor(const vvm_bits_t&r) vvm_bitset_t<1> vvm_unop_xnor(const vvm_bits_t&r) { vvm_bitset_t<1>res = vvm_unop_xor(r); - res[0] = v_not(res[0]); + res[0] = B_NOT(res[0]); return res; } vvm_bitset_t<1> vvm_binop_eq(const vvm_bits_t&l, const vvm_bits_t&r) { vvm_bitset_t<1> result; - result[0] = V1; + result[0] = St1; const unsigned lwid = l.get_width(); const unsigned rwid = r.get_width(); if (lwid <= rwid) { for (unsigned idx = 0 ; idx < lwid ; idx += 1) { - if ((l.get_bit(idx) == Vx) || (l.get_bit(idx) == Vz)) { - result[0] = Vx; + if (B_ISXZ(l.get_bit(idx))) { + result[0] = StX; return result; } - if ((r.get_bit(idx) == Vx) || (r.get_bit(idx) == Vz)) { - result[0] = Vx; + if (B_ISXZ(r.get_bit(idx))) { + result[0] = StX; return result; } - if (l.get_bit(idx) != r.get_bit(idx)) { - result[0] = V0; + if (! B_EQ(l.get_bit(idx), r.get_bit(idx))) { + result[0] = St0; return result; } } - for (unsigned idx = lwid ; idx < rwid ; idx += 1) - switch (r.get_bit(idx)) { - case V0: - break; - case V1: - result[0] = V0; - return result; - case Vx: - case Vz: - result[0] = Vx; + + for (unsigned idx = lwid ; idx < rwid ; idx += 1) { + + if (B_IS0(r.get_bit(idx))) + continue; + + if (B_IS1(r.get_bit(idx))) { + result[0] = St0; return result; } + + result[0] = StX; + return result; + } return result; + } else { for (unsigned idx = 0 ; idx < rwid ; idx += 1) { - if ((l.get_bit(idx) == Vx) || (l.get_bit(idx) == Vz)) { - result[0] = Vx; + if (B_ISXZ(l.get_bit(idx))) { + result[0] = StX; return result; } - if ((r.get_bit(idx) == Vx) || (r.get_bit(idx) == Vz)) { - result[0] = Vx; + if (B_ISXZ(r.get_bit(idx))) { + result[0] = StX; return result; } - if (l.get_bit(idx) != r.get_bit(idx)) { - result[0] = V0; + if (! B_EQ(l.get_bit(idx), r.get_bit(idx))) { + result[0] = St0; return result; } } - for (unsigned idx = rwid ; idx < lwid ; idx += 1) - switch (l.get_bit(idx)) { - case V0: - break; - case V1: - result[0] = V0; - return result; - case Vx: - case Vz: - result[0] = Vx; + for (unsigned idx = rwid ; idx < lwid ; idx += 1) { + + if (B_IS0(l.get_bit(idx))) + continue; + + if (B_IS1(l.get_bit(idx))) { + result[0] = St0; return result; } + + result[0] = StX; + return result; + } return result; } @@ -152,40 +156,40 @@ vvm_bitset_t<1> vvm_binop_eq(const vvm_bits_t&l, const vvm_bits_t&r) vvm_bitset_t<1> vvm_binop_ne(const vvm_bits_t&l, const vvm_bits_t&r) { vvm_bitset_t<1> result = vvm_binop_eq(l,r); - result[0] = v_not(result[0]); + result[0] = B_NOT(result[0]); return result; } vvm_bitset_t<1> vvm_binop_eeq(const vvm_bits_t&l, const vvm_bits_t&r) { vvm_bitset_t<1> result; - result[0] = V1; + result[0] = St1; const unsigned lwid = l.get_width(); const unsigned rwid = r.get_width(); if (lwid <= rwid) { - for (unsigned idx = 0 ; idx < lwid ; idx += 1) { - if (l.get_bit(idx) != r.get_bit(idx)) { - result[0] = V0; + for (unsigned idx = 0 ; idx < lwid ; idx += 1) + if (! B_EQ(l.get_bit(idx), r.get_bit(idx))) { + result[0] = St0; return result; } - } + for (unsigned idx = lwid ; idx < rwid ; idx += 1) - if (r.get_bit(idx) != V0) { - result[0] = V0; + if (! B_IS0(r.get_bit(idx))) { + result[0] = St0; return result; } } else { - for (unsigned idx = 0 ; idx < rwid ; idx += 1) { - if (l.get_bit(idx) != r.get_bit(idx)) { - result[0] = V0; + for (unsigned idx = 0 ; idx < rwid ; idx += 1) + if (! B_EQ(l.get_bit(idx), r.get_bit(idx))) { + result[0] = St0; return result; } - } + for (unsigned idx = rwid ; idx < lwid ; idx += 1) - if (l.get_bit(idx) != V0) { - result[0] = V0; + if (! B_IS0(l.get_bit(idx))) { + result[0] = St0; return result; } @@ -197,53 +201,53 @@ vvm_bitset_t<1> vvm_binop_eeq(const vvm_bits_t&l, const vvm_bits_t&r) vvm_bitset_t<1> vvm_binop_nee(const vvm_bits_t&l, const vvm_bits_t&r) { vvm_bitset_t<1> result = vvm_binop_eeq(l,r); - result[0] = v_not(result[0]); + result[0] = B_NOT(result[0]); return result; } vvm_bitset_t<1> vvm_binop_xeq(const vvm_bits_t&l, const vvm_bits_t&r) { vvm_bitset_t<1> result; - result[0] = V1; + result[0] = St1; const unsigned lwid = l.get_width(); const unsigned rwid = r.get_width(); if (lwid <= rwid) { for (unsigned idx = 0 ; idx < lwid ; idx += 1) { - if ((l.get_bit(idx) == Vz) || (r.get_bit(idx) == Vz)) + if (B_ISXZ(l.get_bit(idx))) continue; - if ((l.get_bit(idx) == Vx) || (r.get_bit(idx) == Vx)) + if (B_ISXZ(r.get_bit(idx))) continue; - if (l.get_bit(idx) != r.get_bit(idx)) { - result[0] = V0; + if (! B_EQ(l.get_bit(idx), r.get_bit(idx))) { + result[0] = St0; return result; } } for (unsigned idx = lwid ; idx < rwid ; idx += 1) { - if ((r.get_bit(idx) == Vx) || (r.get_bit(idx) == Vz)) + if (B_ISXZ(r.get_bit(idx))) continue; - if (r.get_bit(idx) != V0) { - result[0] = V0; + if (! B_IS0(r.get_bit(idx))) { + result[0] = St0; return result; } } } else { for (unsigned idx = 0 ; idx < rwid ; idx += 1) { - if ((l.get_bit(idx) == Vz) || (r.get_bit(idx) == Vz)) + if (B_ISXZ(l.get_bit(idx))) continue; - if ((l.get_bit(idx) == Vx) || (r.get_bit(idx) == Vx)) + if (B_ISXZ(r.get_bit(idx))) continue; - if (l.get_bit(idx) != r.get_bit(idx)) { - result[0] = V0; + if (! B_EQ(l.get_bit(idx), r.get_bit(idx))) { + result[0] = St0; return result; } } for (unsigned idx = rwid ; idx < lwid ; idx += 1) { - if ((l.get_bit(idx) == Vx) || (l.get_bit(idx) == Vz)) + if (B_ISXZ(l.get_bit(idx))) continue; - if (l.get_bit(idx) != V0) { - result[0] = V0; + if (! B_IS0(l.get_bit(idx))) { + result[0] = St0; return result; } } @@ -255,42 +259,42 @@ vvm_bitset_t<1> vvm_binop_xeq(const vvm_bits_t&l, const vvm_bits_t&r) vvm_bitset_t<1> vvm_binop_zeq(const vvm_bits_t&l, const vvm_bits_t&r) { vvm_bitset_t<1> result; - result[0] = V1; + result[0] = St1; const unsigned lwid = l.get_width(); const unsigned rwid = r.get_width(); if (lwid <= rwid) { for (unsigned idx = 0 ; idx < lwid ; idx += 1) { - if ((l.get_bit(idx) == Vz) || (r.get_bit(idx) == Vz)) + if (B_ISZ(l.get_bit(idx)) || B_ISZ(r.get_bit(idx))) continue; - if (l.get_bit(idx) != r.get_bit(idx)) { - result[0] = V0; + if (! B_EQ(l.get_bit(idx), r.get_bit(idx))) { + result[0] = St0; return result; } } for (unsigned idx = lwid ; idx < rwid ; idx += 1) { - if (r.get_bit(idx) == Vz) + if (B_ISZ(r.get_bit(idx))) continue; - if (r.get_bit(idx) != V0) { - result[0] = V0; + if (! B_IS0(r.get_bit(idx))) { + result[0] = St0; return result; } } } else { for (unsigned idx = 0 ; idx < rwid ; idx += 1) { - if ((l.get_bit(idx) == Vz) || (r.get_bit(idx) == Vz)) + if (B_ISZ(l.get_bit(idx)) || B_ISZ(r.get_bit(idx))) continue; - if (l.get_bit(idx) != r.get_bit(idx)) { - result[0] = V0; + if (! B_EQ(l.get_bit(idx), r.get_bit(idx))) { + result[0] = St0; return result; } } for (unsigned idx = rwid ; idx < lwid ; idx += 1) { - if (l.get_bit(idx) == Vz) + if (B_ISZ(l.get_bit(idx))) continue; - if (l.get_bit(idx) != V0) { - result[0] = V0; + if (! B_IS0(l.get_bit(idx))) { + result[0] = St0; return result; } } @@ -302,7 +306,7 @@ vvm_bitset_t<1> vvm_binop_zeq(const vvm_bits_t&l, const vvm_bits_t&r) vvm_bitset_t<1> vvm_binop_lt(const vvm_bits_t&l, const vvm_bits_t&r) { vvm_bitset_t<1> result; - result[0] = V0; + result[0] = St0; const unsigned lwid = l.get_width(); const unsigned rwid = r.get_width(); @@ -316,11 +320,11 @@ vvm_bitset_t<1> vvm_binop_lt(const vvm_bits_t&l, const vvm_bits_t&r) if (lwid > rwid) { for (unsigned idx = rwid ; idx < lwid ; idx += 1) result[0] = less_with_cascade(l.get_bit(idx), - V0, + St0, result[0]); } else { for (unsigned idx = lwid ; idx < rwid ; idx += 1) - result[0] = less_with_cascade(V0, + result[0] = less_with_cascade(St0, r.get_bit(idx), result[0]); } @@ -331,7 +335,7 @@ vvm_bitset_t<1> vvm_binop_lt(const vvm_bits_t&l, const vvm_bits_t&r) vvm_bitset_t<1> vvm_binop_le(const vvm_bits_t&l, const vvm_bits_t&r) { vvm_bitset_t<1> result; - result[0] = V1; + result[0] = St1; const unsigned lwid = l.get_width(); const unsigned rwid = r.get_width(); const unsigned common = (lwid < rwid)? lwid : rwid; @@ -344,11 +348,11 @@ vvm_bitset_t<1> vvm_binop_le(const vvm_bits_t&l, const vvm_bits_t&r) if (lwid > rwid) { for (unsigned idx = rwid ; idx < lwid ; idx += 1) result[0] = less_with_cascade(l.get_bit(idx), - V0, + St0, result[0]); } else { for (unsigned idx = lwid ; idx < rwid ; idx += 1) - result[0] = less_with_cascade(V0, + result[0] = less_with_cascade(St0, r.get_bit(idx), result[0]); } @@ -359,7 +363,7 @@ vvm_bitset_t<1> vvm_binop_le(const vvm_bits_t&l, const vvm_bits_t&r) vvm_bitset_t<1> vvm_binop_gt(const vvm_bits_t&l, const vvm_bits_t&r) { vvm_bitset_t<1> result; - result[0] = V0; + result[0] = St0; const unsigned lwid = l.get_width(); const unsigned rwid = r.get_width(); @@ -373,11 +377,11 @@ vvm_bitset_t<1> vvm_binop_gt(const vvm_bits_t&l, const vvm_bits_t&r) if (lwid > rwid) { for (unsigned idx = rwid ; idx < lwid ; idx += 1) result[0] = greater_with_cascade(l.get_bit(idx), - V0, + St0, result[0]); } else { for (unsigned idx = lwid ; idx < rwid ; idx += 1) - result[0] = greater_with_cascade(V0, + result[0] = greater_with_cascade(St0, r.get_bit(idx), result[0]); } @@ -388,7 +392,7 @@ vvm_bitset_t<1> vvm_binop_gt(const vvm_bits_t&l, const vvm_bits_t&r) vvm_bitset_t<1> vvm_binop_ge(const vvm_bits_t&l, const vvm_bits_t&r) { vvm_bitset_t<1> result; - result[0] = V1; + result[0] = St1; const unsigned lwid = l.get_width(); const unsigned rwid = r.get_width(); @@ -402,11 +406,11 @@ vvm_bitset_t<1> vvm_binop_ge(const vvm_bits_t&l, const vvm_bits_t&r) if (lwid > rwid) { for (unsigned idx = rwid ; idx < lwid ; idx += 1) result[0] = greater_with_cascade(l.get_bit(idx), - V0, + St0, result[0]); } else { for (unsigned idx = lwid ; idx < rwid ; idx += 1) - result[0] = greater_with_cascade(V0, + result[0] = greater_with_cascade(St0, r.get_bit(idx), result[0]); } @@ -418,7 +422,7 @@ vvm_bitset_t<1> vvm_binop_land(const vvm_bits_t&l, const vvm_bits_t&r) { vvm_bitset_t<1> res1 = vvm_unop_or(l); vvm_bitset_t<1> res2 = vvm_unop_or(r); - res1[0] = res1[0] & res2[0]; + res1[0] = B_AND(res1[0], res2[0]); return res1; } @@ -426,7 +430,7 @@ vvm_bitset_t<1> vvm_binop_lor(const vvm_bits_t&l, const vvm_bits_t&r) { vvm_bitset_t<1> res1 = vvm_unop_or(l); vvm_bitset_t<1> res2 = vvm_unop_or(r); - res1[0] = res1[0] | res2[0]; + res1[0] = B_OR(res1[0], res2[0]); return res1; } @@ -439,6 +443,11 @@ vvm_bitset_t<1> vvm_unop_lnot(const vvm_bits_t&r) /* * $Log: vvm_func.cc,v $ + * Revision 1.2 2000/03/22 04:26:41 steve + * Replace the vpip_bit_t with a typedef and + * define values for all the different bit + * values, including strengths. + * * Revision 1.1 2000/03/13 00:02:34 steve * Remove unneeded templates. * diff --git a/vvm/vvm_func.h b/vvm/vvm_func.h index 18558b082..11afab0d1 100644 --- a/vvm/vvm_func.h +++ b/vvm/vvm_func.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvm_func.h,v 1.22 2000/03/16 19:03:04 steve Exp $" +#ident "$Id: vvm_func.h,v 1.23 2000/03/22 04:26:41 steve Exp $" #endif # include "vvm.h" @@ -33,16 +33,9 @@ template vvm_bitset_t vvm_unop_not(const vvm_bitset_t&p) { vvm_bitset_t result; - for (unsigned idx = 0 ; idx < WIDTH ; idx += 1) switch (p[idx]) { - case V0: - result[idx] = V1; - break; - case V1: - result[idx] = V0; - break; - default: - result[idx] = Vx; - } + for (unsigned idx = 0 ; idx < WIDTH ; idx += 1) + result[idx] = B_NOT(p[idx]); + return result; } @@ -73,9 +66,9 @@ vvm_bitset_t vvm_unop_uminus(const vvm_bitset_t&l) { vvm_bitset_t res; res = vvm_unop_not(l); - vpip_bit_t carry = V1; + vpip_bit_t carry = St1; for (int i = 0; i < WIDTH; i++) - res[i] = add_with_carry(res[i], V0, carry); + res[i] = add_with_carry(res[i], St0, carry); return res; } @@ -90,7 +83,7 @@ vvm_bitset_t vvm_binop_and(const vvm_bitset_t&l, { vvm_bitset_t result; for (unsigned idx = 0 ; idx < WIDTH ; idx += 1) - result[idx] = l[idx] & r[idx]; + result[idx] = B_AND(l[idx], r[idx]); return result; } @@ -105,7 +98,7 @@ vvm_bitset_t vvm_binop_or(const vvm_bitset_t&l, { vvm_bitset_t result; for (unsigned idx = 0 ; idx < WIDTH ; idx += 1) - result[idx] = l[idx] | r[idx]; + result[idx] = B_OR(l[idx], r[idx]); return result; } @@ -116,7 +109,7 @@ vvm_bitset_t vvm_binop_nor(const vvm_bitset_t&l, { vvm_bitset_t result; for (unsigned idx = 0 ; idx < WIDTH ; idx += 1) - result[idx] = v_not(l[idx] | r[idx]); + result[idx] = B_NOT(B_OR(l[idx], r[idx])); return result; } @@ -131,7 +124,7 @@ vvm_bitset_t vvm_binop_plus(const vvm_bitset_t&l, const vvm_bitset_t&r) { vvm_bitset_t result; - vpip_bit_t carry = V0; + vpip_bit_t carry = St0; for (unsigned idx = 0 ; idx < WIDTH ; idx += 1) result[idx] = add_with_carry(l[idx], r[idx], carry); @@ -149,7 +142,7 @@ vvm_bitset_t vvm_binop_minus(const vvm_bitset_t&l, { vvm_bitset_t res; res = vvm_unop_not(r); - vpip_bit_t carry = V1; + vpip_bit_t carry = St1; for (unsigned idx = 0 ; idx < WIDTH ; idx += 1) res[idx] = add_with_carry(l[idx], res[idx], carry); @@ -184,7 +177,7 @@ vvm_bitset_t vvm_binop_xor(const vvm_bitset_t&l, { vvm_bitset_t result; for (unsigned idx = 0 ; idx < WIDTH ; idx += 1) - result[idx] = l[idx] ^ r[idx]; + result[idx] = B_XOR(l[idx], r[idx]); return result; } @@ -195,7 +188,7 @@ vvm_bitset_t vvm_binop_xnor(const vvm_bitset_t&l, { vvm_bitset_t result; for (unsigned idx = 0 ; idx < WIDTH ; idx += 1) - result[idx] = v_not(l[idx] ^ r[idx]); + result[idx] = B_NOT(B_XOR(l[idx], r[idx])); return result; } @@ -212,7 +205,7 @@ vvm_bitset_t vvm_binop_shiftl(const vvm_bitset_t&l, vvm_bitset_t result; vvm_u32 s = r.as_unsigned(); for (unsigned idx = 0; idx < WIDTH; idx++) - result[idx] = (idx < s) ? V0 : l[idx-s]; + result[idx] = (idx < s) ? St0 : l[idx-s]; return result; } @@ -229,7 +222,7 @@ vvm_bitset_t vvm_binop_shiftr(const vvm_bitset_t&l, vvm_bitset_t result; vvm_u32 s = r.as_unsigned(); for (unsigned idx = 0; idx < WIDTH; idx++) - result[idx] = (idx < (WIDTH-s)) ? l[idx+s] : V0; + result[idx] = (idx < (WIDTH-s)) ? l[idx+s] : St0; return result; } @@ -286,18 +279,28 @@ template vvm_bitset_t vvm_ternary(vpip_bit_t c, const vvm_bitset_t&t, const vvm_bitset_t&f) { - switch (c) { - case V0: + if (B_IS0(c)) return f; - case V1: + if (B_IS1(c)) return t; - default: - return f; + + vvm_bitset_t res; + for (unsigned idx = 0 ; idx < W ; idx += 1) { + if (B_EQ(t[idx], f[idx])) + res[idx] = t[idx]; + else + res[idx] = StX; } + return res; } /* * $Log: vvm_func.h,v $ + * Revision 1.23 2000/03/22 04:26:41 steve + * Replace the vpip_bit_t with a typedef and + * define values for all the different bit + * values, including strengths. + * * Revision 1.22 2000/03/16 19:03:04 steve * Revise the VVM backend to use nexus objects so that * drivers and resolution functions can be used, and diff --git a/vvm/vvm_gates.cc b/vvm/vvm_gates.cc index 1538d610b..0b389ffc6 100644 --- a/vvm/vvm_gates.cc +++ b/vvm/vvm_gates.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvm_gates.cc,v 1.11 2000/03/18 02:26:02 steve Exp $" +#ident "$Id: vvm_gates.cc,v 1.12 2000/03/22 04:26:41 steve Exp $" #endif # include "vvm_gates.h" @@ -56,7 +56,7 @@ vpip_bit_t compute_and(const vpip_bit_t*inp, unsigned count) { vpip_bit_t outval = inp[0]; for (unsigned i = 1 ; i < count ; i += 1) - outval = outval & inp[i]; + outval = B_AND(outval, inp[i]); return outval; } @@ -64,7 +64,7 @@ vpip_bit_t compute_or(const vpip_bit_t*inp, unsigned count) { vpip_bit_t outval = inp[0]; for (unsigned i = 1 ; i < count ; i += 1) - outval = outval | inp[i]; + outval = B_OR(outval, inp[i]); return outval; } @@ -72,26 +72,26 @@ vpip_bit_t compute_nor(const vpip_bit_t*inp, unsigned count) { vpip_bit_t outval = inp[0]; for (unsigned i = 1 ; i < count ; i += 1) - outval = outval | inp[i]; - return v_not(outval); + outval = B_OR(outval, inp[i]); + return B_NOT(outval); } vpip_bit_t compute_xor(const vpip_bit_t*inp, unsigned count) { vpip_bit_t outval = inp[0]; for (unsigned i = 1; i < count; i++) - outval = outval ^ inp[i]; + outval = B_XOR(outval, inp[i]); return outval; } vpip_bit_t compute_nand(const vpip_bit_t*inp, unsigned count) { - return v_not(compute_and(inp,count)); + return B_NOT(compute_and(inp,count)); } vpip_bit_t compute_xnor(const vpip_bit_t*inp, unsigned count) { - return v_not(compute_xor(inp,count)); + return B_NOT(compute_xor(inp,count)); } vvm_and2::vvm_and2(unsigned long d) @@ -111,7 +111,7 @@ void vvm_and2::init_I(unsigned idx, vpip_bit_t val) void vvm_and2::start() { - output(input_[0] & input_[1]); + output(B_AND(input_[0], input_[1])); } void vvm_and2::take_value(unsigned key, vpip_bit_t val) @@ -120,7 +120,7 @@ void vvm_and2::take_value(unsigned key, vpip_bit_t val) return; input_[key] = val; - output(input_[0] & input_[1]); + output(B_AND(input_[0], input_[1])); } @@ -140,15 +140,20 @@ void vvm_buf::init_I(unsigned, vpip_bit_t) void vvm_buf::take_value(unsigned, vpip_bit_t val) { vpip_bit_t outval = val; - if (val == Vz) outval = Vx; + if (B_ISXZ(val)) + outval = StX; + else if (B_IS1(val)) + outval = St1; + else + outval = St0; output(outval); } vvm_bufif1::vvm_bufif1(unsigned long d) : vvm_1bit_out(d) { - input_[0] = Vx; - input_[1] = Vx; + input_[0] = StX; + input_[1] = StX; } vvm_bufif1::~vvm_bufif1() @@ -164,9 +169,14 @@ void vvm_bufif1::take_value(unsigned key, vpip_bit_t val) if (input_[key] == val) return; input_[key] = val; - if (input_[1] != V1) output(Vz); - else if (input_[0] == Vz) output(Vx); - else output(input_[0]); + if (! B_IS1(input_[1])) + output(HiZ); + else if (B_ISXZ(input_[0])) + output(StX); + else if (B_IS1(val)) + output(St1); + else + output(St0); } vvm_bufz::vvm_bufz() @@ -215,9 +225,9 @@ void vvm_eeq::take_value(unsigned key, vpip_bit_t val) vpip_bit_t vvm_eeq::compute_() const { - vpip_bit_t outval = V0; - if (input_[0] == input_[1]) - outval = V1; + vpip_bit_t outval = St0; + if (B_EQ(input_[0], input_[1])) + outval = St1; return outval; } @@ -238,7 +248,7 @@ void vvm_nor2::init_I(unsigned idx, vpip_bit_t val) void vvm_nor2::start() { - output(v_not(input_[0] | input_[1])); + output(B_NOT(B_OR(input_[0], input_[1]))); } void vvm_nor2::take_value(unsigned key, vpip_bit_t val) @@ -247,7 +257,7 @@ void vvm_nor2::take_value(unsigned key, vpip_bit_t val) return; input_[key] = val; - output(v_not(input_[0] | input_[1])); + output(B_NOT(B_OR(input_[0], input_[1]))); } vvm_not::vvm_not(unsigned long d) @@ -269,12 +279,17 @@ void vvm_not::start() void vvm_not::take_value(unsigned, vpip_bit_t val) { - output(v_not(val)); + output(B_NOT(val)); } /* * $Log: vvm_gates.cc,v $ + * Revision 1.12 2000/03/22 04:26:41 steve + * Replace the vpip_bit_t with a typedef and + * define values for all the different bit + * values, including strengths. + * * Revision 1.11 2000/03/18 02:26:02 steve * Update bufz to nexus style. * diff --git a/vvm/vvm_gates.h b/vvm/vvm_gates.h index a722a0592..6ca23384e 100644 --- a/vvm/vvm_gates.h +++ b/vvm/vvm_gates.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvm_gates.h,v 1.48 2000/03/18 23:22:37 steve Exp $" +#ident "$Id: vvm_gates.h,v 1.49 2000/03/22 04:26:41 steve Exp $" #endif # include "vvm.h" @@ -759,7 +759,7 @@ template class vvm_pevent : public vvm_nexus::recvr_t { explicit vvm_pevent(vvm_sync*tgt, EDGE e) : target_(tgt), edge_(e) { for (unsigned idx = 0 ; idx < WIDTH ; idx += 1) - value_[idx] = Vz; + value_[idx] = HiZ; } vvm_bitset_t get() const { return value_; } @@ -779,11 +779,11 @@ template class vvm_pevent : public vvm_nexus::recvr_t { target_->wakeup(); break; case POSEDGE: - if (val == V1) + if (B_IS1(val)) target_->wakeup(); break; case NEGEDGE: - if (val == V0) + if (B_IS0(val)) target_->wakeup(); break; } @@ -802,6 +802,11 @@ template class vvm_pevent : public vvm_nexus::recvr_t { /* * $Log: vvm_gates.h,v $ + * Revision 1.49 2000/03/22 04:26:41 steve + * Replace the vpip_bit_t with a typedef and + * define values for all the different bit + * values, including strengths. + * * Revision 1.48 2000/03/18 23:22:37 steve * Update the FF device to nexus style. * diff --git a/vvm/vvm_mult.cc b/vvm/vvm_mult.cc index 3735bd4c6..076c2e533 100644 --- a/vvm/vvm_mult.cc +++ b/vvm/vvm_mult.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvm_mult.cc,v 1.4 2000/03/17 03:05:13 steve Exp $" +#ident "$Id: vvm_mult.cc,v 1.5 2000/03/22 04:26:41 steve Exp $" #endif # include "vvm_gates.h" @@ -34,26 +34,22 @@ void vvm_binop_mult(vpip_bit_t*r, unsigned nr, unsigned long av = 0, bv = 0; unsigned long rv; - for (unsigned idx = 0 ; idx < na ; idx += 1) switch (a[idx]) { + for (unsigned idx = 0 ; idx < na ; idx += 1) { - case V0: - break; - case V1: - av |= 1 << idx; - break; - default: - goto unknown_result; + if (B_ISXZ(a[idx])) + goto unknown_result; + + if (B_IS1(a[idx])) + av |= 1 << idx; } - for (unsigned idx = 0 ; idx < nb ; idx += 1) switch (b[idx]) { + for (unsigned idx = 0 ; idx < nb ; idx += 1) { - case V0: - break; - case V1: - bv |= 1 << idx; - break; - default: - goto unknown_result; + if (B_ISXZ(b[idx])) + goto unknown_result; + + if (B_IS1(b[idx])) + bv |= 1 << idx; } rv = av * bv; @@ -61,9 +57,9 @@ void vvm_binop_mult(vpip_bit_t*r, unsigned nr, for (unsigned idx = 0 ; idx < nr ; idx += 1) { if (rv & 1) - r[idx] = V1; + r[idx] = St1; else - r[idx] = V0; + r[idx] = St0; rv >>= 1; } @@ -72,7 +68,7 @@ void vvm_binop_mult(vpip_bit_t*r, unsigned nr, unknown_result: for (unsigned idx= 0 ; idx < nr ; idx += 1) - r[idx] = Vx; + r[idx] = StX; } vvm_mult::vvm_mult(unsigned rwid, unsigned awid, @@ -83,7 +79,7 @@ vvm_mult::vvm_mult(unsigned rwid, unsigned awid, out_ = new vvm_nexus::drive_t[rwid_]; for (unsigned idx = 0 ; idx < rwid_+awid_+bwid_+swid_ ; idx += 1) - bits_[idx] = Vx; + bits_[idx] = StX; } vvm_mult::~vvm_mult() @@ -134,6 +130,11 @@ void vvm_mult::take_value(unsigned key, vpip_bit_t val) /* * $Log: vvm_mult.cc,v $ + * Revision 1.5 2000/03/22 04:26:41 steve + * Replace the vpip_bit_t with a typedef and + * define values for all the different bit + * values, including strengths. + * * Revision 1.4 2000/03/17 03:05:13 steve * Update vvm_mult to nexus style. * diff --git a/vvm/vvm_mux.cc b/vvm/vvm_mux.cc index e20544e61..70896b1a4 100644 --- a/vvm/vvm_mux.cc +++ b/vvm/vvm_mux.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvm_mux.cc,v 1.1 2000/03/18 01:27:00 steve Exp $" +#ident "$Id: vvm_mux.cc,v 1.2 2000/03/22 04:26:41 steve Exp $" #endif # include "vvm_gates.h" @@ -36,7 +36,7 @@ vvm_mux::vvm_mux(unsigned w, unsigned s, unsigned sw) out_ = new vvm_nexus::drive_t[width_]; for (unsigned idx = 0 ; idx < width_*size_+selwid_+width_ ; idx += 1) - bits_[idx] = Vx; + bits_[idx] = StX; } vvm_mux::~vvm_mux() @@ -107,23 +107,21 @@ void compute_mux(vpip_bit_t*out, unsigned wid, const vpip_bit_t*dat, unsigned size) { unsigned tmp = 0; - for (unsigned idx = 0 ; idx < swid ; idx += 1) - switch (sel[idx]) { - case V0: - break; - case V1: - tmp |= (1<= size) { if (swid > 1) { for (unsigned idx = 0; idx < wid ; idx += 1) - out[idx] = Vx; + out[idx] = StX; } else { const unsigned b0 = 0; const unsigned b1 = wid; @@ -131,7 +129,7 @@ void compute_mux(vpip_bit_t*out, unsigned wid, if (dat[idx+b0] == dat[idx+b1]) out[idx] = dat[idx+b0]; else - out[idx] = Vx; + out[idx] = StX; } } @@ -144,6 +142,11 @@ void compute_mux(vpip_bit_t*out, unsigned wid, /* * $Log: vvm_mux.cc,v $ + * Revision 1.2 2000/03/22 04:26:41 steve + * Replace the vpip_bit_t with a typedef and + * define values for all the different bit + * values, including strengths. + * * Revision 1.1 2000/03/18 01:27:00 steve * Generate references into a table of nexus objects instead of * generating lots of isolated nexus objects. Easier on linkers diff --git a/vvm/vvm_nexus.cc b/vvm/vvm_nexus.cc index 0a7bc0994..d52dadc36 100644 --- a/vvm/vvm_nexus.cc +++ b/vvm/vvm_nexus.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvm_nexus.cc,v 1.3 2000/03/18 01:27:00 steve Exp $" +#ident "$Id: vvm_nexus.cc,v 1.4 2000/03/22 04:26:41 steve Exp $" #endif # include "vvm_nexus.h" @@ -29,7 +29,7 @@ vvm_nexus::vvm_nexus() recvrs_ = 0; ival_ = 0; nival_ = 0; - value_ = Vz; + value_ = HiZ; } vvm_nexus::~vvm_nexus() @@ -167,7 +167,7 @@ void vvm_nexus::run_values() vvm_nexus::drive_t::drive_t() { - value_ = Vx; + value_ = StX; nexus_ = 0; } @@ -208,7 +208,7 @@ vvm_nexus_wire::~vvm_nexus_wire() vpip_bit_t vvm_nexus_wire::resolution_function(const vpip_bit_t*bits, unsigned nbits) const { - if (nbits == 0) return Vz; + if (nbits == 0) return HiZ; return bits[0]; } @@ -233,6 +233,11 @@ void vvm_delayed_assign(vvm_nexus&l_val, vpip_bit_t r_val, /* * $Log: vvm_nexus.cc,v $ + * Revision 1.4 2000/03/22 04:26:41 steve + * Replace the vpip_bit_t with a typedef and + * define values for all the different bit + * values, including strengths. + * * Revision 1.3 2000/03/18 01:27:00 steve * Generate references into a table of nexus objects instead of * generating lots of isolated nexus objects. Easier on linkers diff --git a/vvm/vvm_signal.h b/vvm/vvm_signal.h index f6bb82c28..2564a9a7c 100644 --- a/vvm/vvm_signal.h +++ b/vvm/vvm_signal.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvm_signal.h,v 1.2 2000/03/17 20:21:14 steve Exp $" +#ident "$Id: vvm_signal.h,v 1.3 2000/03/22 04:26:41 steve Exp $" #endif # include "vvm.h" @@ -36,7 +36,7 @@ template class vvm_bitset_t : public vvm_bits_t { public: vvm_bitset_t() { for (unsigned idx = 0 ; idx < WIDTH ; idx += 1) - bits[idx] = Vz; + bits[idx] = HiZ; } vvm_bitset_t(const vvm_bits_t&that) @@ -46,7 +46,7 @@ template class vvm_bitset_t : public vvm_bits_t { for (unsigned idx = 0 ; idx < wid ; idx += 1) bits[idx] = that.get_bit(idx); for (unsigned idx = wid ; idx < WIDTH ; idx += 1) - bits[idx] = V0; + bits[idx] = St0; } @@ -155,6 +155,11 @@ class vvm_memory_t : public __vpiMemory { /* * $Log: vvm_signal.h,v $ + * Revision 1.3 2000/03/22 04:26:41 steve + * Replace the vpip_bit_t with a typedef and + * define values for all the different bit + * values, including strengths. + * * Revision 1.2 2000/03/17 20:21:14 steve * Detemplatize the vvm_signal_t class. *