Schedule UDP initial 0/1 assignments to occur during time 0.

This allows any always processes that are sensitive to the UDP output
to start first. This fixes a time 0 race that was found in a Lattice
Semiconductor simulation library (reported on iverilog-devel).

If the initial value is 'x', propagate the value to the UDP output
before the start of simulation, to avoid unwanted update events on
the z -> x transition on downstream nets.
This commit is contained in:
Martin Whitaker 2019-08-09 21:00:10 +01:00
parent a8318db21c
commit 3bdb50da29
1 changed files with 6 additions and 1 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005-2010 Stephen Williams (steve@icarus.com)
* Copyright (c) 2005-2019 Stephen Williams (steve@icarus.com)
*
* (This is a rewrite of code that was ...
* Copyright (c) 2001 Stephan Boettcher <stephan@nevis.columbia.edu>)
@ -907,7 +907,12 @@ vvp_udp_fun_core::vvp_udp_fun_core(vvp_net_t*net, vvp_udp_s*def)
current_.mask1 = 0;
current_.maskx = ~ ((-1UL) << port_count());
// If the initial value is 0 or 1, schedule the initial assignment
// normally, so that any sensitive always processes can be started
// first.
if (cur_out_ != BIT4_X)
schedule_generic(this, 0, false);
else
schedule_functor(this);
}