57 Commits (6500caeba170e821dcf3fc7c3f6d6cb7e7094acb)

Author SHA1 Message Date
Brian Taylor 6500caeba1 Now that checks on actuals and formals have been fixed for X* instances, some older PSpice libraries will not translate correctly in psa mode. This commit removes unnecessary power and ground nodes from X* instances of subcircuits where the nodes are optional. These X* instances occur within the body of another subcircuit which is being translated. MicroCap libraries that we can translate in ngspice do not have such cases. To enable the removal of the power and ground nodes, set ps_global_tmodels=1 in .spiceinit. This is not set by default since an extra pass through the circuit word list is necessary to find the subcircuits whose instances do not require power and ground node removal. Without enabling this feature, errors reporting too many parameters may be reported. 1 year ago
Brian Taylor d002ba353b Fix scan_gates to consider correctly gates with an inverted output. Refactor the checks in infix_to_postfix for invalid postfix expressions. 2 years ago
Brian Taylor 0ec0c92eae Go back to before previous merge. 2 years ago
Brian Taylor 31ed74041f Remove unnecessary #include. 2 years ago
Brian Taylor 57048228e9 Add variable ps_scan_gates_optimize (default 1). If < 1, then turn off the optimizations in scan_gates. 2 years ago
Brian Taylor 292f7ad60a Fix bug in the LOGICEXP scan_gates optimizer. Some gates with an inverting output were generated with bad logic which gave incorrect simulation results. 2 years ago
Brian Taylor 715ce8c809 Return correct error statuses. Detect another illegally placed gate operator in an infix expression. 2 years ago
Brian Taylor 14bf034f28 The lexer incorrectly treats a single '_' '-' '/' as an identifier. The counter used for tmp__ names should be incremented after use. The infix_to_postfix converter now has more checks for invalid infix expressions in LOGICEXP constructs. Without these checks the evaluation of the generated postfix could silently create bad gates which would load but simulate incorrectly. All MicroCap and PSpice libraries and QEI.cir pass their tests. 2 years ago
Brian Taylor ae8e423d97 Add WARNINGs when there are potential name collisions, and identify the possible name. 2 years ago
Brian Taylor 4c983e9133 Remove old dead code. 2 years ago
Brian Taylor 8788ce3504 Add check for a trailing } in a logicexp statement. 2 years ago
Brian Taylor 826401f6a4 Add error detection and reporting for invalid infix expressions. 2 years ago
Brian Taylor e01290c9a2 Replace the logicexp parser with infix to postfix translation followed by evaluating the postfix. logicexp.c is now shorter and easier to understand and maintain. Also, operator precedence expression parsing conforms to the PSPICE rules. Thus, a & b | c is understood to mean (a & b) | c, for example. 2 years ago
Brian Taylor a70297e87a Several PSPICE 9.1 evaluation digital libraries contain timing .model statements at the global level for subckts with U* instances that reference those models. By specifying "set ps_global_tmodels=1" in .spiceinit an extra pass inside u_instances() will collect those global timing models for use in subckts. Report errors detected when ngspice parses a LOGICEXP but has not added support for operator precendence. Include a hint of how to fix those errors by inserting parentheses. This error only occurs in 10 of 585 cases in the libraries. Note that inpcompat.c has been saved as a unix filetype. 2 years ago
dwarning 4368790c5d remove compiler warning wrt. prototypes 3 years ago
Brian Taylor 492bb64d92 By default, use the shortest typical delay estimate. This makes the digi_74LS90_74LS42.cir testcase for bug641 behave almost the same as MicroCap 12. In ngspice and MicroCap, the only signal with a glitch is not_y8. The other not_* signals look the same. Setting ps_use_mntymx in .spiceinit will change the delay estimates. See the function set_u_devices_info in src/frontend/udevices.c for the various settings of ps_use_mntymx. 3 years ago
Brian Taylor 4d8b105b86 Simplify expression nesting depth. 3 years ago
Brian Taylor 8c69ada5b5 The logicexp example in the PSpice ref. manual has a name with a '+' character (LCN+4). Update lexer_scan. 3 years ago
Brian Taylor 40a540a2ff Add inertial_delay=true to .model statements generated when U* instances in PSpice library subckts are translated to Xspice. Any other Xspice A* digital instances might have different inertial_delay settings in their models, so potentially there could be a mixture of delay types. For example, if a user wishes to model a DLYLINE using a d_buffer with inertial_delay=false and equal rise/fall delays. 3 years ago
Brian Taylor 164db58404 The intent now is to rely on a variable setting in .spiceinit to control the use of inertial delay XSPICE digital models. This will apply to U* instances in subcircuits which are translated to XSPICE. 3 years ago
Brian Taylor 4111aaf110 When logicexp has a ugate timing model other than d0_gate, use its delays for an inverter or buffer. 3 years ago
Brian Taylor 3a76a1ef52 Prepare for inertial_delay model parameter. 3 years ago
Brian Taylor 8dd16feee4 Use dstrings where fixed size char buffers should not have been used. 3 years ago
Brian Taylor 3365fd4309 Remove dead code. 3 years ago
Brian Taylor 56d0c72924 Add port directions when logicexp or pindly are present. 3 years ago
Brian Taylor dcfe4e7134 ERROR messages should be printed to stderr. 3 years ago
Brian Taylor a76f8d5149 Fix some comments. 3 years ago
Brian Taylor 6117836d01 Ensure that amatch output is not binary data. 3 years ago
Brian Taylor 5e6452099e Return errors from f_logicexp and f_pindly without calling exit. 3 years ago
Brian Taylor 0a3cdf8e3a Add more error checks for f_logicexp and f_pindly. 3 years ago
Brian Taylor fe52771aff Remove the old inverter code. 3 years ago
Brian Taylor 3578deda80 Refactor new_gen_output_models. 3 years ago
Brian Taylor 929d1f5190 Added xor/xnor for logicexp timing models. 3 years ago
Brian Taylor 7ff8f3773f Handle cases where logicexp has a timing model but no pindly. This is rare, only 22 tests from the digital libraries. Move digital examples, add missing .spiceint file. 3 years ago
Brian Taylor 1511214874 Add more debug instrumentation. 3 years ago
Brian Taylor fe733a8ca2 Use tilde '~' inputs instead of creating inverters. 3 years ago
Brian Taylor 9932a78e39 Add safety braces. 3 years ago
Brian Taylor 5726c9ff0b Tidy up debug tracing code. 3 years ago
Brian Taylor aa2f3b7bbb Fix memory leaks. 3 years ago
Brian Taylor 4294f49968 Add more vectors to behavioral 283 circuit. Add tristate buffer circuit which shows glitches until inertial delays are implemented. 3 years ago
Brian Taylor cefa6b380c When the gen_tab has only one entry, do not call optimize_gen_tab, it is not necessary. 3 years ago
Brian Taylor 029df5a3d6 Check that the bparse gen_tab optimization loop finishes when no more improvements occur. 3 years ago
Brian Taylor aff20b9db1 Remove asserts, replace fixed size lexer_buf. 3 years ago
Brian Taylor d54c1fc091 Add pindly tristate example. Cleanup error handling. 3 years ago
Brian Taylor 0627af435a Remove most asserts. 3 years ago
Brian Taylor b142be7fde Add behavioral (LOGICEXP, PINDLY) test for 283 circuit. There are glitches in the simulation for some of the s* outputs. Probably due to not having inertial delays. And why not set 'zero' delays as close to zero as permitted by XSPICE. 3 years ago
Brian Taylor 4e76586b6b Reduce the delays of 'zero' delay gates to 1.0e-11. Add decoder test for logicexpr and pindly. 3 years ago
Brian Taylor 13c01abf0d Fix a typo, add more comments. 3 years ago
Brian Taylor 68f0d49f58 Add support for TRISTATE: in PINDLY. 3 years ago
Brian Taylor 363179ce2f Fix potential memory leak, clean out debug code. 3 years ago