From 934e16ab873578f2d0e461f83de82f4687448abe Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Thu, 14 Jan 2021 18:12:02 +0100 Subject: [PATCH] uniquify __UNCONNECTED_NODE__ by appending a unique number to avoid shorting multiple missing connecting nodes --- scconfig/src/scripts/find_lua.c | 1 + src/spice_netlist.c | 3 ++- src/token.c | 3 ++- src/verilog_netlist.c | 3 ++- src/vhdl_netlist.c | 1 + src/xinit.c | 1 + src/xschem.h | 1 + xschem_library/xschem_simulator/switch_level_sim.sch | 6 ++++++ 8 files changed, 16 insertions(+), 3 deletions(-) diff --git a/scconfig/src/scripts/find_lua.c b/scconfig/src/scripts/find_lua.c index 06809be4..47277cde 100644 --- a/scconfig/src/scripts/find_lua.c +++ b/scconfig/src/scripts/find_lua.c @@ -54,6 +54,7 @@ int find_script_lua(const char *name, int logdepth, int fatal) /* OS specific include dir */ if (try_icl(logdepth, "libs/script/lua", test_c, NULL, "-I/usr/include", "-llua -llualib -lm")) return 0; + if (try_icl(logdepth, "libs/script/lua", test_c, NULL, "-I/usr/include/lua5.3", "-llua5.3 -lm")) return 0; if (try_icl(logdepth, "libs/script/lua", test_c, NULL, "-I/usr/include/lua5.2", "-llua5.2 -lm")) return 0; if (try_icl(logdepth, "libs/script/lua", test_c, NULL, "-I/usr/local/include", "-llua -llualib -lm")) return 0; if (try_icl(logdepth, "libs/script/lua", test_c, NULL, "-I/usr/include", "-llua -lm")) return 0; diff --git a/src/spice_netlist.c b/src/spice_netlist.c index 11c7669c..6540f4d6 100644 --- a/src/spice_netlist.c +++ b/src/spice_netlist.c @@ -41,13 +41,14 @@ void global_spice_netlist(int global) /* netlister driver */ char cellname[PATH_MAX]; /* 20081211 overflow safe 20161122 */ char *subckt_name; + xctx->netlist_unconn_cnt=0; /* unique count of unconnected pins while netlisting */ + statusmsg("",2); /* clear infowindow */ if(xctx->modified) { save_ok = save_schematic(xctx->sch[xctx->currsch]); if(save_ok == -1) return; } free_hash(subckt_table); free_hash(model_table); - statusmsg("",2); /* clear infowindow */ record_global_node(2, NULL, NULL); /* delete list of global nodes */ top_subckt = 0; spiceprefix=1; diff --git a/src/token.c b/src/token.c index 62de8f7a..90acedc2 100644 --- a/src/token.c +++ b/src/token.c @@ -2285,7 +2285,7 @@ const char *net_name(int i, int j, int *multip, int hash_prefix_unnamed_net, int { int tmp; char errstr[2048]; - static const char unconn[]="__UNCONNECTED_PIN__"; + static char unconn[50]; char str_node[40]; /* 20161122 overflow safe */ if(xctx->inst[i].node && xctx->inst[i].node[j]!=NULL) { @@ -2330,6 +2330,7 @@ const char *net_name(int i, int j, int *multip, int hash_prefix_unnamed_net, int xctx->hilight_nets=1; } } + my_snprintf(unconn, S(unconn), "__UNCONNECTED_PIN__%d", xctx->netlist_unconn_cnt++); return unconn; } } diff --git a/src/verilog_netlist.c b/src/verilog_netlist.c index 00455a2d..cf7591d3 100644 --- a/src/verilog_netlist.c +++ b/src/verilog_netlist.c @@ -39,12 +39,13 @@ void global_verilog_netlist(int global) /* netlister driver */ struct stat buf; char *subckt_name; + xctx->netlist_unconn_cnt=0; /* unique count of unconnected pins while netlisting */ + statusmsg("",2); /* clear infowindow */ if(xctx->modified) { save_ok = save_schematic(xctx->sch[xctx->currsch]); if(save_ok == -1) return; } free_hash(subckt_table); - statusmsg("",2); /* clear infowindow */ netlist_count=0; /* top sch properties used for library use declarations and type definitions */ /* to be printed before any entity declarations */ diff --git a/src/vhdl_netlist.c b/src/vhdl_netlist.c index 5da1fcfe..ef616e77 100644 --- a/src/vhdl_netlist.c +++ b/src/vhdl_netlist.c @@ -39,6 +39,7 @@ void global_vhdl_netlist(int global) /* netlister driver */ struct stat buf; char *subckt_name; + xctx->netlist_unconn_cnt=0; /* unique count of unconnected pins while netlisting */ statusmsg("",2); /* clear infowindow */ /* top sch properties used for library use declarations and type definitions */ /* to be printed before any entity declarations */ diff --git a/src/xinit.c b/src/xinit.c index 3d1c3cf1..d0f4415f 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -416,6 +416,7 @@ void alloc_xschem_data() xctx->get_tok_size = 0; xctx->get_tok_value_size = 0; xctx->netlist_name[0] = '\0'; + xctx->netlist_unconn_cnt = 0; /* unique count of unconnected pins while netlisting */ xctx->current_dirname[0] = '\0'; for(i = 0; i < NBOXES; i++) { for(j = 0; j < NBOXES; j++) { diff --git a/src/xschem.h b/src/xschem.h index 240c1149..e840ab2f 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -571,6 +571,7 @@ typedef struct { int get_tok_value_size; char netlist_name[PATH_MAX]; char current_dirname[PATH_MAX]; + int netlist_unconn_cnt; /* unique count of unconnected pins while netlisting */ struct instpinentry *instpintable[NBOXES][NBOXES]; struct wireentry *wiretable[NBOXES][NBOXES]; struct instentry *insttable[NBOXES][NBOXES]; diff --git a/xschem_library/xschem_simulator/switch_level_sim.sch b/xschem_library/xschem_simulator/switch_level_sim.sch index 1cd83853..dc18b490 100644 --- a/xschem_library/xschem_simulator/switch_level_sim.sch +++ b/xschem_library/xschem_simulator/switch_level_sim.sch @@ -245,6 +245,10 @@ N 280 -360 390 -360 { lab=D} N 550 -400 590 -400 { lab=G} N 340 -320 390 -320 { lab=D} N 340 -360 340 -320 { lab=D} +N 1035 -1870 1200 -1870 { lab=#net29} +N 1280 -1870 1360 -1870 { lab=#net30} +N 850 -1890 910 -1890 {} +N 850 -1850 910 -1850 {} C {ipin.sym} 70 -190 0 0 { name=p20 lab=A } C {ipin.sym} 70 -150 0 0 { name=p5 lab=C } C {title.sym} 160 -30 0 0 {name=l1 author="Stefan Schippers"} @@ -405,3 +409,5 @@ C {lab_pin.sym} 780 -340 0 0 {name=p44 lab=CK3} C {inv_2.sym} 430 -320 0 0 {name=x2 VGND=VGND VNB=VNB VPB=VPB VPWR=VPWR prefix=sky130_fd_sc_hd__ } C {lab_pin.sym} 470 -320 0 1 {name=p45 lab=DN} C {lab_pin.sym} 810 -210 0 1 {name=p46 lab=DN} +C {inv_2.sym} 1240 -1870 0 0 {name=x7 VGND=VGND VNB=VNB VPB=VPB VPWR=VPWR prefix=sky130_fd_sc_hd__ } +C {nand2_1.sym} 970 -1870 0 0 {name=x6 VGND=VGND VNB=VNB VPB=VPB VPWR=VPWR prefix=sky130_fd_sc_hd__ }