From d958a4a5af384e048fba2da279282611631e6340 Mon Sep 17 00:00:00 2001 From: steve Date: Mon, 5 Feb 2007 01:08:10 +0000 Subject: [PATCH] Handle relink of continuous assignment. --- vvp/vthread.cc | 26 +++++++++++++++++++++----- vvp/vvp_net.cc | 6 +++++- vvp/vvp_net.h | 6 +++++- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/vvp/vthread.cc b/vvp/vthread.cc index 5be8eaef8..49b7dec10 100644 --- a/vvp/vthread.cc +++ b/vvp/vthread.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: vthread.cc,v 1.159 2007/01/31 22:28:55 steve Exp $" +#ident "$Id: vthread.cc,v 1.160 2007/02/05 01:08:10 steve Exp $" #endif # include "config.h" @@ -759,10 +759,23 @@ bool of_CASSIGN_LINK(vthread_t thr, vvp_code_t cp) vvp_net_t*dst = cp->net; vvp_net_t*src = cp->net2; - /* For now, assert that the destination continuous assign - input is empty. That should be so as you can have only one - continuous assignment active for the destination. */ - assert(dst->port[1].nil()); + vvp_fun_signal_base*sig + = reinterpret_cast(dst->fun); + assert(sig); + + /* Detect the special case that we are already continuous + assigning the source onto the destination. */ + if (sig->cassign_link == src) + return true; + + /* If there is an existing cassign driving this node, then + unlink it. We can have only 1 cassign at a time. */ + if (sig->cassign_link != 0) { + vvp_net_ptr_t tmp (dst,1); + unlink_from_driver(sig->cassign_link, tmp); + } + + sig->cassign_link = src; /* Link the output of the src to the port[1] (the cassign port) of the destination. */ @@ -3378,6 +3391,9 @@ bool of_JOIN_UFUNC(vthread_t thr, vvp_code_t cp) /* * $Log: vthread.cc,v $ + * Revision 1.160 2007/02/05 01:08:10 steve + * Handle relink of continuous assignment. + * * Revision 1.159 2007/01/31 22:28:55 steve * Fix missing check for thread bits width in ADDI * diff --git a/vvp/vvp_net.cc b/vvp/vvp_net.cc index 2a927503c..4b4d045d7 100644 --- a/vvp/vvp_net.cc +++ b/vvp/vvp_net.cc @@ -16,7 +16,7 @@ * 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.57 2006/12/10 17:15:48 steve Exp $" +#ident "$Id: vvp_net.cc,v 1.58 2007/02/05 01:08:10 steve Exp $" # include "config.h" # include "vvp_net.h" @@ -1386,6 +1386,7 @@ vvp_fun_signal_base::vvp_fun_signal_base() needs_init_ = true; continuous_assign_active_ = false; force_link = 0; + cassign_link = 0; } void vvp_fun_signal_base::deassign() @@ -2256,6 +2257,9 @@ vvp_bit4_t compare_gtge_signed(const vvp_vector4_t&a, /* * $Log: vvp_net.cc,v $ + * Revision 1.58 2007/02/05 01:08:10 steve + * Handle relink of continuous assignment. + * * Revision 1.57 2006/12/10 17:15:48 steve * Fix build error overloading pow function. * diff --git a/vvp/vvp_net.h b/vvp/vvp_net.h index b4f789da8..a56af8196 100644 --- a/vvp/vvp_net.h +++ b/vvp/vvp_net.h @@ -18,7 +18,7 @@ * 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.54 2007/01/16 05:44:17 steve Exp $" +#ident "$Id: vvp_net.h,v 1.55 2007/02/05 01:08:10 steve Exp $" # include "config.h" # include @@ -800,6 +800,7 @@ class vvp_fun_signal_base : public vvp_net_fun_t, public vvp_vpi_callback { source node of the force, so that subsequent %force and %release instructions can undo the link as needed. */ struct vvp_net_t*force_link; + struct vvp_net_t*cassign_link; protected: @@ -1035,6 +1036,9 @@ inline void vvp_send_vec4_pv(vvp_net_ptr_t ptr, const vvp_vector4_t&val, /* * $Log: vvp_net.h,v $ + * Revision 1.55 2007/02/05 01:08:10 steve + * Handle relink of continuous assignment. + * * Revision 1.54 2007/01/16 05:44:17 steve * Major rework of array handling. Memories are replaced with the * more general concept of arrays. The NetMemory and NetEMemory