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.
This commit is contained in:
Martin Whitaker 2009-07-25 21:05:03 +01:00 committed by Stephen Williams
parent e98000426e
commit 1453c5b0bb
1 changed files with 8 additions and 8 deletions

View File

@ -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)