From 1453c5b0bbb4180e767ce8e323293a205e0ec64c Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 25 Jul 2009 21:05:03 +0100 Subject: [PATCH] Suppress unnecessary update of part select functor output. Currently a part select functor will send updates to nodes connected to its output whenever any part of its input vector changes. This patch ensures updates are only sent when the selected part of the input vector changes. --- vvp/part.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/vvp/part.cc b/vvp/part.cc index f3d98836e..1dcc38735 100644 --- a/vvp/part.cc +++ b/vvp/part.cc @@ -58,10 +58,15 @@ void vvp_fun_part_sa::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit, { assert(port.port() == 0); - if (val_ .eeq( bit )) + vvp_vector4_t tmp (wid_, BIT4_X); + for (unsigned idx = 0 ; idx < wid_ ; idx += 1) { + if (idx + base_ < bit.size()) + tmp.set_bit(idx, bit.value(base_+idx)); + } + if (val_ .eeq( tmp )) return; - val_ = bit; + val_ = tmp; if (net_ == 0) { net_ = port.ptr(); @@ -95,12 +100,7 @@ void vvp_fun_part_sa::run_run() vvp_net_t*ptr = net_; net_ = 0; - vvp_vector4_t res (wid_, BIT4_X); - for (unsigned idx = 0 ; idx < wid_ ; idx += 1) { - if (idx + base_ < val_.size()) - res.set_bit(idx, val_.value(base_+idx)); - } - vvp_send_vec4(ptr->out, res, 0); + vvp_send_vec4(ptr->out, val_, 0); } vvp_fun_part_aa::vvp_fun_part_aa(unsigned base, unsigned wid)