From c701fb615b25bf5bee200f332695da3a5c8ebf0d Mon Sep 17 00:00:00 2001 From: steve Date: Fri, 13 May 2005 05:13:12 +0000 Subject: [PATCH] Give buffers support for simple delays. --- vvp/logic.cc | 31 ++++++++++++++++++++++++------- vvp/logic.h | 12 +++++++++--- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/vvp/logic.cc b/vvp/logic.cc index 160d03018..8623f1188 100644 --- a/vvp/logic.cc +++ b/vvp/logic.cc @@ -17,13 +17,14 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: logic.cc,v 1.21 2005/04/13 06:34:20 steve Exp $" +#ident "$Id: logic.cc,v 1.22 2005/05/13 05:13:12 steve Exp $" #endif # include "logic.h" # include "compile.h" # include "bufif.h" # include "npmos.h" +# include "schedule.h" # include "statistics.h" # include # include @@ -109,7 +110,8 @@ void vvp_fun_and::recv_vec4(vvp_net_ptr_t ptr, vvp_vector4_t bit) vvp_send_vec4(ptr.ptr()->out, result); } -vvp_fun_buf::vvp_fun_buf() +vvp_fun_buf::vvp_fun_buf(vvp_time64_t del) +: delay_(del) { count_functors_table += 1; } @@ -128,10 +130,14 @@ void vvp_fun_buf::recv_vec4(vvp_net_ptr_t ptr, vvp_vector4_t bit) bit.set_bit(idx, BIT4_X); } - vvp_send_vec4(ptr.ptr()->out, bit); + if (delay_ > 0) + schedule_assign_vector(ptr.ptr()->out, bit, delay_); + else + vvp_send_vec4(ptr.ptr()->out, bit); } -vvp_fun_bufz::vvp_fun_bufz() +vvp_fun_bufz::vvp_fun_bufz(vvp_time64_t del) +: delay_(del) { count_functors_table += 1; } @@ -145,7 +151,10 @@ void vvp_fun_bufz::recv_vec4(vvp_net_ptr_t ptr, vvp_vector4_t bit) if (ptr.port() != 0) return; - vvp_send_vec4(ptr.ptr()->out, bit); + if (delay_ > 0) + schedule_assign_vector(ptr.ptr()->out, bit, delay_); + else + vvp_send_vec4(ptr.ptr()->out, bit); } vvp_fun_muxz::vvp_fun_muxz() @@ -231,6 +240,8 @@ void compile_functor(char*label, char*type, vvp_net_fun_t* obj = 0; bool strength_aware = false; + vvp_time64_t delay64 = delay? delay->get_delay(BIT4_0,BIT4_1) : 0; + if (strcmp(type, "OR") == 0) { obj = new table_functor_s(ft_OR); @@ -238,7 +249,7 @@ void compile_functor(char*label, char*type, obj = new vvp_fun_and(); } else if (strcmp(type, "BUF") == 0) { - obj = new vvp_fun_buf(); + obj = new vvp_fun_buf(delay64); } else if (strcmp(type, "BUFIF0") == 0) { obj = new vvp_fun_bufif(true,false, ostr0, ostr1); @@ -249,7 +260,7 @@ void compile_functor(char*label, char*type, strength_aware = true; } else if (strcmp(type, "BUFZ") == 0) { - obj = new vvp_fun_bufz(); + obj = new vvp_fun_bufz(delay64); #if 0 } else if (strcmp(type, "PMOS") == 0) { obj = new vvp_pmos_s; @@ -327,6 +338,9 @@ void compile_functor(char*label, char*type, /* Point the gate to the drive node. */ net->out = vvp_net_ptr_t(net_drv, 0); + if (delay) + delete delay; + define_functor_symbol(label, net_drv); free(label); } @@ -334,6 +348,9 @@ void compile_functor(char*label, char*type, /* * $Log: logic.cc,v $ + * Revision 1.22 2005/05/13 05:13:12 steve + * Give buffers support for simple delays. + * * Revision 1.21 2005/04/13 06:34:20 steve * Add vvp driver functor for logic outputs, * Add ostream output operators for debugging. diff --git a/vvp/logic.h b/vvp/logic.h index 3cd92ba2d..e40d0a43b 100644 --- a/vvp/logic.h +++ b/vvp/logic.h @@ -19,10 +19,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: logic.h,v 1.14 2005/04/13 06:34:20 steve Exp $" +#ident "$Id: logic.h,v 1.15 2005/05/13 05:13:12 steve Exp $" #endif # include "vvp_net.h" +# include "delay.h" # include /* @@ -71,12 +72,13 @@ class vvp_fun_and : public vvp_fun_boolean_ { class vvp_fun_buf: public vvp_net_fun_t { public: - explicit vvp_fun_buf(); + explicit vvp_fun_buf(vvp_time64_t del); virtual ~vvp_fun_buf(); void recv_vec4(vvp_net_ptr_t p, vvp_vector4_t bit); private: + vvp_time64_t delay_; }; /* @@ -86,12 +88,13 @@ class vvp_fun_buf: public vvp_net_fun_t { class vvp_fun_bufz: public vvp_net_fun_t { public: - explicit vvp_fun_bufz(); + explicit vvp_fun_bufz(vvp_time64_t delay); virtual ~vvp_fun_bufz(); void recv_vec4(vvp_net_ptr_t p, vvp_vector4_t bit); private: + vvp_time64_t delay_; }; /* @@ -137,6 +140,9 @@ extern const unsigned char ft_var[]; /* * $Log: logic.h,v $ + * Revision 1.15 2005/05/13 05:13:12 steve + * Give buffers support for simple delays. + * * Revision 1.14 2005/04/13 06:34:20 steve * Add vvp driver functor for logic outputs, * Add ostream output operators for debugging.