Familiarise yourself with Workcraft interface to learn its common features that are available for all plugins.
This plugin is intended for capturing, simulation and verification of asynchronous digital circuits. For simulation and verification the circuit is automatically translated into a Signal Transition Graph (STG) that allows re-using the features of the STG plugin.
In order to create a circuit model choose File→Create work… menu item and in the New work dialogue select Digital Circuit as the model type.
The main building blocks of a digital circuit are functional components that can be created with the function generator . Initially a generated component has only a single output pin (
z0 by default). New pins can be added through the Add output or Add input items of the popup menu (accessible by right-clicking the component). The pin name and type can be changed in the property editor – see Name and I/O type properties respectively.
Initially the output pin has neither set nor reset functions assigned. The set/reset functions can be specified by selecting the output pin and entering the corresponding Boolean expressions in the Set function and Reset function entries of the property editor. Note that if a component has a single output pin (which if is the majority of logic gates) then the set/reset functions can be also modified in the properties of the component.
A component visualisation is defined by its Render type selected in the property editor, as follows:
Usually it is not necessary to explicitly create input pins. When a Set function or Reset function is entered for an output pin, the missing input pins are automatically created for all the literals in the Boolean expressions. Note that the input pins do not disappear if they become unneeded after modification of the set/reset functions. You may need to manually remove those pins by first selecting them and then pressing Delete button.
Other building blocks of a digital circuit are its primary input and output ports. These are used to interact with the circuit environment. The ports are created with the port generator – just activate this editor tool and click the editor panel in a position you want to place the port. By default an output port is created, however, if you hold Shift while clicking the editor panel then an input port is created. Note that you can change the of existing port I/O type in the property editor too.
When the connection tool is active you can connect the pins of the circuit components and primary ports. The output pins and the input ports can be connected either to the input pins or to the output ports. Several connections may start at the same output pin or an input port, however, only a single connection can end up at an input pin or an output port. If an incorrect connection is attempted (e.g. a connection from an input pin to an output port or more than one connections to an input pin) then a warning message will be issued.
In order to reduce the number of arcs going from the same output pin (or an input port) and simplify the layout of the connection arc, one can “fork” the wires – just start a connection from an existing wire and a joint point will be automatically created. New connections can be also started from the existing joint points.
For editing the model activate the selection tool . All the standard editing features (select, drag-and-drop, delete, copy, undo, group, etc.) work the same – see generic help on Selection controls and Property editor for details.
Similar to all the other models, textual comments can be created by activating the tool and clicking the editor panel in the position you want to put the text. Double-click on the note box to edit its text label in-place or do it through the property editor panel when the note is selected.
For simulation of a Digital Circuit model activate the simulation tool . The enabled pins and ports are highlighted and can be activated by clicking them. The simulation tool controls provide the means for analysis and navigation through the simulation trace, see generic help on Simulation controls for details. The circuit simulation is just an abstraction over the simulation of an automatically generated STG representation of the circuit components. Therefore all the specifics of STG simulation also apply to the Digital Circuit plugin.
The state of circuit's signals is visualised by colouring the corresponding pins and wires either blue (for logical
0) or red (logical
1). Circuit pins associated with excited signals are highlighted and can be clicked to progress to the next state.
By default the circuit driver pins (input ports and the gate output contacts) are initialised to logical
0. This may lead to some of the circuit internal signals being excited when the simulation begins, e.g. the output
0, but evaluates to
1 (first transition in the simulation trace). There are two ways to change the initial values to the circuit signals:
1by ticking the Init to one property of the pin.
A circuit simulation trace can be converted to a Digital Timing Diagram by the generator of trace diagram . The order, visibility, and color of signal waveforms are specified in the signal state table – see STG simulation help for details.
Verification of a digital circuit is usually made in the context of its environment. The environment can be described as an STG and attached to the circuit model using the property editor when no nodes are selected.
When a verification task is issued via the Verification menu, the circuit is first translated into an STG that is subsequently composed with the STG of the environment. The resultant STG is used for verification of the desired properties:
Initialisation (or reset) of a speed-independent circuit is an important part of the design process because a circuit can malfunction if its initial state is incorrect. Note that the initialisation phase of a speed-independent circuit does not have to be speed-independent: It is assumed that there is a special
reset signal that is generated externally and behaves as follows:
resetgoes high, at which point the circuit is already correctly initialised and the normal speed-independent operation begins.
resetstays high for the whole time of circuit normal operation.
There are several ways of circuit initialisation that can be used in combination:
Initialisation analyser tool is designed to aid the decision of how to reset these modules. The tool uses Init to one and Forced init properties of circuit signals (i.e. primary input ports and output pins of circuit components):
These properties can be viewed and modified in the Property editor when an input port or an output pin is selected. Note that selecting a single-output component (i.e. a gate) also reveals these properties of its only output pin.
Initialisation analyser uses these properties as follows. It considers the signals whose Forced init property is set as initialised, while the remaining signals are assumed as uninitialised. The tool tries to evaluate each uninitialised signal on the Init to one property of initialised signals. If the Boolean value of a signal can be derived, then it is said to have propagated initial state and the signal is also considered initialised. The tool repeats evaluation of uninitialised signals until no further progress can be made, i.e. no new initialised signals can be obtained. At this stage, if some signals are still uninitialised it means Forced init property of the circuit signals needs to be adjusted, until all the signals are successfully initialised.
If the propagated initial state of a signal does not match its Init to one property, then the signal is said to have initialisation conflict – this often indicates a mistake, e.g. incorrect initial value of the signal. However, there are legitimate situations where such conflicts can occur – most likely such a signal needs to be explicitly initialised by setting its Forced init property.
Initialisation analyser visualises the initialisation state using the Gate highlight legend shown in the Tool controls:
By default the highlighting scheme is as follows (the colours can be adjusted in the preferences of digital circuit model – see Edit→Preferences…→Models→Digital Circuit):
Force init pins table enumerates the pins whose Forced init property is set. Note that Forced init property of a signal can be toggled while in Initialisation analyser tool by clicking the corresponding input port, output pin, or a gate. This enables convenient exploration of possible reset strategies. The tool also provides several ways of changing Force init property for a group of contacts:
Circuit initialisation comprises three steps:
reset, set its Init to one property according to the reset active state (false for active low, true for active high), and use it to initialise all the signals that have Force init property set.
Consider our circuit example whose all signals are initially expected (but not guaranteed!) to be
0, i.e. none of the driver pins have their Init to one property set. Let us explore initialisation strategies by activating Initialisation analyser . As no Forced init property is set the initial state of all the circuit signals is undefined:
Let us assume that circuit's environment forces all the input ports to be in the expected state and indicate this by setting their Forced init property. This can be achieved by either clicking each input port, or by pressing button. The result is as follows:
One can see that the C-element
g1 has been properly initialised via its inputs – it is highlighted in green. However, the initial state of gate
g0 contradicts the propagated value from the input ports – it is highlighted in magenta. The conflict on
g0 output is visualised as follows: the contact is blue (represents the expected value
0), while its outline is red (representing the propagated value
Address this issue by forcing
g0 to the expected initial state. For this click the gate – its highlighting color should change to orange indicating that it is the designers responsibility to force this gate to the expected state:
Now the circuit does not have any initialisation conflicts, however, its gate
g0 needs to be explicitly reset. This can be done automatically by pressing Insert reset logic button. The following dialog request the name of reset port and its active state (active-low or active-high):
Here is a result of inserting active-high reset (
g0 function is modified to be resetable to
0, an input port
reset is added and connected to the new pin of
Now the circuit is correctly initialised via its primary inputs – all the gates are highlighted in green to indicate this. Note that the newly inserted
reset port is constrained by its set and reset functions, therefore the circuit can be verified against the original environment STG without reset signal.