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.
This commit is contained in:
Cary R 2008-04-07 17:18:21 -07:00 committed by Stephen Williams
parent 2be8534021
commit fecd941a28
2 changed files with 6 additions and 3 deletions

View File

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

View File

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