Commit Graph

55 Commits

Author SHA1 Message Date
Brian Taylor 048dcb3bf1 Go back to before previous merge. 2024-04-03 17:12:57 +02:00
Brian Taylor db4476d22b Remove unnecessary #include. 2024-04-03 17:12:50 +02:00
Brian Taylor 367cdf5708 Add variable ps_scan_gates_optimize (default 1). If < 1, then turn off the optimizations in scan_gates. 2024-04-03 17:12:43 +02:00
Brian Taylor c3fa6328a1 Fix bug in the LOGICEXP scan_gates optimizer. Some gates with an inverting output were generated with bad logic which gave incorrect simulation results. 2024-03-29 17:29:49 +01:00
Brian Taylor 715ce8c809 Return correct error statuses. Detect another illegally placed gate operator in an infix expression. 2024-03-15 21:53:13 +01:00
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. 2024-03-11 22:25:48 +01:00
Brian Taylor ae8e423d97 Add WARNINGs when there are potential name collisions, and identify the possible name. 2024-03-11 22:25:39 +01:00
Brian Taylor 4c983e9133 Remove old dead code. 2024-02-23 14:06:39 +01:00
Brian Taylor 8788ce3504 Add check for a trailing } in a logicexp statement. 2024-02-23 14:06:28 +01:00
Brian Taylor 826401f6a4 Add error detection and reporting for invalid infix expressions. 2024-02-23 14:06:17 +01:00
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. 2024-02-13 10:11:28 +01:00
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. 2024-01-17 14:15:07 +01:00
dwarning 4368790c5d remove compiler warning wrt. prototypes 2023-09-11 14:50:27 +02:00
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. 2023-09-09 23:22:06 +02:00
Brian Taylor 4d8b105b86 Simplify expression nesting depth. 2023-07-15 11:34:09 +02:00
Brian Taylor 8c69ada5b5 The logicexp example in the PSpice ref. manual has a name with a '+' character (LCN+4). Update lexer_scan. 2023-03-22 14:26:43 +01:00
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. 2023-03-22 14:26:18 +01:00
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. 2023-03-22 14:25:51 +01:00
Brian Taylor 4111aaf110 When logicexp has a ugate timing model other than d0_gate, use its delays for an inverter or buffer. 2023-03-18 14:36:45 +01:00
Brian Taylor 3a76a1ef52 Prepare for inertial_delay model parameter. 2023-03-18 14:36:17 +01:00
Brian Taylor 8dd16feee4 Use dstrings where fixed size char buffers should not have been used. 2023-03-18 14:32:31 +01:00
Brian Taylor 3365fd4309 Remove dead code. 2023-03-18 14:32:19 +01:00
Brian Taylor 56d0c72924 Add port directions when logicexp or pindly are present. 2023-02-01 17:39:37 +01:00
Brian Taylor dcfe4e7134 ERROR messages should be printed to stderr. 2023-01-15 13:37:42 +01:00
Brian Taylor a76f8d5149 Fix some comments. 2023-01-09 16:33:25 +01:00
Brian Taylor 6117836d01 Ensure that amatch output is not binary data. 2023-01-09 16:30:22 +01:00
Brian Taylor 5e6452099e Return errors from f_logicexp and f_pindly without calling exit. 2023-01-09 16:29:08 +01:00
Brian Taylor 0a3cdf8e3a Add more error checks for f_logicexp and f_pindly. 2023-01-09 16:28:43 +01:00
Brian Taylor fe52771aff Remove the old inverter code. 2022-12-27 14:21:05 +01:00
Brian Taylor 3578deda80 Refactor new_gen_output_models. 2022-12-27 14:20:43 +01:00
Brian Taylor 929d1f5190 Added xor/xnor for logicexp timing models. 2022-12-11 15:34:56 +01:00
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. 2022-12-11 15:34:33 +01:00
Brian Taylor 1511214874 Add more debug instrumentation. 2022-12-11 15:31:09 +01:00
Brian Taylor fe733a8ca2 Use tilde '~' inputs instead of creating inverters. 2022-12-11 15:30:41 +01:00
Brian Taylor 9932a78e39 Add safety braces. 2022-12-11 15:26:42 +01:00
Brian Taylor 5726c9ff0b Tidy up debug tracing code. 2022-12-11 15:26:16 +01:00
Brian Taylor aa2f3b7bbb Fix memory leaks. 2022-12-11 15:25:52 +01:00
Brian Taylor 4294f49968 Add more vectors to behavioral 283 circuit. Add tristate buffer circuit which shows glitches until inertial delays are implemented. 2022-12-11 15:25:24 +01:00
Brian Taylor cefa6b380c When the gen_tab has only one entry, do not call optimize_gen_tab, it is not necessary. 2022-12-11 15:25:00 +01:00
Brian Taylor 029df5a3d6 Check that the bparse gen_tab optimization loop finishes when no more improvements occur. 2022-12-11 15:24:35 +01:00
Brian Taylor aff20b9db1 Remove asserts, replace fixed size lexer_buf. 2022-12-11 15:21:09 +01:00
Brian Taylor d54c1fc091 Add pindly tristate example. Cleanup error handling. 2022-12-11 15:20:27 +01:00
Brian Taylor 0627af435a Remove most asserts. 2022-12-11 15:20:03 +01:00
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. 2022-12-11 15:19:39 +01:00
Brian Taylor 4e76586b6b Reduce the delays of 'zero' delay gates to 1.0e-11. Add decoder test for logicexpr and pindly. 2022-12-11 15:19:17 +01:00
Brian Taylor 13c01abf0d Fix a typo, add more comments. 2022-12-11 15:18:52 +01:00
Brian Taylor 68f0d49f58 Add support for TRISTATE: in PINDLY. 2022-12-11 15:18:32 +01:00
Brian Taylor 363179ce2f Fix potential memory leak, clean out debug code. 2022-12-11 15:18:12 +01:00
Brian Taylor 499bef097e Better estimates of rise/fall delays in PINDLYs with outputs separated by CASE. 2022-12-11 15:17:51 +01:00
Brian Taylor a01edf2f36 Fix visualc compiler warnings. 2022-12-11 15:17:33 +01:00