From fecd941a28bf6c81c27a8fba2092e60716316087 Mon Sep 17 00:00:00 2001 From: Cary R Date: Mon, 7 Apr 2008 17:18:21 -0700 Subject: [PATCH] Make sure MUXZ runs at time zero if needed. This patch adds a flag to the MUXZ object to make sure that it will run at time zero if needed. If this is not done the default Z result may not be overridden by an X result. --- vvp/logic.cc | 8 +++++--- vvp/logic.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/vvp/logic.cc b/vvp/logic.cc index 12b840ae5..94b38c4ad 100644 --- a/vvp/logic.cc +++ b/vvp/logic.cc @@ -348,6 +348,7 @@ vvp_fun_muxz::vvp_fun_muxz(unsigned wid) net_ = 0; count_functors_logic += 1; select_ = 2; + has_run_ = false; for (unsigned idx = 0 ; idx < wid ; idx += 1) { a_.set_bit(idx, BIT4_X); b_.set_bit(idx, BIT4_X); @@ -362,12 +363,12 @@ void vvp_fun_muxz::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit) { switch (ptr.port()) { case 0: - if (a_ .eeq(bit)) return; + if (a_ .eeq(bit) && has_run_) return; a_ = bit; if (select_ == 1) return; // The other port is selected. break; case 1: - if (b_ .eeq(bit)) return; + if (b_ .eeq(bit) && has_run_) return; b_ = bit; if (select_ == 0) return; // The other port is selected. break; @@ -383,7 +384,7 @@ void vvp_fun_muxz::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit) select_ = 1; break; default: - if (select_ == 2) return; + if (select_ == 2 && has_run_) return; select_ = 2; } break; @@ -399,6 +400,7 @@ void vvp_fun_muxz::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit) void vvp_fun_muxz::run_run() { + has_run_ = true; vvp_net_t*ptr = net_; net_ = 0; diff --git a/vvp/logic.h b/vvp/logic.h index 399cca7b1..fde5b8ea3 100644 --- a/vvp/logic.h +++ b/vvp/logic.h @@ -148,6 +148,7 @@ class vvp_fun_muxz : public vvp_net_fun_t, private vvp_gen_event_s { vvp_vector4_t b_; int select_; vvp_net_t*net_; + bool has_run_; }; class vvp_fun_muxr : public vvp_net_fun_t, private vvp_gen_event_s {