Move functor delays to vvp_delay_fun object.

This commit is contained in:
steve 2005-05-14 19:43:23 +00:00
parent c701fb615b
commit 870395e627
4 changed files with 84 additions and 26 deletions

View File

@ -17,10 +17,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: delay.cc,v 1.4 2005/04/03 05:45:51 steve Exp $"
#ident "$Id: delay.cc,v 1.5 2005/05/14 19:43:23 steve Exp $"
#endif
#include "delay.h"
#include "schedule.h"
#include <string.h>
#include <stream.h>
#include <assert.h>
@ -91,8 +92,42 @@ vvp_time64_t vvp_delay_t::get_delay(vvp_bit4_t from, vvp_bit4_t to)
return 0;
}
vvp_fun_delay::vvp_fun_delay(vvp_bit4_t init, const vvp_delay_t&d)
: delay_(d), cur_(1)
{
cur_.set_bit(0, init);
}
vvp_fun_delay::~vvp_fun_delay()
{
}
/*
* FIXME: This implementation currently only uses the LSB to determine
* the delay type for the entire vector. It needs to be upgraded to
* account for different delays for different bits by generating a
* stream of vectors that lead up to the actual value.
*/
void vvp_fun_delay::recv_vec4(vvp_net_ptr_t port, vvp_vector4_t bit)
{
if (cur_.eeq(bit))
return;
vvp_time64_t use_delay;
use_delay = delay_.get_delay(cur_.value(0), bit.value(0));
cur_ = bit;
if (use_delay == 0)
vvp_send_vec4(port.ptr()->out, cur_);
else
schedule_assign_vector(port.ptr()->out, cur_, use_delay);
}
/*
* $Log: delay.cc,v $
* Revision 1.5 2005/05/14 19:43:23 steve
* Move functor delays to vvp_delay_fun object.
*
* Revision 1.4 2005/04/03 05:45:51 steve
* Rework the vvp_delay_t class.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: delay.h,v 1.5 2005/04/03 05:45:51 steve Exp $"
#ident "$Id: delay.h,v 1.6 2005/05/14 19:43:23 steve Exp $"
#endif
/*
@ -46,8 +46,31 @@ class vvp_delay_t {
vvp_time64_t min_delay_;
};
/* vvp_fun_delay
* This is a lighter weight version of vvp_fun_drive, that only
* carries delays. The output that it propagates is vvp_vector4_t so
* drive strengths are lost, but then again it doesn't go through the
* effort of calculating strength values either.
*/
class vvp_fun_delay : public vvp_net_fun_t {
public:
vvp_fun_delay(vvp_bit4_t init, const vvp_delay_t&d);
~vvp_fun_delay();
void recv_vec4(vvp_net_ptr_t port, vvp_vector4_t bit);
//void recv_long(vvp_net_ptr_t port, long bit);
private:
vvp_delay_t delay_;
vvp_vector4_t cur_;
};
/*
* $Log: delay.h,v $
* Revision 1.6 2005/05/14 19:43:23 steve
* Move functor delays to vvp_delay_fun object.
*
* Revision 1.5 2005/04/03 05:45:51 steve
* Rework the vvp_delay_t class.
*

View File

@ -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.22 2005/05/13 05:13:12 steve Exp $"
#ident "$Id: logic.cc,v 1.23 2005/05/14 19:43:23 steve Exp $"
#endif
# include "logic.h"
@ -110,8 +110,7 @@ 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_time64_t del)
: delay_(del)
vvp_fun_buf::vvp_fun_buf()
{
count_functors_table += 1;
}
@ -130,14 +129,10 @@ void vvp_fun_buf::recv_vec4(vvp_net_ptr_t ptr, vvp_vector4_t bit)
bit.set_bit(idx, BIT4_X);
}
if (delay_ > 0)
schedule_assign_vector(ptr.ptr()->out, bit, delay_);
else
vvp_send_vec4(ptr.ptr()->out, bit);
vvp_send_vec4(ptr.ptr()->out, bit);
}
vvp_fun_bufz::vvp_fun_bufz(vvp_time64_t del)
: delay_(del)
vvp_fun_bufz::vvp_fun_bufz()
{
count_functors_table += 1;
}
@ -151,10 +146,7 @@ void vvp_fun_bufz::recv_vec4(vvp_net_ptr_t ptr, vvp_vector4_t bit)
if (ptr.port() != 0)
return;
if (delay_ > 0)
schedule_assign_vector(ptr.ptr()->out, bit, delay_);
else
vvp_send_vec4(ptr.ptr()->out, bit);
vvp_send_vec4(ptr.ptr()->out, bit);
}
vvp_fun_muxz::vvp_fun_muxz()
@ -240,8 +232,6 @@ 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);
@ -249,7 +239,7 @@ void compile_functor(char*label, char*type,
obj = new vvp_fun_and();
} else if (strcmp(type, "BUF") == 0) {
obj = new vvp_fun_buf(delay64);
obj = new vvp_fun_buf();
} else if (strcmp(type, "BUFIF0") == 0) {
obj = new vvp_fun_bufif(true,false, ostr0, ostr1);
@ -260,7 +250,7 @@ void compile_functor(char*label, char*type,
strength_aware = true;
} else if (strcmp(type, "BUFZ") == 0) {
obj = new vvp_fun_bufz(delay64);
obj = new vvp_fun_bufz();
#if 0
} else if (strcmp(type, "PMOS") == 0) {
obj = new vvp_pmos_s;
@ -324,13 +314,19 @@ void compile_functor(char*label, char*type,
/* If both the strengths are the default strong drive, then
there is no need for a specialized driver. Attach the label
to this node and we are finished. */
if (strength_aware || ostr0 == 6 && ostr1 == 6) {
if (strength_aware || ostr0 == 6 && ostr1 == 6 && delay == 0) {
define_functor_symbol(label, net);
free(label);
return;
}
vvp_fun_drive*obj_drv = new vvp_fun_drive(BIT4_X, ostr0, ostr1);
vvp_net_fun_t*obj_drv;
if (ostr0 == 6 && ostr1 == 6 && delay != 0) {
obj_drv = new vvp_fun_delay(BIT4_X, *delay);
} else {
obj_drv = new vvp_fun_drive(BIT4_X, ostr0, ostr1);
}
vvp_net_t*net_drv = new vvp_net_t;
net_drv->fun = obj_drv;
@ -348,6 +344,9 @@ void compile_functor(char*label, char*type,
/*
* $Log: logic.cc,v $
* Revision 1.23 2005/05/14 19:43:23 steve
* Move functor delays to vvp_delay_fun object.
*
* Revision 1.22 2005/05/13 05:13:12 steve
* Give buffers support for simple delays.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: logic.h,v 1.15 2005/05/13 05:13:12 steve Exp $"
#ident "$Id: logic.h,v 1.16 2005/05/14 19:43:23 steve Exp $"
#endif
# include "vvp_net.h"
@ -72,13 +72,12 @@ class vvp_fun_and : public vvp_fun_boolean_ {
class vvp_fun_buf: public vvp_net_fun_t {
public:
explicit vvp_fun_buf(vvp_time64_t del);
explicit vvp_fun_buf();
virtual ~vvp_fun_buf();
void recv_vec4(vvp_net_ptr_t p, vvp_vector4_t bit);
private:
vvp_time64_t delay_;
};
/*
@ -88,13 +87,12 @@ class vvp_fun_buf: public vvp_net_fun_t {
class vvp_fun_bufz: public vvp_net_fun_t {
public:
explicit vvp_fun_bufz(vvp_time64_t delay);
explicit vvp_fun_bufz();
virtual ~vvp_fun_bufz();
void recv_vec4(vvp_net_ptr_t p, vvp_vector4_t bit);
private:
vvp_time64_t delay_;
};
/*
@ -140,6 +138,9 @@ extern const unsigned char ft_var[];
/*
* $Log: logic.h,v $
* Revision 1.16 2005/05/14 19:43:23 steve
* Move functor delays to vvp_delay_fun object.
*
* Revision 1.15 2005/05/13 05:13:12 steve
* Give buffers support for simple delays.
*