View waveforms in Xschem

Ming Sun

Ming Sun / November 06, 2022

6 min read––– views

Cell name: SIM_nand2
PDK: Skywater130
Schematic capture: Xschem
Simulator: Ngspice

In this tutorial, we will keep using the SIM_nand2.sch schematic test bench. In the previous blog post[1], we use Ngspice to view the simulation results. Another alternative to view the simulation results is to use the built-in waveform viewer from Xschem.

Run simulation

  • Open the SIM_nand2 test bench, change the code_shown stimulus to the following:
code_show.sym
name=NGSPICE
only_toplevel=true
value="
.control
save all
tran 100p 4u
write SIM_nand2.raw
set appendwrite
.endc
" 
  • Add a launcher.sym symbol from xschem_library/devices folder with the following content:
launcher.sym
ame=h1 
descr="Select arrow and 
Ctrl-Left-Click to load/unload
simulation .raw file" 
tclcommand="
xschem raw_read $netlist_dir/[file tail [file rootname [xschem get current_name]]].raw
"
  • Add two waveform viewer into the schematic from Simulation => Add waveform graph. To resize the waveform graph, press ctrl key and use mouse left button to select the bottom right corner of the waveform graph. Then press m key to stretch[2].

The finished schematic is as shown in Fig. 1.

Modified SIM_nand2 schematic
Fig. 1Modified SIM_nand2 schematic

View simulation results

  • click Netlist => Simulate. After simulation is done, ctrl+click the bottom green arrow to load the waveform. You can also go to Simulation => Load/Unload spice .raw file to load the simulation data.

Select the first waveform graph and then select Vin1 net, press option-g to load Vin1 waveform to the first waveform graph as shown in Fig. 2.

Simulation result - Vin1
Fig. 2Simulation result - Vin1

Following the same procedure, we can load Vin2 and Vout to the waveform graph as well, which is as shown in Fig. 3.

Nand2 simulation results
Fig. 3Nand2 simulation results

Cursor and zoom in

The following bindkeys can be useful to check the wavefroms in the waveform graph[2].

  • a: toggle cursor a
  • b: toggle cursor b
  • mouse left button drag: pan left or right
  • mouse right button select: zoom in
  • f: full scale
  • left arrow: pan left
  • right arrow: pan right
  • top arrow: zoom in
  • down arrow: zoom out
Zoomed in simulation results
Fig. 4Zoomed in simulation results

References and materials

[1] Editor commands in Xschem

[2] Create symbol and hierarchical schematic in Xschem

[3] SIM_nand2.sch - download


HomeWikis
SnippetsAbout
Google ScholarLinkedIn