iverilog/vvp/functor.txt

72 lines
1.9 KiB
Plaintext

FUNCTOR DETAILS
The README.txt describes the .functor statement and how that creates a
functor. It also makes passing mention of how the functor is connected
up to the netlist. This document describes in detail how a functor is
supposed to act. See also the functor.h header file and the functor.cc
source file.
The current values of the inputs are stored in a single 8-bit byte,
2-bits per value. This is the ``ival'' member. The input of a functor
gets set by propagation events, assign events, or %set instructions.
The output value is stored in two bits of the functor. The current
output is used to detect edges when the input changes. Whenever an
input is set, a new output is calculated and compared with the current
output. If the current output is the same as the new output, then the
operation is complete and propagation stops.
If after a set the output changes, the current output is changed to
the new output, and a propagation event is created. This propagation
event is given a pointer to the functor that changed, and *not* simply
the contents of the out port. The event is scheduled for a delay that
is the propagation delay for the functor.
A propagation event is the only way that the output of a functor is
moved to the input of another functor. The propagation event, which is
given a pointer to the functor to propagate, looks at the output list
and sets the listed inputs to the current value of the output.
BUILT-IN FUNCTOR TABLES
* AND
* BUF
* MUXZ
This is a single-bit A/B mux with an active sigh enable. The 4 inputs
are A, B, select and enable:
Se En
0 0 z
0 1 A
1 0 z
1 1 B
xz 0 z
xz 1 x
This is used to implement structural ?: operators. The enable is
normally initialized to 1 and left unconnected. The device is called
MUXZ because the x and z values of the A and B inputs are passed
through.
* EEQ
Compare two pairs of inputs. output = (i1 === i2) && (i3 === i4);
* NAND
* NOR
* NOT
* OR
* XNOR
* XOR