-
-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Verilog-A devices support using Ngspice+OpenVAF #197
Comments
How will the "file" and Symbol for the Verilog-A models be done? Attached are two old Qucs Verilog-A projects. Qucs required you to create SYM and JSON files. Something that was very tedious to do. Are you going to create a new class of File component like SpiceLibComp that loads the Verilog-A file and one can create a new Symbol? That is how QucsStudio does it. There are a number of QucsStudio Verilog-A projects you can look at. Update: I cleaned up the two projects and resubmitted them. |
A new class is not required. The procedure the same as existing for Qucs. You need to open the |
"The symbol editor opens and you can attach the *.sym file to *.va source." Is there an easier way to create SYM files other than cutting select sections out of existing files containing the desired symbol and then splicing them into a new file using an undefined format? You don't have a symbol editor which makes creating a totally new symbol very tedious. . |
I meant a subciruit symbol editor that is called when we press F9 on subciruit or |
So how will the Qucs Symbol be created for the *.va file other than the way I stated above? The way it was done in https://mos-ak.org/venice_2014/publications/T_4_Brinson_MOS-AK_Venice_2014.pdf is very tedious and the average person would struggle to figure how to do it. |
It's need to reuse the existing flow for the attaching symbols to the |
I went through the procedure in https://mos-ak.org/venice_2014/publications/T_4_Brinson_MOS-AK_Venice_2014.pdf. There is a step press F9 to "Edit Text Symbol". Can this Symbol Editor be used in other situations? It would be helpful to open other *.sym files so one could copy and paste symbols into both Verilog *.sym files and SpiceLibComp *.sch files. I have a folder called symbols to store symbol files. I splice text from these files into *.sch models using a text editor. |
Yes, I am planning to reuse this symbol editor for SPICE symbols too in order to resolve #147. But I have encountered two issues:
After I find the solution for these issues, the editor for SPICE |
Just being able to copy and past symbol files from other sources more easily would be helpful. Trying to draw some symbols from scratch is very frustrating. Trying to make a transformer using Elliptic Arcs will drive anyone crazy. I found some other issues but they were using Verilog-A in Qucs 0.0.19
|
Yes, it is a bug. I confirm this. Arrow is displayed correctly in the Symbol view, but not on the schematic.
I confirm that Qucs-S tries to load an icon with empty filename, but the icon file itself is not deleted. This is a bug too.
There is no way to embed Verilog-A models in libraries in Qucs-S. I am not planning to implement this feature because of low demand. |
The most probably it is a transparent background. You may use any light background for your component icon. I am usually using icons with white background.
JSON files are created automatically. User must not edit them. The format of the JSON files is not documented. |
I recreated an old Verilog BSIM project that was missing it's *.va files. https://qucs.sourceforge.net/examples/BSIMTests_prj.zip I found the *.va files and used the icons from http://qucs.github.io/qucs-manual/0.0.19/html-en/component_reference.html The n/p noise simulations have issues. |
Yes, everything works using Qucs-S with Qucsator simulation kernel. But I will not include this example to the Qucs-S distribution. BSIM models are available for Ngspice/Xyce out of box and such example may give user a false direction. Furthermore I am planning to make deprecated Qucsator+ADMS and Qucsator netlist syntax. Qucs-S should be fully switched to the SPICE in the near future, because Qucsator development is stalled. OpenVAF+Ngspice is actively developed and seems to offer all features of Qucsator+ADMS. So Qucsator+ADMS is not needed anymore for debug and usage of Verilog-A models. Qucsator must be kept only for backward compatibility. That's why I am not inclined to add in the program distribution any new examples/documents involving Qucator and ADMS. |
I have added a TODO list for this task. One major issue is preventing this from inclusion in the next release. The |
I was testing this flow and I found a bug in the netlist syntax. In the netlist model statement there is no blank space between the Verilog-A module name and the first parameter. Simulation rans but it uses the default value for the module parameter (rather than the instance value) Currently
Should be
|
@bertgoz , Yes, I confirm this problem. It's strange but for my tunnel diode model Ngspice accepts both syntax (with and without space) and simulates the circuit correctly. Furthermore SPICE should accept both syntax. For example see this line from the model in the library: Line 18 in bf004c1
|
Also look at this example https://sourceforge.net/p/ngspice/ngspice/ci/pre-master/tree/examples/osdi/r2_cmc/res_r2_cmc.cir There is no space between the model name and left parenthesis. |
Ran into issues with two different Verilog tunnel diode models I found for Qucs. tunn-sub.va in the Verilog examples generates errors. I found an old posting that may be pertinent. Qucs/qucs#318 tunnel_diode.va is in the online help https://qucs-help.readthedocs.io/en/spice4qucs/Intro.html and a paper by Brinson. I get an error saying "Icon not found" after "Load Verilog-A module". No matter what I do, no Icon works. |
Yes, I confirm this problem. This bug (or undocumented feature?) was presented since Qucs-0.0.19 unnoticed. The module name and the file name should be matching. Otherwise Qucs doesn't accept the icon file. Rename the Verilog-A file to
The Verilog-A synthesizer mentioned in this thread was developed only for Qucs-S. Unofficial Qucs-0.0.20 release doesn't include it. You can read more here https://www.researchgate.net/publication/301319998_A_new_approach_to_compact_semiconductor_device_modelling_with_Qucs_Verilog-A_analogue_module_synthesis_VERILOG-A_ANALOGUE_MODULE_SYNTHESIS I would not recommend this Verilog-A synthesizer for generating models for examples. This feature was unmaintained because of very low demand. It was developed in 2016 and nobody except Mike Brinson has used it since that time. |
As a side note, I ended up using Windows Paint 3D to edit diode.png into tunnel_diode.png. It was far easier versus GIMP or other programs I tried. The ability to copy a pixel of the desired color and then multiply in X/Y using the mouse made it easy. Any reason the tunneldiode.png in Qucs is two diodes K-K like a TVS diode, versus the "normal" tunnel diode sym used in all the examples? https://www.electronicshub.org/types-of-diodes/ |
Qucs doesn't include tunnel diode model in system libraries. I have never seen such symbol (two diodes) in Qucs. Mike always used a symbol like this for the tunnel diode. https://en.wikipedia.org/wiki/Tunnel_diode#/media/File:IEEE_315-1975_(1993)_8.5.7.1.c.svg The two K-K diodes symbol probably was assigned with the tunnel diode by mistake. |
I am also using free MSPaint clone KolourPaint from KDE environment to edit device icons. Gimp is overkill for this task. |
Yes, this symbol is wrong. It is Gunn diode, but not a tunnel diode. |
Some would consider it a Euro version of the TVS diode. Gunn doesn't generally use the center vertical line. Either way, I haven't used a Tunnel or Gunn diode in decades. ;-) |
I have implemented a generator for |
I ran into issues making separate "n" and "p" components from a "unified" Verilog model, each with it's own icon. For example I found multiple sources of "EKV26....va". The one supplied with Qucs 0.0.19 source, EKV26MOS.va is a unified model. I couldn't figure out how to make separate n and p versions with separate icons work so I made a single model using an "polarity free" icon without an "arrow". Problem is the model defaults to "n" and no parameter selections I tried would make the "p" model work. I then found three "EKV26....va" models supplied with QucStudio. EKV26nMOS.va, EKV26pMOS.va and a unified model EKV26pnMOS.va. I used EKV26nMOS.va and EKV26pMOS.va to make the two n/p versions. I didn't try EKV26pnMOS.va since I couldn't figure out how to assign the same EKV26pnMOS.va file to separate n and p versions with different icons. |
It is not possible to assign more than one symbol to one Verilog-A model. Qucs supports only one one symbol for one Verilog-A module. Adding multiple symbols support will require redesign of the Verilog-A subsystem and I dont't consider implementation of this feature in the near feature because of low demand on Verilog-A modelling with Qucs-S among the Qucs-S users. |
I have added a fix for module name and file name mismatch. Now Qucs-S should accept Verilog-A model if the file name and module name are different. This fix is availale on the |
I have upload the tunnel diode example illustrating the usage of the Verilog-A+OpenVAF |
Did you fix the tunnel diode png or use the one I created? |
The example for Ngspice+OpenVAF contains correct symbol for the tunnel diode. But I didn't fix the tunnel diode in the system devices. It is Qucsator-only device and not presented in Ngspice. I don't consider fixing such devices, because Qucsator is kept only for backward compatibility. Also Ngspice+OpenVAF will serve as the replacement for Qucsator+ADMS. |
What is the procedure to plot voltage nets/branch currents/variables that are inside the Verilog-A module? |
There is no way to output the voltage/current from inside Verilog-A module using Ngspice |
Thanks, unfortunately $display causes openvaf (23_2_0) to not compile the module
|
It's strange. The |
Probably you are getting this error, because some system C++ libraries are not installed. It's need to ask OpenVAF team on this. |
we are working on the issue at OpenVAF/SemiMod, thanks for reporting |
@ra3xdh I was able to plot both Verilog-A module internal nets and variables following the instructions at |
@bertgoz I didn't know about this feature of Verilog-A. I always used debug printing for Verilog-A models debugging. You may only use Nutmeg scripting simulation to make an output from these variables. This example https://qucs-s-help.readthedocs.io/en/latest/ASim.html#spectrum-analysis-with-ngspice-and-nutmeg-scripting could be used as a start point. It is totally outdated, because I have added a Spectrum analysis in the recent releases. But it gives an impression how to use the scripting simulation.
I am not planning to add an automatic recognition of the internal Verilog-A nodes in Qucs-S. To be honestly the debugging of the Verilog-A is not needed for 99% of users. I have more important task related to Verilog-A now. It's need to provide a way to include Verilog-A models into the Qucs-S libraries. |
I consider the tasks related to Verilog-A support using Ngspice+OSDI are done. I am not planning to add any new features related to Verilog-A in the near future. Closing this ticket as completed. |
Ngspice will deprecated ADMS and switch to OpenVAF compiler for Verilog-A models since version 39 #196 (comment) . It makes possible to implement Verilog-A devices support with Nsgpice+Qucs-S which is missing now.
The procedure for simulation of the circuit containing Verilog-A model is the same for OpenVAF and ADMS: https://mos-ak.org/venice_2014/publications/T_4_Brinson_MOS-AK_Venice_2014.pdf The schematic may need some minor correction to reflect difference between Qucsator and Ngspice.
TODO list from @ra3xdh:
N
letter in Nsgpice)*.osdi
files in auto-generated Netlist_props.json
files. These files were automatically generated by ADMS and required for proper Load module step*.va
file name are different.The text was updated successfully, but these errors were encountered: