NI Multisim is an analog and digital simulation environment based upon two simulation technologies: a SPICE-based simulator for analog simulation and an event-driven simulator, based on XSPICE technology, for digital simulation.
This article is a continuation of a series of articles which explore the lower-level details of simulation in Multisim.
Circuit simulation is widely regarded as a critical step in the design flow. SPICE simulation is the de facto standard for analog circuit simulation. Over the years, many enhancements and additions to SPICE have extended its functionality and range of applicability. NI Multisim adds to the versatility of SPICE by incorporating a mixed-mode simulator, allowing fast simulation of both analog and digital components together.
NI Multisim provides an intuitive environment, where the complex tasks required to successfully simulate analog and digital circuitry is automatically accomplished. These tasks include incorporating bridges that translate analog signals to digital and vice-versa.
This article introduces the basic structure of SPICE and XPSPICE-based co-simulation through a detailed explanation of a primitive bridge interface. After gaining understanding of the bridge, we can explore how NI Multisim defines various analog and digital models and how this relates to co-simulation results. Finally, we will describe various digital simulation scenarios to enable you to better translate simulation data and trouble-shoot circuits.
Before discussing how co-simulation works in Multisim, we must first build a better understanding of the fundamentals of analog and digital devices and how they interact in a SPICE simulation.
Traditional SPICE-based devices are characterized by voltages and currents measured across ports. However, event-driven digital devices have ports that are described by one of several logic states. Therefore, to allow these two separate simulation technologies to communicate with one another we require special hybrid devices named bridges. In this article we will discuss these basic hybrid devices and how Multisim applies them in mixed-mode circuits.
The digital-to-analog (D/A) bridge maps digital logic values to a voltage such that it can be interpreted by analog simulation. The D/A bridge therefore maps one of three digital levels (HI, LO and UNKNOWN) at its input, to one of three voltage values at the output port.
The analog-to-digital (A/D) bridge conversely maps a range of voltage values on its input port to one of three digital states at its output port.
At a circuit netlist level, these bridges are denoted with the device names adc_bridge and dac_bridgeand are instantiated like any other XSPICE device. The bridges may be considered as ideal devices because the D/A bridge drives its output with an ideal voltage source with no output impedance, whereas the A/D bridge has in infinite input impedance when sampling the analog value.
It is important to note that if one attempts to connect analog to digital devices directly, an error will be generated at the start of the simulation, as there is essentially a miscommunication between the analog and digital simulation.
The following circuit netlist is an example of a mixed-mode circuit with the correct use of the bridge devices:
In Line 1, we set our input voltage at the node in_analog to be 5V DC (an analog value).
Line 2 instantiates an A/D bridge between the analog node in_analog and digital node in_digitized, which . converts the 5V to a logic state (in this case HI) and assigns this value to node in_digitized.
Line 3 instantiates a digital inverter which sets node out_digitized to LO.
Finally in line 4, the LO state is converted back to an analog signal with a D/A bridge, which sets zero volts between the nodes out_analog and ground.
With the exception of devices that are defined in VHDL, all digital devices must use the adc_bridge and dac_bridge devices to connect to analog nodes.
With our basic understanding of the bridge device, we are now able to investigate how analog and digital components are defined in Multisim. This will build a clear picture of how hybrid bridges and co-simulation work hand-in-hand in this environment.
So let us begin by discussing how a component is defined in Multisim.
A component is comprised of various parts, including a schematic symbol, a simulation model, pin parameters and a package name (for board layout).
It is the model and pin parameter details which affect simulation. If you double-click on a component and select Edit Component in DB you will see the Component Properties window. In this window, you will notice two distinct tabs in which the model and pin parameters can be viewed and edited. The tabs for the model and pin parameters are shown below in Figure 1.
Figure 1 - Component properties dialog box
The Model tab contains the SPICE-based model for the component (as is seen in the Model Data field of the tab). The model can be defined either with a single model statement (.model) or a subcircuit (.subckt…ends).
A single .model statement references a primitive device (resistor, MOSFET, AND gate etc…). This .model statement can be either an analog or digital device. All devices in Multisim follow the convention that digital devices have a d_ prefix in the device name while analog devices have no specific prefix.
A subcircuit is enclosed by the .subckt and .ends statements. A subcircuit is simply a shell that contains any combination of primitive devices within Multisim, with one restriction – the devices that connect to its ports must be either all digital or all analog.
(Although many components in Multisim’s database are defined using a single .model statement, it is strongly recommended that users who create new components that use a single device wrap them in a subcircuit. The main advantage of this is that both the instance line (i.e M1 D G S S MyMos L=5u W=100u) and the .model line (i.e .model MyMos NMOS(level=1 Kp=….) ) must be specified by the user. If a single .model statement is entered as the model for a component, the instance line will automatically be handled by Multisim which can lead to problems when there are actual parameters on the instance line such as the Length and Width of MOSFETs).
On the pin parameters tab you will notice that each pin is assigned a type which serves two functions:
Therefore, as noted above, the pin Type is very important in Multisim to help define how to correctly interface one component type to another.
Previously in this article, we learned that digital devices can be connected to analog devices through the use of a bridge device. In order to avoid manual placement of these bridges for every mixed signal connection, Multisim automatically places an appropriate bridging circuit into the netlist of the circuit. The type of bridging circuit that is placed is dependent on the settings in the pin parameters tab.
As noted in the red box in Figure 2, the first selection in the Pin Parameters tab identifies the Component Type. The selection here is based upon the type of .model or .subckt port devices in the model tab.
Figure 2 - Component pin parameters dialog box
For simulation purposes, the rest of the settings in the Pin Parameters tab do not apply to Analog Type components. The Component Technology (Figure 2 – black box) and pin Type (as defined in the Pin table of Figure 2) tell Multisim which bridging circuit to use when an event-driven device is wired to a SPICE-based analog device These are described in the “Pin Driver/Receiver Details” section of the document.
Below is a guideline for choosing the Component Type in Figure 3 based on the model in the model tab.
Figure 3 - Component type selection dialog
Model in Model tab
.subckt with analog devices connected to ports, or .model with device name starting with anything other than “d_”
.subckt with digital devices connected to ports, or .model with device name starting with “d_” (except d_vhdl)
.model referencing d_vhdl device
.model referencing d_verilog device (obsolete)
Let us consider the circuit below (Figure 4) where digital type devices are connected together. Based upon the pin parameters settings, Multisim knows that the connecting nodes between these two components can remain digital as both components have matching pin types. That is, a digital output state of one component becomes a digital input state to another.
Figure 4 - Digital only simulation schematic
Imagine we make some modifications to the circuit above by connecting a transistor component with an analog model as shown below (Figure 5).
Figure 5 - Cosimulation schematic
Based upon the pin settings, Multisim is able to place an appropriate bridging device whenever a user attempts to connect pins or parts of differing types. The bridge device is inserted into the circuit netlist in the background and is therefore not visible on the schematic. From both a user and a schematic point of view these components have seamlessly connected. However, from a simulation model understanding, Multisim has been able to intelligently incorporate the bridge drivers in the overall simulation netlist. If we were to visualize our circuit netlist, we would see something as in figure 6 below.
Figure 6 - Visualization of cosimulation netlist
In the above example we explored Multisim placing the A/D and D/A bridge devices into our circuit, based upon pin definitions. In reality, Multisim actually inserts an entire pin driver/receiver bridging circuit which includes that basic bridge device (as we have discussed above) and possibly additional circuitry which combines to provide more realistic chip I/O effects.
It is very important for users to understand which pin driver/receiver is used as it can significantly affect circuit functionality.
A possible block diagram of an inserted pin driver for a tri-state digital output is shown below.
Figure 7 - Potential pin driver model for U7
Conversely, a possible block diagram of an inserted pin receiver is shown below (Figure 8) if an analog node is connected to a digital input.
Figure 8 - Potential pin receiver model for U9
The details of what constitutes the inside of the circuit blocks, specifically the analog circuitry are dependant on further settings in the pin parameters tab.
Let us return to the Component Properties dialog box and consider a digital component whose type is selected as Digital.
Figure 9 - Component properties dialog box for digital "type" components
The numerous choices in the Component Technology selection box and the Pin Type selection box exist to better model a real chip’s pin drivers and receivers.
Real chips do not have ideal pin input/output characteristics and the actual characteristics of these pins vary from technology to technology. Different technologies in fact may offer slightly different types of drivers and receivers. For example, the CMOS_5V technology family offers Schmitt_trigger receiver where as the Tiny_Logic_5V does not.
Ultimately it is the combination of a selected component technology and pin type with which Multisim is able to insert a specific pin driver or receiver model. It is the additional pin driver/receiver circuitry which attempts to model the non-ideal I/O characteristics of a component.
So far in this article we have been discussing how based upon the actual model and pin parameters we have set for the component, Multisim must make a decision on the type of A/D and D/A bridge, as well as pin driver/receiver circuit that must be incorporated into a circuit.
There is in fact one more setting which can affect the type of pin driver/receiver that can be selected by Multlisim for digital simulation and this is the user defined Digital Simulation Settings.
In the Multisim environment you can select Simulate >> Digital Simulation Settings to see the Digital Simulation Settings dialog box, as seen in figure 10 below. In this dialog you can select to simulate your digital and analog/digital circuit in either an ideal or real mode.
Figure 10 - Digital simulation settings dialog box
If setting is set to “Ideal” (the default), only the most basic driver/receiver model is inserted which does not model the true I/O characteristics of the technology. This driver/receiver attempts to model only the most basic and ideal functionality of the pin type. For example, if pin type is Active Driver, the pin driver will only contain the D/A bridge. If the pin type is 3-state, the pin driver will contain the D/A bridge, and a special HI-IMPEDANCE detector device which controls an ideal analog switch that acts like a pass gate. These minimal, ideal inclusions do provide a faster overall simulation time and sufficient accuracy.
If the digital simulation setting is set to “Real”, a complex model is used which models the I/O characteristics of the technology. This model contains the A/D or D/A bridge and additional analog circuitry. This provides more accurate simulation results, however does slow down simulation time. It is important to note that most driver/receiver circuitry requires specific power supply rails (VCC, VDD, VSS, DGND) so these should be placed on the schematic.
Based upon what we have learned about pin parameters and digital simulation settings we are now ready to consider an example of what Multisim does in various simulation and co-simulation scenarios.
Let us consider an example using a NOR and NOT gate. The pin parameters tab of the NOR gate is shown on the left and that of the NOT gate is shown on the right. (Note that both are multi-section components and thus show several instances of that gate in the pin properties, pin table).
Figure 11 - NOR and NOT gate pin parameters
There are four cases which we are able to discuss based upon the connection of these two devices as well as the type of digital simulation setting.
Figure 12 - Digital simulation
Since all pins are digital in the connection of figure 12 the connecting node is digital when pins are connected. This can be seen because the dynamic probe marker reads “LO” when hovering over the node during simulation.
Figure 13 - Mixed signal simulation (ideal)
It is important to note that in this scenario our digital simulation settings are set to ideal.
You will notice that in this scenario we have made a connection to an analog component. The visible node is now analog because pin drivers and receivers have been added to the digital components pins to allow for analog-digital co-simulation.
We can in fact look at what the overall netlist looks like in Multisim, by going to Transfer>>Export Netlist, Based upon this view of the netlist we can see what has been added to our simulation code. The following subcircuits have been inserted in series with the two digital pins.
Due to this 1kΩ resistor (an analog component) Multisim has placed A/D and D/A bridges in our netlist. You will notice however that ONLY D/A and A/D bridge components are present as our digital simulation settings are set to Ideal in this scenario. Also note that subcircuit pins 3 and 4 are not used inside the subcircuit; The D/A bridge has its own internal voltage source.
Figure 14 - Mixed signal connection (real) with no power
It is important to note that in this scenario our digital simulation settings are set to real.
Notice that the values displayed in the measurement probe are wrong. We are seeing both an analog voltage reading, as well as a value which is high, rather than being close to LO or 0V as we have seen previously.
This is happening because a complex pin driver and receiver are used while in the real digital simulation settings mode, however (you will remember) we require proper power supplies on the schematic to power our digital components. Taking a look inside the netlist will provide further insight about the situation. In particular, consider the new pin driver that has been added:
In case 2, subcircuit pins 3 and 4 were not utilized anywhere in the model but in this case, they are. By tracing back to how the subcircuit is instantiated, we notice the following line:
xU1_A.O1 ~dU1.O1 1 VDD VSS CMOS_DRV__NON__1
It incorrectly states that subcircuit node 3 is connected to a schematic node named VDD and subcircuit node 4 is connected to node name VSS. There are no such node names on the schematic. There is a VCC and GND, but there are no VSS or VDD. What this means is that there should be power rails for the drive transistors but in fact we actually have a couple of floating nodes. Appropriate voltages must be placed on nodes VDD and VSS to power our circuit and this is done with the VDD and VSS voltage source components as we will see in case 4 below.
To remedy the issue seen in case 3 we must simply add the appropriate power supplies to the schematic as shown below. Virtual connections will be made in the underlying netlist as the symbol has no explicit power pins.
Figure 15 - Mixed signal connection with real power
Notice the marker now reads the correct yet less idealized analog voltage values.
Throughout this document we have discussed many major topics regarding simulation in Multisim that are core to understanding how analog and digital devices interface to one another in a single environment. Although the majority of what is discussed takes place in the background automatically, it is important for a user to understand these facts as they are paramount in ultimately defining the accuracy of their final simulation.
The following list represents a summary of mixed-mode simulation topics (and a quick refresher) to help in analyzing your simulation, as well as when creating custom components.
The following resources highlight additional SPICE simulation information on the ni.com web-site: