Mixed-Signal Simulation in Ngspice: Combining Digital and Analog Worlds
0:00 Introduction: Overview of mixed-signal simulation, combining digital and analog components.
0:40 Digital Simulation: Discussion of digital simulators, their causal nature, and the use of languages like Verilog/SystemVerilog. A simple counter example in SystemVerilog is presented.
5:00 Analog Simulation: Explanation of analog simulation, its challenges due to non-linearity and varying time constants, and the use of numerical methods to solve differential equations. Commercial and open-source simulators are listed (Spectre, ngspice, etc.).
7:37 Mixed-Signal Simulation: Description of the interaction between digital and analog simulators, including signal translation and synchronization.
9:20 Demo Start: Practical demonstration of mixed-signal simulation using ngspice and SystemVerilog.
11:00 Analog Schematic: Review of the analog circuit (current mirror and 5-bit current DAC) used in the demo.
12:33 Digital Code: Overview of the digital code (counter) that controls the DAC.
12:40 Compiling Digital Code: Using verilator to compile the SystemVerilog code into a shared object (.so) file.
15:40 Including in Ngspice: Using a Perl script to generate the necessary Ngspice code for incorporating the compiled digital code. This includes instantiation, connecting dummy resistors to inputs/outputs, and converting the digital bus output to a real value for easier viewing.
19:48 Testbench: Explanation of the Ngspice testbench, including clock and reset generation, inclusion of the analog and digital components, and voltage sources for current measurement.
21:53 Setting Digital Levels: Overriding default digital output levels for compatibility with the analog circuit.
22:16 Running the Simulation: Executing the simulation using make typical.
24:56 Viewing Waveforms: Using a waveform viewer to analyze the simulation results, observing the DAC current changing with the digital counter output.