diff --git a/vvp/schedule.cc b/vvp/schedule.cc index 4a62bf4de..93cf4a2b9 100644 --- a/vvp/schedule.cc +++ b/vvp/schedule.cc @@ -165,12 +165,14 @@ struct assign_vector4_event_s : public event_s { base = 0; vwid = 0; } +#if 0 /* A constructor that makes the val directly. */ assign_vector4_event_s(const vvp_vector4_t&that, unsigned adr, unsigned wid) : val(that,adr,wid) { base = 0; vwid = 0; } +#endif /* Where to do the assign. */ vvp_net_ptr_t ptr; @@ -782,26 +784,12 @@ void schedule_assign_vector(vvp_net_ptr_t ptr, schedule_event_(cur, delay, SEQ_NBASSIGN); } -void schedule_assign_plucked_vector(vvp_net_ptr_t ptr, - vvp_time64_t delay, - const vvp_vector4_t&src, - unsigned adr, unsigned wid) -{ - struct assign_vector4_event_s*cur - = new struct assign_vector4_event_s(src,adr,wid); - cur->ptr = ptr; - cur->vwid = 0; - cur->base = 0; - schedule_event_(cur, delay, SEQ_NBASSIGN); -} - -void schedule_propagate_plucked_vector(vvp_net_t*net, - vvp_time64_t delay, - const vvp_vector4_t&src, - unsigned adr, unsigned wid) +void schedule_propagate_vector(vvp_net_t*net, + vvp_time64_t delay, + const vvp_vector4_t&src) { struct propagate_vector4_event_s*cur - = new struct propagate_vector4_event_s(src,adr,wid); + = new struct propagate_vector4_event_s(src); cur->net = net; schedule_event_(cur, delay, SEQ_NBASSIGN); } diff --git a/vvp/schedule.h b/vvp/schedule.h index e30b4fd8c..49db903e9 100644 --- a/vvp/schedule.h +++ b/vvp/schedule.h @@ -48,11 +48,6 @@ extern void schedule_assign_vector(vvp_net_ptr_t ptr, const vvp_vector4_t&val, vvp_time64_t delay); -extern void schedule_assign_plucked_vector(vvp_net_ptr_t ptr, - vvp_time64_t delay, - const vvp_vector4_t&val, - unsigned adr, unsigned wid); - extern void schedule_assign_array_word(vvp_array_t mem, unsigned word_address, unsigned off, @@ -66,10 +61,9 @@ extern void schedule_assign_array_word(vvp_array_t mem, /* * Create an event to propagate the output of a net. */ -extern void schedule_propagate_plucked_vector(vvp_net_t*ptr, - vvp_time64_t delay, - const vvp_vector4_t&val, - unsigned adr, unsigned wid); +extern void schedule_propagate_vector(vvp_net_t*ptr, + vvp_time64_t delay, + const vvp_vector4_t&val); /* * This is very similar to schedule_assign_vector, but generates an diff --git a/vvp/vthread.cc b/vvp/vthread.cc index 344d03438..141bb4bc2 100644 --- a/vvp/vthread.cc +++ b/vvp/vthread.cc @@ -993,9 +993,10 @@ bool of_ASSIGN_VEC4(vthread_t thr, vvp_code_t cp) { vvp_net_ptr_t ptr (cp->net, 0); unsigned delay = cp->bit_idx[0]; - vvp_vector4_t val = thr->pop_vec4(); + vvp_vector4_t&val = thr->peek_vec4(); - schedule_assign_plucked_vector(ptr, delay, val, 0, val.size()); + schedule_assign_vector(ptr, 0, 0, val, delay); + thr->pop_vec4(1); return true; } @@ -1686,11 +1687,12 @@ static void do_CMPU(vthread_t thr, const vvp_vector4_t&lval, const vvp_vector4_t bool of_CMPU(vthread_t thr, vvp_code_t) { - vvp_vector4_t rval = thr->pop_vec4(); - vvp_vector4_t lval = thr->pop_vec4(); + const vvp_vector4_t&rval = thr->peek_vec4(0); + const vvp_vector4_t&lval = thr->peek_vec4(1); do_CMPU(thr, lval, rval); + thr->pop_vec4(2); return true; } @@ -3737,7 +3739,7 @@ bool of_PAD_S(vthread_t thr, vvp_code_t cp) { unsigned wid = cp->number; - vvp_vector4_t val = thr->pop_vec4(); + vvp_vector4_t&val = thr->peek_vec4(); unsigned old_size = val.size(); val.resize(wid); @@ -3748,8 +3750,6 @@ bool of_PAD_S(vthread_t thr, vvp_code_t cp) val.set_bit(idx, sb); } - thr->push_vec4(val); - return true; } @@ -5400,17 +5400,20 @@ bool of_STORE_VEC4A(vthread_t thr, vvp_code_t cp) unsigned adr_index = cp->bit_idx[0]; unsigned off_index = cp->bit_idx[1]; - vvp_vector4_t value = thr->pop_vec4(); + vvp_vector4_t&value = thr->peek_vec4(); long adr = adr_index? thr->words[adr_index].w_int : 0; long off = off_index? thr->words[off_index].w_int : 0; // Suppress action if flags-4 is true. - if (thr->flags[4] == BIT4_1) + if (thr->flags[4] == BIT4_1) { + thr->pop_vec4(1); return true; + } array_set_word(cp->array, adr, off, value); + thr->pop_vec4(1); return true; } diff --git a/vvp/vvp_net.cc b/vvp/vvp_net.cc index 5ae18616d..73a4530ea 100644 --- a/vvp/vvp_net.cc +++ b/vvp/vvp_net.cc @@ -3042,7 +3042,7 @@ void vvp_wide_fun_core::propagate_vec4(const vvp_vector4_t&bit, vvp_time64_t delay) { if (delay) - schedule_propagate_plucked_vector(ptr_, delay, bit, 0, bit.size()); + schedule_propagate_vector(ptr_, delay, bit); else ptr_->send_vec4(bit, 0); }