Hi All:
I know that ngspice can save event driven nodes to vcd file, and view the vcd file with gtkwave. But I am interesting in analog circuit now, and can not find a way to output analog results to vcd file.
How to save analog results from ngspice and view them in gtkwave?
Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks!
I am using ngspice as shared library. So I decide to save the vactor values that from callback function in memory, and output a VCD file myself. Then let gtkwave use the VCD file.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks!
I am using ngspice as shared library. So I decide to save the vactor
values that from callback function in memory, and output a VCD file
myself. Then let gtkwave use the VCD file.
That is interesting. The last time I looked, I could not find
adequate documentation to write VCD files. However, this
documentation and source code was donated shortly afterwards
and is now somewhere in an older NGSPICE branch. The
implementation needs the zlib.dll and I remember issues
with it not being available for Windows at that time.
A nice side effect of VCD files is that they are much
shorter than the regular .raw files and speed up
NGSPICE quite a bit. A disadvantage is that most other
tools can't read VCD.
-marcel
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well, call me simple, but I tried to make a VCD file using eprvcd of a pulse waveform and the trouble is that my signal is not identified as event driven node, so it does not go into the file. Page 19 of the manual clearly shows that analog wavefroms may be displayed and implies they may coexist peacefully with digital ones.
It seems that the only way to get analogue values into a VCD file is from an XSPICE "real" node. Hence the use of a bridge. I did now find a way to get a scope-style trace in gtkwave: Menubar->Edit->Data Format->Analog->Interpolated and it only works after the trace is displayed in the default format. So quite well-hidden, but with that the output looks OK.
Marcel,
I found an earlier topic on ngspice writing output for gtkwave while searching for how to display analogue traces. It mentioned a problem with zlib, but the format was gtkwave's own LXT, not VCD.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I found an earlier topic on ngspice writing output for gtkwave while
searching for how to display analogue traces. It mentioned a problem
with zlib, but the format was gtkwave's own LXT, not VCD.
Sorry for the unintended confusion! It is indeed LXT that needs ZLIB.
I don't think it is worthwhile to integrate LXT in NGSPICE, given the
currently available VCD functionality.
-marcel
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Another possibility is to add voltage_to_real bridges to the relevant nodes and save the output. The bridge is not a standard component, but it took little time to make one. The resulting VCD file looks plausible, but gtkwave fails to plot it. I may be missing something.
I am looking at a software called vcdMaker which purports to be able to make a vcd file of ascii data. My thinking was to write a text file wit wrdata as the input. I have started to try this, but have been unsuccessful so far.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am looking at a software called vcdMaker which purports to be able to make a vcd file of ascii data. My thinking was to write a text file wit wrdata as the input. I have started to try this, but have been unsuccessful so far.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It does work after dragging the trace name into the central "Signals" box. The signal then appears as a digital wave form, but if zoomed in the numeric sample values are shown. So probably much less useful than ngspice's own plots or gnuplot output in most cases. I guess it could be useful if you have a lot of digital signals and a few analogue ones.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Nice. Last time I had to deal with large amounts of digital stimulus and
"expect", I had to make veriloga widgets and shell scripts to turn VCD
dumps into PWL/NRZ veriloga sources.
Will there be / is there, a VCD -input- complement to the VCD output?
And what about a VCD "checker"? I made a veriloga that basically compared
VCS@time to a clocked sample of an output, and threw an output voltage
to inspect (for !=0).
Everybody does functional-at-speed verification on >10Kgates in SPICE, right?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The VCD format seems to be the nearest available thing to a "lingua franca" for simulation data, so a VCD reader seems a good idea. And any such input reader would be very useful in regression testing, both for application circuits and ngspice itself. Having a hammer, this looks like a nail. I envisage a netlist syntax like:
Perhaps vcd.c in the gtkwave sources at https://sourceforge.net/projects/gtkwave/ , although its GPL license does not allow its direct usage in ngspice, which is not GPL.
Last edit: Holger Vogt 2023-08-04
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I imagine a voltage source similar to pwlfile but which lets you set the
"1" and "0" voltage and transition time between, and then reads VCD
format so you get level_one*bit_is_one and level_zero*!bit_is_one
and a finite risetime. Point it at a VCD file and which column, badda-
bing.
And a "criticizer" for the output side, which can read an "expect" file
format (VCD or ???), emitting an "error waveform" and per-failing-
vector statements.
But that's a circuit guy's idea without regard to practicalities.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
How about this... I am looking on my drive for a simulation I did in ModelSim of a sine tone generator. When I wrote it, I produced an analog waveform in ModelSim.
So, I just took a look in the folder which contains the .exe files associated with ModelSim and there is a conversion utility to covert the waveform file ( .wlf) to vcd format! Perhaps that is a way to break into how to represent an analog waveform in gtkwave.
If I can find that HDL, I will try it...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi All:
I know that ngspice can save event driven nodes to vcd file, and view the vcd file with gtkwave. But I am interesting in analog circuit now, and can not find a way to output analog results to vcd file.
How to save analog results from ngspice and view them in gtkwave?
Thanks!
Unfortunately this is not implemented directly in ngspice.
You may try storing data with command 'wrdata' and then read and display it with gtkwave. If this is possible, please post your procedure here.
For pure analog you might use the4 'gnuplot' command or the internal 'plot' procedures.
Thanks!
I am using ngspice as shared library. So I decide to save the vactor values that from callback function in memory, and output a VCD file myself. Then let gtkwave use the VCD file.
On 2022-07-08 02:41, fiveight wrote:
That is interesting. The last time I looked, I could not find
adequate documentation to write VCD files. However, this
documentation and source code was donated shortly afterwards
and is now somewhere in an older NGSPICE branch. The
implementation needs the zlib.dll and I remember issues
with it not being available for Windows at that time.
A nice side effect of VCD files is that they are much
shorter than the regular .raw files and speed up
NGSPICE quite a bit. A disadvantage is that most other
tools can't read VCD.
-marcel
Well, call me simple, but I tried to make a VCD file using eprvcd of a pulse waveform and the trouble is that my signal is not identified as event driven node, so it does not go into the file. Page 19 of the manual clearly shows that analog wavefroms may be displayed and implies they may coexist peacefully with digital ones.
I don't have the luxury to do what @fiveight did.
Clyde,
It seems that the only way to get analogue values into a VCD file is from an XSPICE "real" node. Hence the use of a bridge. I did now find a way to get a scope-style trace in gtkwave: Menubar->Edit->Data Format->Analog->Interpolated and it only works after the trace is displayed in the default format. So quite well-hidden, but with that the output looks OK.
Marcel,
I found an earlier topic on ngspice writing output for gtkwave while searching for how to display analogue traces. It mentioned a problem with zlib, but the format was gtkwave's own LXT, not VCD.
On 2022-07-08 13:35, Giles Atkinson wrote:
Sorry for the unintended confusion! It is indeed LXT that needs ZLIB.
I don't think it is worthwhile to integrate LXT in NGSPICE, given the
currently available VCD functionality.
-marcel
https://sourceforge.net/p/ngspice/mailman/message/32894493/
https://sourceforge.net/p/ngspice/ngspice/ci/tmp-gtkwave-3/tree/
Last edit: Holger Vogt 2022-07-08
Another possibility is to add voltage_to_real bridges to the relevant nodes and save the output. The bridge is not a standard component, but it took little time to make one. The resulting VCD file looks plausible, but gtkwave fails to plot it. I may be missing something.
The test circuit:
I am looking at a software called vcdMaker which purports to be able to make a vcd file of ascii data. My thinking was to write a text file wit wrdata as the input. I have started to try this, but have been unsuccessful so far.
I am looking at a software called vcdMaker which purports to be able to make a vcd file of ascii data. My thinking was to write a text file wit wrdata as the input. I have started to try this, but have been unsuccessful so far.
It does work after dragging the trace name into the central "Signals" box. The signal then appears as a digital wave form, but if zoomed in the numeric sample values are shown. So probably much less useful than ngspice's own plots or gnuplot output in most cases. I guess it could be useful if you have a lot of digital signals and a few analogue ones.
VCD file output for analogue nodes is expected in Ngspice41. (commit e9386155a63c17ce4d7b8f814f6f18d98927c40b)
Nice. Last time I had to deal with large amounts of digital stimulus and
"expect", I had to make veriloga widgets and shell scripts to turn VCD
dumps into PWL/NRZ veriloga sources.
Will there be / is there, a VCD -input- complement to the VCD output?
And what about a VCD "checker"? I made a veriloga that basically compared
VCS@time to a clocked sample of an output, and threw an output voltage
to inspect (for !=0).
Everybody does functional-at-speed verification on >10Kgates in SPICE, right?
The VCD format seems to be the nearest available thing to a "lingua franca" for simulation data, so a VCD reader seems a good idea. And any such input reader would be very useful in regression testing, both for application circuits and ngspice itself. Having a hammer, this looks like a nail. I envisage a netlist syntax like:
or even
I did look for some nice open-source library to handle the low-level stuff. So far, no luck. If anyone knows of one ...
Perhaps vcd.c in the gtkwave sources at https://sourceforge.net/projects/gtkwave/ , although its GPL license does not allow its direct usage in ngspice, which is not GPL.
Last edit: Holger Vogt 2023-08-04
I imagine a voltage source similar to pwlfile but which lets you set the
"1" and "0" voltage and transition time between, and then reads VCD
format so you get level_one*bit_is_one and level_zero*!bit_is_one
and a finite risetime. Point it at a VCD file and which column, badda-
bing.
And a "criticizer" for the output side, which can read an "expect" file
format (VCD or ???), emitting an "error waveform" and per-failing-
vector statements.
But that's a circuit guy's idea without regard to practicalities.
How about this... I am looking on my drive for a simulation I did in ModelSim of a sine tone generator. When I wrote it, I produced an analog waveform in ModelSim.
So, I just took a look in the folder which contains the .exe files associated with ModelSim and there is a conversion utility to covert the waveform file ( .wlf) to vcd format! Perhaps that is a way to break into how to represent an analog waveform in gtkwave.
If I can find that HDL, I will try it...