Changes

An Overview of Digital Circuit Simulation

19 bytes removed, 15:34, 2 August 2015
The binary states of 1 and 0 indeed represent high and low voltages (typically 3V/5V and 0V) , respectively, at the pins of a digital device. When the input pin of a digital device changes its state, for example, from low to high, the device’s output pin does not change its state instantaneously. It takes a finite amount of time for the device to react to the state change. This is called the propagation delay. Digital devices may have different propagation delays for change of state from low to high (TPLH) or change of state from high to low (TPHL). As you connect and cascade many digital devices, these propagation delays add up and amount to a sizable delay time. In high-speed digital circuits, where state changes may occur very fast, the accumulated propagation delays may create serious operational problems.
 
==Wire and Pin Values (Level & Strength)==
The digital circuit simulator must interpret the circuit before a simulation can begin. For example, it must determine which device pins are logically connected to which wires. To make the program run quickly, the circuit interpretation is performed only when necessary. As a result, while you are editing the circuit, the outputs may sometimes show incorrect values, or the bus widths may be incorrect. If you step the time or change an input value, then the circuit state will be updated correctly.
 
==How Does the Digital Simulation Engine Work?==
The next step is to process the device input change list. That is to calculate the output of the inverter. Since the input is 0, and the simulation code for the inverter says that the input should be inverted and placed at the output, the output should be 1. However, the output is delayed by 8ns, the TPLH time of the inverter. So the output pin is appended to the future change list along with the time the pin will change (8ns) and the value it will change to (1, Strong). The device's "Future Change List" will now look like this:
 
{| class="wikitable"
| 8ns || 7404 || output || Strong 1
|}
 
All of this happens at time t = 0. Wire 0 now has a value of zero, and both the output pin of the input port and the input pin of the inverter have values of 0. Assuming that the simulator is running, the next step is to advance the time to the point of the next state change. From the future change list, we see that the next change is at the time t = 8ns, so time is forwarded to 8ns. Now, the future change is realized, i.e., the output pin of the inverter changes value to a strong 1, and the wire connected to it, wire 1, is put on the wire change list. Then the wire change list is processed. First, the wire's value is calculated. Since the output pin is a strong 1 and the input to the output port is still unknown, the wire's value is calculated to be a strong 1. The devices that are connected to wire 1 are put on the device input change list, and the connected pins' values are set to strong 1. Finally, the output probe's state is recalculated. Since the output probe's input pin is a strong 1, the output probe displays 1.
This example is very simple, yet it illustrates the workings of the digital circuit simulation engine. Note that the simulator doesn't have to continually check for signal changes at every nanosecond, but rather it keeps track of future events which in turn drive the simulator. Reset Time, Go, Step, and changing an input value all update the circuit state if necessary once you have changed the circuit.
 
==Setting Up Digital Circuit Simulations==
[[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.
 
<b>Setting the Output</b>
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.
 
[[File:b2MAN_Fig38.png|thumb|300px| Simulation Time Options Dialog.]]
With [[B2.Spice A/D]] you can also view live digital timing diagrams during a live [[Digital Simulation|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|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.
 
[[File:B2TUT4_13.png|thumb|center|600px| Live digital timing diagram during a live digital simulation.]]
 
<b>Running a [[Digital Simulation]] as a Transient Test</b>
A live simulation is indeed a perpetual (time-domain) transient simulation. If your digital input values are known in advance as a function of time or time step index, you can alternatively run a transient test of your digital circuit. In this case, you need a digital source as your input. You can use one ore more digital probes for the output. The results will appear as timing diagrams in a graph window at the end of the transient test.
 
[[File:B2TUT4_19.png|thumb|center|600px| A graph generated at the end of a transient test of a digital circuit.]]
 
==Propagation Delays==
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.
[[B2.Spice A/D]] does not vary propagation delays depending on which input has changed value. For example, in an adder, when the carry-in input changes, the outputs respond more quickly than when other inputs change value. [[B2.Spice A/D]] cannot model this effect. Also, [[B2.Spice A/D]] cannot model delays when the output changes from indeterminate to low differently from changes from high to low. In the 74126 Bus Buffer with 3-State Outputs, for example, the time it takes for the output to change from its high impedance state to low (TPZL) is typically 15ns, while the time to change from high to low (TPHL) is typically 7ns. [[B2.Spice A/D]] does not allow specification of TPZL, so it uses TPHL in place of TPZL.
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.
You have certain level of control over the initial state of a digital circuit. The input pins of digital devices are always initialized to the Initial Unknown strength & level. You can set the initial state of the output pin of some digital devices such as latches and flip flops. This is done using the "IC" parameter of these devices, which usually has a default zero value.
 
==Power Dissipation==
load capacitance = average capacitance seen by an output pin of a device.
 
The output change count of a CMOS component is incremented by one each time an output pin changes its logic value (level or strength). The input change count is incremented by one each time one or more input pins change values. This is a rough approximation, since it doesn't take into account factors such as the voltage levels at the inputs, or the temperature, or the fact that for devices with multiple outputs, different pins have different loads, and these pins may change in concert, or one at a time.
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.]]
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.
 
==Additional Considerations==
28,333
edits