{"action":"created","issue":{"url":"https://api.github.com/repos/cliffordwolf/yosys/issues/169","repository_url":"https://api.github.com/repos/cliffordwolf/yosys","labels_url":"https://api.github.com/repos/cliffordwolf/yosys/issues/169/labels{/name}","comments_url":"https://api.github.com/repos/cliffordwolf/yosys/issues/169/comments","events_url":"https://api.github.com/repos/cliffordwolf/yosys/issues/169/events","html_url":"https://github.com/cliffordwolf/yosys/issues/169","id":155576373,"number":169,"title":"write_spice: ngspice SEGFAULTS on seeing `=' in .SUBCKT name","user":{"login":"klammerj","id":2139773,"avatar_url":"https://avatars.githubusercontent.com/u/2139773?v=3","gravatar_id":"","url":"https://api.github.com/users/klammerj","html_url":"https://github.com/klammerj","followers_url":"https://api.github.com/users/klammerj/followers","following_url":"https://api.github.com/users/klammerj/following{/other_user}","gists_url":"https://api.github.com/users/klammerj/gists{/gist_id}","starred_url":"https://api.github.com/users/klammerj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klammerj/subscriptions","organizations_url":"https://api.github.com/users/klammerj/orgs","repos_url":"https://api.github.com/users/klammerj/repos","events_url":"https://api.github.com/users/klammerj/events{/privacy}","received_events_url":"https://api.github.com/users/klammerj/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-18T18:58:01Z","updated_at":"2016-05-20T18:22:22Z","closed_at":"2016-05-20T14:47:13Z","body":"This seems the bit of spice that causes it:\r\n```\r\n.SUBCKT _paramod_ramp_bits=5 clk rst ctr.0 ctr.1 ctr.2 ctr.3 ctr.4\r\nX0 ctr.0 1.0 NOT\r\nX1 ctr.1 ctr.0 2 NAND\r\nX2 2 3 NOT\r\nX3 ctr.1 ctr.0 4 NOR\r\nX4 4 3 1.1 NOR\r\nX5 ctr.2 5 NOT\r\nX6 2 5 6 NOR\r\nX7 3 ctr.2 7 NOR\r\nX8 7 6 1.2 NOR\r\nX9 6 ctr.3 8 NOR\r\nX10 ctr.3 ctr.2 9 NAND\r\nX11 9 2 10 NOR\r\nX12 10 8 1.3 NOR\r\nX13 10 ctr.4 11 NOR\r\nX14 ctr.4 12 NOT\r\nX15 6 ctr.3 13 NAND\r\nX16 13 12 14 NOR\r\nX17 14 11 1.4 NOR\r\nX18 clk 1.0 ctr.0 0s rst DFFSR\r\nX19 clk 1.1 ctr.1 0s rst DFFSR\r\nX20 clk 1.2 ctr.2 0s rst DFFSR\r\nX21 clk 1.3 ctr.3 0s rst DFFSR\r\nX22 clk 1.4 ctr.4 0s rst DFFSR\r\n.ENDS _paramod_ramp_bits_5\r\n```\r\n(it originates from a parameterized verilog module...)\r\nchanging to:\r\n.SUBCKT _paramod_ramp_bits_5 clk rst ctr.0 ctr.1 ctr.2 ctr.3 ctr.4\r\n...works\r\n\r\nhere's some gdb output...\r\n```\r\nProgram received signal SIGSEGV, Segmentation fault.\r\n0xb79741c9 in __GI_strcmp (p1=0x0, p2=0xbfffdec7 \"not\") at strcmp.c:34\r\n34      strcmp.c: No such file or directory.\r\n(gdb) bt\r\n#0  0xb79741c9 in __GI_strcmp (p1=0x0, p2=0xbfffdec7 \"not\") at strcmp.c:34\r\n#1  0x08091655 in numnodes (name=0x87b6638 \"x0 clk inv not\", subs=0x87b6560, modnames=0x87b5f68)\r\n    at ../../../src/frontend/subckt.c:1486\r\n#2  0x08090ce8 in translate (deck=0x8789620,.\r\n    formal=0x87b6508 \"clk inv nrst cmp1 bits1 lo1 hi1 cmp2 bits2 lo2 hi2 cmp3 bits3 hi3 cmp4 bits4 hi4\",.\r\n[...]\r\n\r\n(gdb) frame 1\r\n#1  0x08091655 in numnodes (name=0x87b6638 \"x0 clk inv not\", subs=0x87b6560, modnames=0x87b5f68)\r\n    at ../../../src/frontend/subckt.c:1486\r\n1486                if (eq(sss->su_name, s))\r\n(gdb) list 1486\r\n1481                *s-- = '\\0';\r\n1482            while ((*s != ' ') && (*s != '\\t'))\r\n1483                s--;\r\n1484            s++;\r\n1485            for (sss = subs; sss; sss = sss->su_next)\r\n1486                if (eq(sss->su_name, s))\r\n1487                    return (sss->su_numargs);\r\n1488            /*\r\n1489             * number of nodes not known so far.\r\n1490             * lets count the nodes ourselves,\r\n(gdb) p subs\r\n$1 = (struct subs *) 0x87b6560\r\n(gdb) p *subs\r\n$2 = {su_name = 0x87b6578 \"s_d\", su_args = 0x87b6588 \"clk rst cmp bit q.0 q.1 q.2 q.3 q.4 q.5\",.\r\n  su_numargs = 10, su_def = 0x8789658, su_next = 0x87ad898}\r\n(gdb) p *sss\r\n$3 = {su_name = 0x0, su_args = 0x87b64b8 \"\", su_numargs = 0, su_def = 0x879b148, su_next = 0x87ad288}\r\n(gdb) p *subs->su_next\r\n$4 = {su_name = 0x87ad3f0 \"ramp\", su_args = 0x87ad8b0 \"clk rst ctr.0 ctr.1 ctr.2 ctr.3 ctr.4 ctr.5\",.\r\n  su_numargs = 8, su_def = 0x8788ee8, su_next = 0x87ad3c8}\r\n(gdb) p *subs->su_next->su_next\r\n$5 = {su_name = 0x87ad3e0 \"dtg\", su_args = 0x87ad880 \"clk rst d a b\", su_numargs = 5, su_def = 0x8788ca8,.\r\n  su_next = 0x87ad3b0}\r\n(gdb) p *subs->su_next->su_next->su_next\r\n$6 = {su_name = 0x87ad5a0 \"a\",.\r\n  su_args = 0x87b6508 \"clk inv nrst cmp1 bits1 lo1 hi1 cmp2 bits2 lo2 hi2 cmp3 bits3 hi3 cmp4 bits4 hi4\",.\r\n  su_numargs = 17, su_def = 0x8787178, su_next = 0x87ad398}\r\n(gdb) p *subs->su_next->su_next->su_next->su_next\r\n$7 = {su_name = 0x0, su_args = 0x87b64b8 \"\", su_numargs = 0, su_def = 0x879b148, su_next = 0x87ad288}\r\n\r\n[...]\r\n\r\n(gdb) p *sss->su_def\r\n$16 = {li_linenum = 55, li_linenum_orig = 0, li_line = 0x87ad5b0 \"*param  _paramod_ramp_bits=5\",.\r\n  li_error = 0x0, li_next = 0x8786ba8, li_actual = 0x0}\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/cliffordwolf/yosys/issues/comments/220681758","html_url":"https://github.com/cliffordwolf/yosys/issues/169#issuecomment-220681758","issue_url":"https://api.github.com/repos/cliffordwolf/yosys/issues/169","id":220681758,"user":{"login":"klammerj","id":2139773,"avatar_url":"https://avatars.githubusercontent.com/u/2139773?v=3","gravatar_id":"","url":"https://api.github.com/users/klammerj","html_url":"https://github.com/klammerj","followers_url":"https://api.github.com/users/klammerj/followers","following_url":"https://api.github.com/users/klammerj/following{/other_user}","gists_url":"https://api.github.com/users/klammerj/gists{/gist_id}","starred_url":"https://api.github.com/users/klammerj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klammerj/subscriptions","organizations_url":"https://api.github.com/users/klammerj/orgs","repos_url":"https://api.github.com/users/klammerj/repos","events_url":"https://api.github.com/users/klammerj/events{/privacy}","received_events_url":"https://api.github.com/users/klammerj/received_events","type":"User","site_admin":false},"created_at":"2016-05-20T18:22:22Z","updated_at":"2016-05-20T18:22:22Z","body":"There does not seem to be any documentation in their ngspice.pdf manual about what constitutes a valid subcircuit identifier, so I can't really tell either.....\r\nTheir parser is handwritten spaghetti-style and there seems preprocessing to be going on in there. \r\nthey allow key=value pairs in subckt definitions, and I think that part gets it wrong...\r\n```\r\n2.8.3 Subcircuit parameters\r\nGeneral form:\r\n.subckt <identn> node node . . . <ident>=<value> <ident>=<value> . . .\r\n```"}}
{"actor":{"display_login":"klammerj"}}