From 573e07225d7aea711193fd030b4ae3a691a0aed4 Mon Sep 17 00:00:00 2001 From: steve Date: Sun, 3 Apr 2005 05:45:51 +0000 Subject: [PATCH] Rework the vvp_delay_t class. --- vvp/compile.h | 9 +- vvp/delay.cc | 276 +++++++++++-------------------------------------- vvp/delay.h | 127 +++++------------------ vvp/functor.cc | 8 +- vvp/logic.cc | 7 +- vvp/parse.y | 13 ++- vvp/pointers.h | 11 +- vvp/udp.cc | 25 +++-- vvp/udp.h | 10 +- vvp/vvp_net.cc | 19 ++-- vvp/vvp_net.h | 14 +-- 11 files changed, 159 insertions(+), 360 deletions(-) diff --git a/vvp/compile.h b/vvp/compile.h index 19de6176f..aa3507386 100644 --- a/vvp/compile.h +++ b/vvp/compile.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: compile.h,v 1.67 2005/04/01 06:02:45 steve Exp $" +#ident "$Id: compile.h,v 1.68 2005/04/03 05:45:51 steve Exp $" #endif # include @@ -86,7 +86,7 @@ extern void compile_vpi_time_precision(long pre); * to existing functors to manage the linking. */ extern void compile_functor(char*label, char*type, - vvp_delay_t delay, unsigned ostr0, + vvp_delay_t*delay, unsigned ostr0, unsigned ostr1, unsigned argc, struct symb_s*argv); @@ -202,7 +202,7 @@ extern void compile_udp_def(int sequ, char*label, char *name, unsigned nin, unsigned init, char **table); extern void compile_udp_functor(char*label, char*type, - vvp_delay_t delay, + vvp_delay_t*delay, unsigned argc, struct symb_s*argv); extern char **compile_udp_table(char **table, char *row); @@ -310,6 +310,9 @@ extern void compile_net(char*label, char*name, /* * $Log: compile.h,v $ + * Revision 1.68 2005/04/03 05:45:51 steve + * Rework the vvp_delay_t class. + * * Revision 1.67 2005/04/01 06:02:45 steve * Reimplement combinational UDPs. * diff --git a/vvp/delay.cc b/vvp/delay.cc index ef7996268..6a10f5e6d 100644 --- a/vvp/delay.cc +++ b/vvp/delay.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001 Stephan Boettcher + * Copyright (c) 2005 Stephen Williams * * 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,243 +17,83 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: delay.cc,v 1.3 2004/10/04 01:10:59 steve Exp $" +#ident "$Id: delay.cc,v 1.4 2005/04/03 05:45:51 steve Exp $" #endif #include "delay.h" #include +#include #include -inline static unsigned dmin(unsigned d1, unsigned d2) +vvp_delay_t::vvp_delay_t(vvp_time64_t rise, vvp_time64_t fall) { - return (d1 < d2) ? d1 : d2; + rise_ = rise; + fall_ = fall; + decay_= fall < rise? fall : rise; + min_delay_ = decay_; } -inline static unsigned dmax(unsigned d1, unsigned d2) +vvp_delay_t::vvp_delay_t(vvp_time64_t rise, vvp_time64_t fall, vvp_time64_t decay) { - return (d1 > d2) ? d1 : d2; + rise_ = rise; + fall_ = fall; + decay_= decay; + + min_delay_ = rise_; + if (fall_ < min_delay_) + min_delay_ = fall_; + if (decay_ < min_delay_) + min_delay_ = decay_; } -typedef const unsigned char tab_t; -// 01 0x 0z 10 1x 1z x0 x1 xz z0 z1 zx -static tab_t tab_1 [16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -static tab_t tab_4 [16] = { 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 3, 2, 1, 0, 3, 2}; -static tab_t tab_6 [16] = { 1, 0, 3, 2, 1, 0, 4, 2, 1, 0, 5, 2, 1, 0, 5, 2}; -static tab_t tab_12[16] = { 1, 0, 6, 2, 1, 0, 8, 4, 9, 7,11,10, 5, 3,11,10}; - -inline unsigned vvp_delay_size(vvp_delay_t del) +vvp_delay_t::~vvp_delay_t() { - return del ? del->size() : 0; } -inline vvp_delay_s::vvp_delay_s(const unsigned char *t) +vvp_time64_t vvp_delay_t::get_delay(vvp_bit4_t from, vvp_bit4_t to) { - memcpy((void*)tab, (void*)t, sizeof(tab)); -} - -vvp_delay_s::vvp_delay_s(unsigned d) -{ - memcpy((void*)tab, (void*)tab_1, sizeof(tab)); - del[0] = d; -} -vvp_delay_2_s::vvp_delay_2_s(unsigned r, unsigned f) - : vvp_delay_s(tab_4) -{ - del[0] = r; - del[1] = f; - del[2] = dmax(r, f); - del[3] = dmin(r, f); -} - -vvp_delay_3_s::vvp_delay_3_s(unsigned r, unsigned f, unsigned z) - : vvp_delay_s(tab_6) -{ - del[0] = r; - del[1] = f; - del[2] = z; - del[3] = dmin(r, z); - del[4] = dmin(f, z); - del[5] = dmin(r, f); -} - -vvp_delay_6_s::vvp_delay_6_s(unsigned r, unsigned f, unsigned rz, - unsigned zr, unsigned fz, unsigned zf) - : vvp_delay_12_s(r, f, rz, zr, fz, zf, - dmin(r, rz), - dmax(r, zr), - dmin(f, fz), - dmax(f, zf), - dmax(rz, fz), - dmin(zr, zf)) -{} - -vvp_delay_12_s::vvp_delay_12_s(unsigned r, unsigned f, unsigned rz, - unsigned zr, unsigned fz, unsigned zf, - unsigned rx, unsigned xr, unsigned fx, - unsigned xf, unsigned xz, unsigned zx) - : vvp_delay_s(tab_12) -{ - del[0] = r; - del[1] = f; - del[2] = rz; - del[3] = zr; - del[4] = fz; - del[5] = zf; - del[6] = rx; - del[7] = xr; - del[8] = fx; - del[9] = xf; - del[10] = xz; - del[11] = zx; -} - -vvp_delay_t vvp_delay_new(unsigned n, unsigned *dels) -{ - switch (n) { - default: - assert(0); - case 0: - return 0; - case 1: - return new vvp_delay_s(dels[0]); - case 2: - return new vvp_delay_2_s(dels[0], dels[1]); - case 3: - return new vvp_delay_3_s(dels[0], dels[1], dels[2]); - case 6: - return new vvp_delay_6_s(dels[0], dels[1], dels[2], - dels[3], dels[4], dels[5]); - case 12: - return new vvp_delay_12_s(dels[0], dels[1], dels[2], - dels[3], dels[4], dels[5], - dels[6], dels[7], dels[8], - dels[9], dels[10], dels[11]); - } -} - -void vvp_delay_delete(vvp_delay_t del) -{ - switch (vvp_delay_size(del)) { - case 1: delete del; break; - case 4: delete static_cast(del); break; - case 6: delete static_cast(del); break; - case 12: delete static_cast(del); break; - } -} - -vvp_delay_t vvp_delay_add(vvp_delay_t d1, vvp_delay_t d2) -{ - unsigned s1 = vvp_delay_size(d1); - unsigned s2 = vvp_delay_size(d2); - vvp_delay_t out = s1 > s2 ? d1 : d2; - if (s1==0 || s2==0) - return out; - - vvp_delay_t oth = s1 > s2 ? d2 : d1; - unsigned s = s1 > s2 ? s1 : s2; - unsigned so = s1 > s2 ? s2 : s1; - - if (s==so) - for (unsigned i=0; idel[i] = oth->del[i]; - else switch (so) { - case 1: - for (unsigned i=0; idel[i] = oth->del[0]; - break; - - case 4: - switch (s) { - case 6: - out->del[0] = oth->del[0]; - out->del[1] = oth->del[1]; - out->del[2] = oth->del[4]; - out->del[3] = oth->del[4]; - out->del[4] = oth->del[4]; - out->del[5] = oth->del[4]; - break; - case 12: - out->del[ 0] = oth->del[0]; - out->del[ 1] = oth->del[1]; - out->del[ 2] = oth->del[0]; - out->del[ 3] = oth->del[0]; - out->del[ 4] = oth->del[1]; - out->del[ 5] = oth->del[1]; - out->del[ 6] = oth->del[0]; - out->del[ 7] = oth->del[0]; - out->del[ 8] = oth->del[1]; - out->del[ 9] = oth->del[1]; - out->del[10] = oth->del[2]; - out->del[11] = oth->del[3]; - break; + switch (from) { + case BIT4_0: + switch (to) { + case BIT4_0: return 0; + case BIT4_1: return rise_; + case BIT4_X: return min_delay_; + case BIT4_Z: return decay_; + } + break; + case BIT4_1: + switch (to) { + case BIT4_0: return fall_; + case BIT4_1: return 0; + case BIT4_X: return min_delay_; + case BIT4_Z: return decay_; + } + break; + case BIT4_X: + switch (to) { + case BIT4_0: return fall_; + case BIT4_1: return rise_; + case BIT4_X: return 0; + case BIT4_Z: return decay_; + } + break; + case BIT4_Z: + switch (to) { + case BIT4_0: return fall_; + case BIT4_1: return rise_; + case BIT4_X: return min_delay_; + case BIT4_Z: return 0; } - case 6: - out->del[ 0] = oth->del[0]; - out->del[ 1] = oth->del[1]; - out->del[ 2] = oth->del[2]; - out->del[ 3] = oth->del[0]; - out->del[ 4] = oth->del[2]; - out->del[ 5] = oth->del[1]; - out->del[ 6] = oth->del[3]; - out->del[ 7] = oth->del[0]; - out->del[ 8] = oth->del[4]; - out->del[ 9] = oth->del[1]; - out->del[10] = oth->del[2]; - out->del[11] = oth->del[5]; break; } - vvp_delay_delete(oth); - return out; -} - -vvp_delay_t vvp_delay_set(vvp_delay_t tgt, vvp_delay_t src, unsigned mask) -{ - unsigned stgt = vvp_delay_size(tgt); - unsigned ssrc = vvp_delay_size(src); - - if (stgt == 0) - return src; - if (ssrc == 0) - return tgt; - - if (stgt == ssrc) { - for (unsigned i=0; idel[i] = src->del[i]; - - vvp_delay_delete(src); - return tgt; - } -#if 0 // later - if (mask) { - static bool done_that = false; - if (!done_that) { - vvp_printf(VVP_PRINT_WARNING, - "Warning:" - " partial replacement of delay values" - " of different size" - " not supported\n" - " either replace all edges," - " or specify the same number of values\n" ); - done_that = true; - } - } -#endif - - vvp_delay_delete(tgt); - return src; + assert(0); + return 0; } /* -** $Log: delay.cc,v $ -** Revision 1.3 2004/10/04 01:10:59 steve -** Clean up spurious trailing white space. -** -** Revision 1.2 2002/08/12 01:35:08 steve -** conditional ident string using autoconfig. -** -** Revision 1.1 2001/11/10 18:07:11 steve -** Runtime support for functor delays. (Stephan Boettcher) -** -*/ + * $Log: delay.cc,v $ + * Revision 1.4 2005/04/03 05:45:51 steve + * Rework the vvp_delay_t class. + * + */ diff --git a/vvp/delay.h b/vvp/delay.h index 64354d6c7..8356e0f98 100644 --- a/vvp/delay.h +++ b/vvp/delay.h @@ -1,7 +1,7 @@ -#ifndef __delay_H /* -*- c++ -*- */ +#ifndef __delay_H #define __delay_H /* - * Copyright (c) 2001 Stephan Boettcher + * Copyright 2005 Stephen Williams * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -19,112 +19,37 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: delay.h,v 1.4 2004/10/04 01:10:59 steve Exp $" +#ident "$Id: delay.h,v 1.5 2005/04/03 05:45:51 steve Exp $" #endif -#include "pointers.h" +/* + */ + +# include "vvp_net.h" /* -** vvp_delay_t del; -** -** del = vvp_delay_new(n, dels); -** make a delay from n delay specs in array dels. -** n = 0, 1, 2, 3, 6, 12. -** -** unsigned vvp_delay_get(del, from, to); -** tells the delay for the edge (from->to). -** -** del = NULL; -** new delay with zero delay. -** -** del = new vvp_delay_s(delay); -** new delay with one spec for all edges. -** -** del = new vvp_delay_2_s(delay, delay); -** new delay with two specs for rise and fall delays. -** -** del = new vvp_delay_3_s(delay); -** new delay with three specs for rise, fall, and highz delays. -** -** del = new vvp_delay_6_s(delay, del...); -** new delay with six specs for all 01z edge delays. -** -** del = new vvp_delay_12_s(delay, del...); -** new delay with twelve specs for all edge delays. -** -** void vvp_delsy_delete(del); -** delete a delay. -** -** del = vvp_delay_add(del1, del2); -** add the delay spaces. del1 and del2 are deleted. -** -** del = vvp_delay_set(tgt, src, mask); -** set then non-masked edges of delay tgt from src. -** tgt and src are deleted. -*/ + * Instances of this object are functions that calculate the delay for + * the transition from the source vvp_bit4_t value to the destination + * value. + */ +class vvp_delay_t { -struct vvp_delay_s { - vvp_delay_s(unsigned); - unsigned delay(unsigned char idx) { return del[tab[idx]]; } - unsigned size() { return tab[14]+1; } - protected: - vvp_delay_s(const unsigned char *t); - private: - unsigned char tab[16]; public: - unsigned del[1]; + vvp_delay_t(vvp_time64_t rise, vvp_time64_t fall); + vvp_delay_t(vvp_time64_t rise, vvp_time64_t fall, vvp_time64_t decay); + ~vvp_delay_t(); + + vvp_time64_t get_delay(vvp_bit4_t from, vvp_bit4_t to); + + private: + vvp_time64_t rise_, fall_, decay_; + vvp_time64_t min_delay_; }; -struct vvp_delay_2_s : public vvp_delay_s { - vvp_delay_2_s(unsigned, unsigned); - unsigned dell[4-1]; -}; - -struct vvp_delay_3_s : public vvp_delay_s { - vvp_delay_3_s(unsigned, unsigned, unsigned); - unsigned dell[6-1]; -}; - -struct vvp_delay_12_s : public vvp_delay_s { - vvp_delay_12_s(unsigned, unsigned, unsigned, - unsigned, unsigned, unsigned, - unsigned, unsigned, unsigned, - unsigned, unsigned, unsigned); - unsigned dell[12-1]; -}; - -struct vvp_delay_6_s : public vvp_delay_12_s { - vvp_delay_6_s(unsigned, unsigned, unsigned, - unsigned, unsigned, unsigned); -}; - -inline static -unsigned vvp_delay_get(vvp_delay_t del, unsigned char oval, unsigned char nval) -{ - unsigned char idx = nval | (oval << 2); - return del->delay(idx); -} - -vvp_delay_t vvp_delay_new(unsigned n, unsigned *dels); -void vvp_delay_delete(vvp_delay_t); -vvp_delay_t vvp_delay_add(vvp_delay_t, vvp_delay_t); -vvp_delay_t vvp_delay_set(vvp_delay_t tgt, vvp_delay_t src, - unsigned mask = 0); - /* -** $Log: delay.h,v $ -** Revision 1.4 2004/10/04 01:10:59 steve -** Clean up spurious trailing white space. -** -** Revision 1.3 2002/08/12 01:35:08 steve -** conditional ident string using autoconfig. -** -** Revision 1.2 2001/12/06 03:31:24 steve -** Support functor delays for gates and UDP devices. -** (Stephan Boettcher) -** -** Revision 1.1 2001/11/10 18:07:11 steve -** Runtime support for functor delays. (Stephan Boettcher) -** -*/ + * $Log: delay.h,v $ + * Revision 1.5 2005/04/03 05:45:51 steve + * Rework the vvp_delay_t class. + * + */ #endif // __delay_H diff --git a/vvp/functor.cc b/vvp/functor.cc index a61cf26ff..5ab7a5943 100644 --- a/vvp/functor.cc +++ b/vvp/functor.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: functor.cc,v 1.45 2005/03/06 17:25:03 steve Exp $" +#ident "$Id: functor.cc,v 1.46 2005/04/03 05:45:51 steve Exp $" #endif # include "functor.h" @@ -113,7 +113,7 @@ void functor_define(vvp_ipoint_t point, functor_t obj) functor_list[index1][index2] = obj; } - +#if 0 functor_s::functor_s() { delay = 0; @@ -131,6 +131,7 @@ functor_s::functor_s() cstr = StX; inhibit = 0; } +#endif functor_s::~functor_s() { @@ -224,6 +225,9 @@ edge_inputs_functor_s::~edge_inputs_functor_s() /* * $Log: functor.cc,v $ + * Revision 1.46 2005/04/03 05:45:51 steve + * Rework the vvp_delay_t class. + * * Revision 1.45 2005/03/06 17:25:03 steve * Remove dead code from scheduler. * diff --git a/vvp/logic.cc b/vvp/logic.cc index d439fbeb4..cef8eaa7a 100644 --- a/vvp/logic.cc +++ b/vvp/logic.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: logic.cc,v 1.19 2005/02/12 22:50:52 steve Exp $" +#ident "$Id: logic.cc,v 1.20 2005/04/03 05:45:51 steve Exp $" #endif # include "logic.h" @@ -225,7 +225,7 @@ void vvp_fun_muxz::recv_vec4(vvp_net_ptr_t ptr, vvp_vector4_t bit) */ void compile_functor(char*label, char*type, - vvp_delay_t delay, unsigned ostr0, unsigned ostr1, + vvp_delay_t*delay, unsigned ostr0, unsigned ostr1, unsigned argc, struct symb_s*argv) { vvp_net_fun_t* obj = 0; @@ -314,6 +314,9 @@ void compile_functor(char*label, char*type, /* * $Log: logic.cc,v $ + * Revision 1.20 2005/04/03 05:45:51 steve + * Rework the vvp_delay_t class. + * * Revision 1.19 2005/02/12 22:50:52 steve * Implement the vvp_fun_muxz functor. * diff --git a/vvp/parse.y b/vvp/parse.y index fce1bf630..4f9f249be 100644 --- a/vvp/parse.y +++ b/vvp/parse.y @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: parse.y,v 1.70 2005/03/18 02:56:04 steve Exp $" +#ident "$Id: parse.y,v 1.71 2005/04/03 05:45:51 steve Exp $" #endif # include "parse_misc.h" @@ -53,7 +53,7 @@ extern FILE*yyin; struct argv_s argv; vpiHandle vpi; - vvp_delay_t cdelay; + vvp_delay_t*cdelay; }; @@ -653,11 +653,11 @@ delay : /* empty */ { $$ = 0; } | '(' T_NUMBER ')' - { $$ = new vvp_delay_2_s($2, $2); } + { $$ = new vvp_delay_t($2, $2); } | '(' T_NUMBER ',' T_NUMBER ')' - { $$ = new vvp_delay_2_s($2, $4); } + { $$ = new vvp_delay_t($2, $4); } | '(' T_NUMBER ',' T_NUMBER ',' T_NUMBER ')' - { $$ = new vvp_delay_3_s($2, $4, $6); } + { $$ = new vvp_delay_t($2, $4, $6); } ; %% @@ -679,6 +679,9 @@ int compile_design(const char*path) /* * $Log: parse.y,v $ + * Revision 1.71 2005/04/03 05:45:51 steve + * Rework the vvp_delay_t class. + * * Revision 1.70 2005/03/18 02:56:04 steve * Add support for LPM_UFUNC user defined functions. * diff --git a/vvp/pointers.h b/vvp/pointers.h index cc5e725d6..a74e7a513 100644 --- a/vvp/pointers.h +++ b/vvp/pointers.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: pointers.h,v 1.10 2003/07/03 20:03:36 steve Exp $" +#ident "$Id: pointers.h,v 1.11 2005/04/03 05:45:51 steve Exp $" #endif /* @@ -102,13 +102,14 @@ typedef struct vthread_s*vthread_t; typedef struct vvp_fvector_s *vvp_fvector_t; -/* delay object */ - -typedef struct vvp_delay_s *vvp_delay_t; - +/* Forward declarations. */ +class vvp_delay_t; /* * $Log: pointers.h,v $ + * Revision 1.11 2005/04/03 05:45:51 steve + * Rework the vvp_delay_t class. + * * Revision 1.10 2003/07/03 20:03:36 steve * Remove the vvp_cpoint_t indirect code pointer. * diff --git a/vvp/udp.cc b/vvp/udp.cc index 50434fcf8..72f1f23c6 100644 --- a/vvp/udp.cc +++ b/vvp/udp.cc @@ -20,7 +20,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: udp.cc,v 1.27 2005/04/01 06:02:45 steve Exp $" +#ident "$Id: udp.cc,v 1.28 2005/04/03 05:45:51 steve Exp $" #endif #include "udp.h" @@ -172,10 +172,14 @@ void vvp_udp_s::compile_table(char**tab) assert(nrows1 == nlevels1_); } -vvp_udp_fun_core::vvp_udp_fun_core(vvp_net_t*net, vvp_udp_s*def) +vvp_udp_fun_core::vvp_udp_fun_core(vvp_net_t*net, + vvp_udp_s*def, + vvp_delay_t*del) : vvp_wide_fun_core(net, def->port_count()) { def_ = def; + delay_ = del; + cur_out_ = BIT4_X; // Assume initially that all the inputs are 1'bx current_.mask0 = 0; current_.mask1 = 0; @@ -212,10 +216,16 @@ void vvp_udp_fun_core::recv_vec4_from_inputs(unsigned port) break; } + vvp_bit4_t out_bit = def_->test_levels(current_); vvp_vector4_t out (1); - out.set_bit(0, def_->test_levels(current_)); + out.set_bit(0, out_bit); - propagate_vec4(out); + if (delay_) + propagate_vec4(out, delay_->get_delay(cur_out_, out_bit)); + else + propagate_vec4(out); + + cur_out_ = out_bit; } @@ -225,7 +235,7 @@ void vvp_udp_fun_core::recv_vec4_from_inputs(unsigned port) * netlist. The definition should be parsed already. */ void compile_udp_functor(char*label, char*type, - vvp_delay_t delay, + vvp_delay_t*delay, unsigned argc, struct symb_s*argv) { struct vvp_udp_s *def = udp_find(type); @@ -233,7 +243,7 @@ void compile_udp_functor(char*label, char*type, free(type); vvp_net_t*ptr = new vvp_net_t; - vvp_udp_fun_core*core = new vvp_udp_fun_core(ptr, def); + vvp_udp_fun_core*core = new vvp_udp_fun_core(ptr, def, delay); ptr->fun = core; define_functor_symbol(label, ptr); free(label); @@ -244,6 +254,9 @@ void compile_udp_functor(char*label, char*type, /* * $Log: udp.cc,v $ + * Revision 1.28 2005/04/03 05:45:51 steve + * Rework the vvp_delay_t class. + * * Revision 1.27 2005/04/01 06:02:45 steve * Reimplement combinational UDPs. * diff --git a/vvp/udp.h b/vvp/udp.h index 1774a7347..d78054ceb 100644 --- a/vvp/udp.h +++ b/vvp/udp.h @@ -22,10 +22,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: udp.h,v 1.15 2005/04/01 06:02:45 steve Exp $" +#ident "$Id: udp.h,v 1.16 2005/04/03 05:45:51 steve Exp $" #endif # include +# include /* * The vvp_udp_s instance represents a *definition* of a @@ -97,13 +98,15 @@ struct vvp_udp_s *udp_find(const char *label); class vvp_udp_fun_core : public vvp_wide_fun_core { public: - vvp_udp_fun_core(vvp_net_t*net, vvp_udp_s*def); + vvp_udp_fun_core(vvp_net_t*net, vvp_udp_s*def, vvp_delay_t*del); ~vvp_udp_fun_core(); void recv_vec4_from_inputs(unsigned); private: vvp_udp_s*def_; + vvp_delay_t*delay_; + vvp_bit4_t cur_out_; udp_levels_table current_; }; @@ -111,6 +114,9 @@ class vvp_udp_fun_core : public vvp_wide_fun_core { /* * $Log: udp.h,v $ + * Revision 1.16 2005/04/03 05:45:51 steve + * Rework the vvp_delay_t class. + * * Revision 1.15 2005/04/01 06:02:45 steve * Reimplement combinational UDPs. * diff --git a/vvp/vvp_net.cc b/vvp/vvp_net.cc index f1c3f3c65..c2cbd34d9 100644 --- a/vvp/vvp_net.cc +++ b/vvp/vvp_net.cc @@ -16,9 +16,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#ident "$Id: vvp_net.cc,v 1.20 2005/04/01 06:02:45 steve Exp $" +#ident "$Id: vvp_net.cc,v 1.21 2005/04/03 05:45:51 steve Exp $" # include "vvp_net.h" +# include "schedule.h" # include # include # include @@ -785,7 +786,6 @@ vvp_vector4_t vvp_fun_signal::vec4_value() const vvp_wide_fun_core::vvp_wide_fun_core(vvp_net_t*net, unsigned nports) { - delay_ = 0; ptr_ = net; nports_ = nports; port_values_ = new vvp_vector4_t [nports_]; @@ -796,15 +796,11 @@ vvp_wide_fun_core::~vvp_wide_fun_core() delete[]port_values_; } -void vvp_wide_fun_core::set_output_delay(vvp_time64_t delay) +void vvp_wide_fun_core::propagate_vec4(const vvp_vector4_t&bit, + vvp_time64_t delay) { - delay_ = delay; -} - -void vvp_wide_fun_core::propagate_vec4(const vvp_vector4_t&bit) -{ - if (delay_) - schedule_assign_vector(ptr_->out, bit, delay_); + if (delay) + schedule_assign_vector(ptr_->out, bit, delay); else vvp_send_vec4(ptr_->out, bit); } @@ -1242,6 +1238,9 @@ vvp_bit4_t compare_gtge_signed(const vvp_vector4_t&a, /* * $Log: vvp_net.cc,v $ + * Revision 1.21 2005/04/03 05:45:51 steve + * Rework the vvp_delay_t class. + * * Revision 1.20 2005/04/01 06:02:45 steve * Reimplement combinational UDPs. * diff --git a/vvp/vvp_net.h b/vvp/vvp_net.h index 9c91de3e0..6faea6fd6 100644 --- a/vvp/vvp_net.h +++ b/vvp/vvp_net.h @@ -18,9 +18,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#ident "$Id: vvp_net.h,v 1.20 2005/04/01 06:02:45 steve Exp $" +#ident "$Id: vvp_net.h,v 1.21 2005/04/03 05:45:51 steve Exp $" # include +# include "config.h" # include @@ -37,6 +38,8 @@ class vvp_fun_concat; class vvp_fun_drive; class vvp_fun_part; +class vvp_delay_t; + /* * This is the set of Verilog 4-value bit values. Scalars have this * value along with strength, vectors are a collection of these @@ -632,10 +635,8 @@ class vvp_wide_fun_core : public vvp_net_fun_t { vvp_wide_fun_core(vvp_net_t*net, unsigned nports); virtual ~vvp_wide_fun_core(); - void set_output_delay(vvp_time64_t delay); - protected: - void propagate_vec4(const vvp_vector4_t&bit); + void propagate_vec4(const vvp_vector4_t&bit, vvp_time64_t delay =0); unsigned port_count() const; vvp_vector4_t& value(unsigned); @@ -648,8 +649,6 @@ class vvp_wide_fun_core : public vvp_net_fun_t { void dispatch_vec4_from_input_(unsigned port, vvp_vector4_t bit); private: - // Propagation delay, if any, for the output from the device. - vvp_time64_t delay_; // Back-point to the vvp_net_t that points to me. vvp_net_t*ptr_; // Structure to track the input values from the input functors. @@ -679,6 +678,9 @@ class vvp_wide_fun_t : public vvp_net_fun_t { /* * $Log: vvp_net.h,v $ + * Revision 1.21 2005/04/03 05:45:51 steve + * Rework the vvp_delay_t class. + * * Revision 1.20 2005/04/01 06:02:45 steve * Reimplement combinational UDPs. *