ra3xdh / qucs_s

Qucs-S is a circuit simulation program with Qt-based GUI
https://ra3xdh.github.io/
GNU General Public License v2.0
836 stars 107 forks source link

ngspice compatible Library of Digital components for mixed signal simulations #900

Open tomhajjar opened 3 weeks ago

tomhajjar commented 3 weeks ago

Updated symbol cosmetics: 8/26/24 Updated Trainline_Driver_prj 9/03/24

Is there any thought about adding an ngspice compatible digital library? ngspice is compatible with PSpice/MicroCap digital libraries.

I spent a lot of time testing mixed signal simulations mixing analog and digital components. Attached are three projects. First tests digital models, 2nd tests some TI "Transient/Behavioral" digital models and the 3rd is a mixed analog-digital simulation of a Locomotive Trainline Driver.

2024-08-21_205334 2024-08-22_191803 2024-08-21_210417

Digital_Latch_prj.zip Digital_Analog_Mixed_prj.zip Trainline_Driver_prj.zip

tomhajjar commented 3 weeks ago

The Digital Library(s) could be differentiated by the source of the Spice models.

The first Library would be derived from "MicroCap_dig000.lib". Examples of using this library to make models should be given so we wouldn't need to make every 74XX, 74HCXX, 74SXX...etc device. I have made a number of devices. All require "set ngbehavior=psa"

The guys at ngspice converted 5 devices from the LTSpice digital libraries into XSPICE devices and named it "74HCng_gates.lib". It would require a massive amount of work to convert all the devices in the the LTSpice digital libraries.

The late Jim Thompson created "Digital_Behavioral.lib". We could use these 11 devices (normalized vcc=1) in another library. Jim also created a number of other models.

Unfortunately TI made few "Transient/Behavioral" digital models so the Library would be small. So far I have tested 5 of them.

tomhajjar commented 3 weeks ago

Updated symbol cosmetics: 8/26/24

First cut at a Digital Library based on "MicroCap_dig000.lib". I added Requirements to the Show model window. I need suggestions of additional devices to add to the Library.

2024-08-22_200006 2024-08-22_200622

Digital_Library_1_prj.zip

ra3xdh commented 2 weeks ago

Thanks! I will evaluate the libraries and post feedback in the next few days. At least MicrCAP 74HC library may be included in the next release. It's need at least to add a few ICs the most commonly used in analog circuits.

The best 74HC library for analog simulation mode would be this one: https://github.com/texane/power_inverter/blob/master/ltspice/logic/74hc/74hc.lib This library contains not a simple delay-type model, but a full transistor level I/O buffer schematic model. Unfortunately it contains incompatible LTspice extension for represent the logic gate. This library requires significant effort to be ported to Ngspice. I don't consider this to be done by current development team. This task is not complex, but time consuming.

tomhajjar commented 2 weeks ago

74HCng_short_2.lib in the ngspice examples is a conversion of 5 devices in 74hc.lib. The conversion doesn't include a full transistor level I/O buffer schematic model.

tomhajjar commented 2 weeks ago

The following MicroCap Digital Libraries are included in "Digital_Analog_Mixed_prj.zip". We need to choose what devices should be made into Qucs-S Libraries. Presently "Digital_Library_1.lib" only has eight 74HC devices.

MicroCap_dig000.lib MicroCap_74lv.lib MicroCap_cmos.lib MicroCap_ecl.lib

Back in the day ECL and CMOS gates devices were used as Analog components.