Simulation Fundamentals: Cosimulation In NI Multisim


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.


Understanding Co-Simulation: The Bridge Interface Device

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:

  1. Vin in_analog 0 dc 5
  2. aADC [in_analog] [in_digitized] ADC
  3. aNot in_digitized out_digitized NOT
  4. aDAC [out_digitized] [out_analog] DAC
  5. Rload out_analog 0 10k
  6. .MODEL ADC adc_bridge (in_low= 2.5 in_high= 2.5)
  7. .MODEL DAC dac_bridge (out_low= 0 out_high= 5 out_undef = 0)
  8. .MODEL NOT d_inverter (rise_delay = 1n fall_delay = 1n)

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.


Analog and Digital Components in Multisim

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.

Component properties dialog box

Figure 1 - Component properties dialog box


Model tab

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).


Pin parameters tab

On the pin parameters tab you will notice that each pin is assigned a type which serves two functions:

  • As a part of the Electrical Rules Check (ERC), the pin parameters define the pin allowing Multisim to interpret whether an electrical rule has been broken (e.g. an output pin connected to an output pint). This setting does not affect simulation.
  • In the case of non-analog Components, the pin type instructs Multisim on how to interface to components of a different Type.

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.



Component pin parameters dialog box

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.

Component type selection dialog


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)


Connecting Devices

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.

Digital only simulation schematic

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).Cosimulation schematic

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.


Visualization of cosimulation netlist

Figure 6 - Visualization of cosimulation netlist


Pin Driver/Receiver Details

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.


Potential pin driver model for U7

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.


Potential pin receiver model for U9

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.

Component properties dialog box for 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.


Digital Simulation Settings

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.

Digital simulation settings dialog box

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.


Digital Simulation: The Four Basic Cases

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).

NOR and NOT gate pin parameters

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.


Case 1: Digital Connection

Digital simulation

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.


Case 2: Mixed-signal connection, digital simulation setting is “Ideal”


Mixed signal 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.

  1. .SUBCKT CMOS_RCV__NON__1 1 2 3 4
  2. * CMOS LOAD Model  1 = input, 2 = A/D out 3 = VCC 4 = VSS(GND)
  3. *#L1
  4. aADC1in [1] [2] ADC1
  5. .MODEL ADC1 adc_bridge (in_low= 2.5 in_high = 2.5)
  6. *#L1
  7. .ENDS
  8. .SUBCKT CMOS_DRV__NON__1 1 2 3 4
  9. * CMOS Driver Model  1 = D/A input, 2 = out 3 = VCC 4 = VSS(GND)
  10. *#L1
  11. aDAC1in  [1]  [2] aDAC1
  12. .MODEL aDAC1 dac_bridge (out_low= 5.0 out_high= 0 out_undef= 0)
  13. *#L1

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.


Case 3: Mixed-signal connection, digital simulation setting is “Real” with no power


Mixed signal connection (real) with no power

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:

  1. .SUBCKT CMOS_DRV__NON__1 1 2 3 4
  2. * CMOS Driver Model  1 = D/A input, 2 = out 3 = VCC 4 = VSS(GND)
  3. *#L2
  4. aDACin  [1]  [5] aDAC
  5. M_N_EM_Q1 2 5 4 4 NMEload
  6. M_P_EM_Q2 2 5 3 3 PMEload
  7. .MODEL NMEload NMOS(is= 1e-5 kp= 2e-3)
  8. .MODEL PMEload PMOS(is=1e-5 kp= 2e-3)
  9. .MODEL aDAC dac_bridge (out_low= 0 out_high= 5.0 out_undef = 0)
  10. *#L2
  11. .ENDS

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.


Case 4: Mixed-signal connection, digital simulation setting is “Real” with power

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.

Mixed signal connection with real power

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.


Cosimulation Tips

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.

  • Any analog device may be directly connected to any analog device, and any digital device may be directly connected to any digital device (expect the d_vhdl device) without the need for bridges.
  • Connections between analog and digital devices must use appropriate bridges. Bridges are ideal gateways devices that map digital states to analog voltages and vice versa.
  • Multisim simplifies the task of connecting components of differing types by automatically inserting enhanced bridge models (pin drivers/receivers) in series with the digital pins. This is done in the netlist only and is not reflected in the schematic. From the schematic point of view the node becomes analog.   
  • Within the Pin Parameters tab, the selection of Component Technology and Pin Type determine the details of the pin driver/receiver.
  • With the default Digital Simulation Setting set to “ideal”, the complex pin driver/receiver circuitry that attempts to model real-life I/O characteristics is bypassed. The resulting pin driver will contain only the most basic devices required to model the Pin Type. Often the result is just the basic bridge device.
  • Most pin drivers/receivers require external power supplies with node names VDD, VCC, VSS, or GND. Improper operation or errors will occur if these power supplies are not present on the schematic.  
  • When in doubt, study the netlist by selecting Transfer >>Export Netlist in Multisim.   


Related Resources

The following resources highlight additional SPICE simulation information on the web-site:

Was this information helpful?