Changes

An Overview of Digital Circuit Simulation

338 bytes added, 15:25, 10 November 2016
/* Digital Bus Connectors */
[[File:rfspice_banner.png|right|640px]]
[[Image:Back_icon.png|40px]] '''[[RF.Spice_A/D | Back to RF.Spice A/D Wiki Gateway]]'''
 
[[Image:Tutorial_icon.png|40px]] '''[[RF.Spice_A/D#RF.Spice_A.2FD_Tutorials | RF.Spice A/D Tutorial Gateway]]'''
== The Main Differences Between Analog and Digital Circuit Simulations ==
==How Does the Digital Simulation Engine Work?==
[[File:b2MAN_Fig37.png|thumb|400px| A simple digital inverter circuit.]]
Rather than giving a theoretical account of the workings of the digital simulation engine, here we present an example. The circuit used for this example will be the simple inverter function given below.
 
<table>
<tr>
<td>
[[File:b2MAN_Fig37.png|thumb|left|480px| A simple digital inverter circuit.]]
</td>
</tr>
</table>
Assuming that the initial conditions are set to indeterminate level and strength, all wires and pins will be preset to the indeterminate state with unknown strengths. As soon as the simulation starts, however, the input port will send a message to the simulation engine that its pin's value should be 0, causing the program's wire change list to be appended with the first wire's ID (0). The program will then process the wire changes. That is, the value of wire 0 is calculated to be 0, and the wire's value is passed to each of the pins that connected to it. Since the input to the inverter was previously unknown, and its new value is a strong 0, the input pin will be appended to the device input change list.
The simplest input device for digital circuits is the "Digital Input" with the keyboard shortcut N. For the basic input port, click on the up and down arrows with the selection arrow to toggle its value between 0 and 1. Or double click on the input port to open the device's property dialog and set or change the input's value. [[RF.Spice A/D]] offers a number of other input devices for digital simulation. With the "Toggle Switch", click on the switch to change its value. The button changes with each click of the mouse. The "DIP8 Switch" has eight output pins, each of which are controlled by a separate switch. Clicking on the switches will toggle their output values. With the hexadecimal "Keypad", click on one of the 16 buttons to select a value from 0, 1, ..., 9, A, B, ..., F. A "Digital Source" allows you to define a sequence of binary values as a function of time (or time step index).
[[File:B2TUT4 1.png|thumb|400px| A simple digital circuit with three digital inputs and one digital output.]]
For input devices, the logical value, number of bits available, decimal or hexadecimal format, and name of the device can be edited. Choose "Assert High" or "Assert Low" to determine the polarity setting of the device.
The simplest output device for digital circuits is the "Digital Output" with the keyboard shortcut O. A digital probe device does the same function. All input and output port logic levels are shown in the input and output ports in hexadecimal notation. For single wire probes, the probe values 1 and 0 mean logical High and logical Low. The value ? means indeterminate, i.e. the program cannot determine the signal value. A strength of S is a strong signal, strength R is for resistive strength, Z for High Impedance, and ? for unknown strength.
If "Circuit Animation" is activated for digital simulation, you will see the logical state of all wire during a simulation as text. If "Circuit Animation" is turned off, you can view the logic level and strength of any wire in the schematic window by using the "Probe Tool". You can access this tool either from the [[Schematic toolbar|Schematic Toolbar]] or from Edit Menu or simply using the keyboard shortcut Ctrl+Alt+P. In the "Probe Mode", place the tip of the logic probe on any wire and depress the left mouse button to see its logic level and strength. If the logic probe is probing a digital bus, then the value of the bus is the hexadecimal value calculated by making bit 0 of the bus the least significant bit.
For output devices, the device name and decimal or hexadecimal format can be edited. Choose "Assert High" or "Assert Low" to determine the polarity setting of the device.
<table><tr><td> [[File:b2MAN_Fig38B2TUT4 1.png|thumb|300pxleft| Simulation Time Options Dialog480px| A simple digital circuit with three digital inputs and one digital output.]]</td></tr></table> 
<b>Running a Live Interactive Digital Simulation</b>
Set up the input values and set the time step you desire from the Simulation Time Options dialog. To open this dialog, click the Step Interval Settings [[File:b2Interval_Tool.png]] button on the [[Main toolbar|Main Toolbar]], or select the Time Options item of the Simulate Menu, or use the keyboard shortcut Ctrl+I. A typical time step for digital circuit simulations is 20ns. Click the Step [[File:b2Step_Tool.png]] button to start the simulation. The simulation time is incremented by one time step. The current time is displayed in the simulation toolbar next to the control buttons. You can view the logical state of the wires and device pint either using the logic Probe Tool or by Circuit Animation. The values of input and output devices are displayed, too. You can change the values of input devices in real time. Click the Step [[File:b2Step_Tool.png]] button once again to increment the time by another time step. The Walk button starts the simulation but increases the simulation time by the walk factor, which can be set in the Simulation > Time Options menu. Click the Strop/Reset [[File:b2Stop_Tool.png]] button to reset the time to t = 0.  <table><tr><td> [[File:b2MAN_Fig38.png|thumb|left|360px| Simulation Time Options Dialog.]]</td></tr></table>
With [[RF.Spice A/D]] you can also view live digital timing diagrams during a live digital simulation. Click on the "Show/Hide Live Digital Timing Diagram" [[File:b2Timing_Tool.png]] button in the [[Schematic toolbar|Schematic Toolbar]]. Initially nothing happens. A soon as the digital simulation starts, a graph window opens up at the bottom of the screen that shows live timing diagrams for all the input and output devices. As you continue to step the time, these graphs expand. Similar to other graphs, the digital timing diagrams have their own settings dialogs in the Toolbox. Note that the timing diagrams are updated only when a change occurs in your circuit.
<table>
<tr>
<td>
[[File:B2TUT4_13.png|thumb|640pxleft|720px| Live digital timing diagram during a live digital simulation.]]
</td>
</tr>
<tr>
<td>
[[File:B2TUT4_19.png|thumb|640pxleft|720px| A graph generated at the end of a transient test of a digital circuit.]]
</td>
</tr>
==Propagation Delays==
[[File:b2MAN_Fig40.png|thumb|500px| Digital Inverter's property dialog.]]
The propagation delay of a digital device is the time it takes for the signal to change at the output in response to a change at the input. Each output pin of a digital device has a propagation delay associated with it. The propagation delay of a pin can be affected by the circuit's default fixed delay, the circuit's default delay class, the specific pin's overriding delay or delay class, and the device model's maximum, minimum and typical delays.
The delay actually involves two values, a rise time and a fall time. TPLH (the low-to-high propagation delay) is the time from the input change time to the output change time when the output is going from low to high. TPHL (the high-to-low propagation delay) is the time from the input change time to the output change time when the output is going from high to low. Propagation delays are important because they determine the speed of your circuit, and in circuits with feedback and flip flops and registers, propagation delays can even affect whether or not your circuit works. A digital device's delays can be accessed from its property dialog.
<table><tr><td>[[File:b2MAN_Fig39b2MAN_Fig40.png|thumb|500pxleft| Propagation delay of the digital inverter circuit640px| Digital Inverter's property dialog.]]</td></tr></table> 
An example showing the delays for the 7404 inverter is shown in the figure on the right. In this case, TPLH = 8ns and TPHL = 12ns. You can see that as the input value changes from 0 to 1 at t = 20ns, the output value changes from 1 to 0 at t = 20 + TPLH = 28ns. subsequently, as the input value changes from 1 to 0 at t = 40ns, the output value changes from 0 to 1 at t = 40 + TPHL = 52ns.
Many digital parts store their states regardless of what is happening at their inputs until a specific input changes value in a specific direction. The 7474 D flip flop is such a device. Its D input can change, but the output will not change until the clock pin rises from zero to one. We call the activating change in the clock pin a "Trigger". For the trigger to work, the circuit must be stable (i.e., inputs must not change) for a specific time period before the trigger occurs. This time is called the "Setup Time". After the trigger, the inputs must be stable for a time period so that the new state is not disturbed. This post-trigger time period is called the "Hold Time". If either the set up or hold time specifications are violated, the program notifies the user and sets the device's output to indeterminate.
 
<table>
<tr>
<td>
[[File:b2MAN_Fig39.png|thumb|left|720px| Propagation delay of the digital inverter circuit.]]
</td>
</tr>
</table>
==Initial Circuit State==
A digital clock is a periodic pulse generator similar to the analog square wave generator. Many digital devices such as flip flops require a clock for their operation. From a clock's property dialog, you can change its default name and set its period as well as its pulse width. The pulse width is the duration of the high (1) portion of the signal in each period. The clock input itself must have a period of a certain duration in order for dynamic devices to operate properly. This minimum period is expressed in its inverted form as the maximum frequency of a digital device.
[[File:b2MAN_Fig41.png|thumb|400px| Bus Connector's property dialog.]]
==Digital Bus Connectors==
You can edit the pin connections of bus connectors. By default, the wires coming into splitters and combiners are distributed automatically in the following manner. The wires connected to the top pin become the least significant bits of the splitter or combiner. The rest of the wires coming into the splitter or combiner are placed into the higher bits of the splitter or combiner. After the circuit state is updated, the splitter or combiner will display the bit numbers of the wires. The wire distribution can be customized by turning off the "Auto Distribute" checkbox in the bus connector's property dialog and entering the pin numbers manually. The first leg will use the wires in the first dialog box, etc. For example, if you have a 1-to-2 splitter, you can specify that you want bit 0 of the net to go onto the lower pin of the bus connector and bit 1 of the net to go to the upper pin. Multiple bits can be specified for each pin using colons and commas to group bits.
 
<table>
<tr>
<td>
[[File:b2MAN_Fig41.png|thumb|left|480px| Bus Connector's property dialog.]]
</td>
</tr>
</table>
==Additional Considerations==
28,333
edits