From dad223316e49a1e2a7870f8ff49bff7761e27a67 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Thu, 25 Jun 2015 00:05:32 +0100 Subject: [PATCH] Fix propagation of unforced bits when forcing a part select. vvp_net_t::force_vec4 propagates all bits of the forced value passed to it, regardless of the mask value. I can't see any way to fix this directly, so instead make sure anything that calls force_vec4 sets the unforced bits of the passed value to the correct value. --- vvp/vthread.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vvp/vthread.cc b/vvp/vthread.cc index 39c463fc5..946eac9a3 100644 --- a/vvp/vthread.cc +++ b/vvp/vthread.cc @@ -2859,6 +2859,14 @@ bool of_FORCE_VEC4_OFF(vthread_t thr, vvp_code_t cp) mask.set_bit(base+idx, 1); vvp_vector4_t tmp (use_size, BIT4_Z); + + // vvp_net_t::force_vec4 propagates all the bits of the + // forced vector value, regardless of the mask. This + // ensures the unforced bits retain their current value. + vvp_signal_value*sig = dynamic_cast(net->fil); + assert(sig); + sig->vec4_value(tmp); + tmp.set_vec(base, value); net->force_vec4(tmp, mask);