From a10cb2c429975575d97f7e3a4ace4ce2105ed859 Mon Sep 17 00:00:00 2001 From: Stefan Schippers Date: Tue, 6 Oct 2020 16:19:52 +0200 Subject: [PATCH] added warnings (Options -> Show info window) if components are missing a name=... attribute / if symbols are missing a type=... attribute; eliminated usage of tcl "file normalize..." statements to avoid symlink dereferencing (if using symlinked libraries), aligned version/file_version tags in support awk scripts --- src/actions.c | 1 - src/gschemtoxschem.awk | 7 ++++--- src/hilight.c | 5 +++-- src/make_sym.awk | 2 +- src/netlist.c | 25 +++++++++++++++++++++++-- src/spice_netlist.c | 3 +-- src/tedax_netlist.c | 1 + src/verilog_netlist.c | 1 + src/vhdl_netlist.c | 1 + src/xinit.c | 12 ++++-------- src/xschem.tcl | 13 +++++++++---- src/xschemrc | 9 ++------- 12 files changed, 50 insertions(+), 30 deletions(-) diff --git a/src/actions.c b/src/actions.c index 98b9670e..418af1c4 100644 --- a/src/actions.c +++ b/src/actions.c @@ -1074,7 +1074,6 @@ void descend_schematic(int instnumber) int inst_mult, inst_number; int save_ok = 0; - rebuild_selected_array(); if(lastselected !=1 || selectedgroup[0].type!=ELEMENT) { diff --git a/src/gschemtoxschem.awk b/src/gschemtoxschem.awk index a4ae9b24..c96bec4e 100755 --- a/src/gschemtoxschem.awk +++ b/src/gschemtoxschem.awk @@ -387,7 +387,7 @@ function print_header() "device @name @device\n" \ "@comptag\"\n" } - print "v {xschem version=2.9.7 file_version=1.1}" + print "v {xschem version=2.9.8 file_version=1.2}" template_attrs = "template=\"" template_attrs "\"\n" if(FILENAME ~/\.sym$/) { @@ -397,16 +397,17 @@ function print_header() } else { global_attrs = "type=symbol\n" global_attrs } - print "G {" global_attrs template_attrs tedax_attrs spice_attrs + print "K {" global_attrs template_attrs tedax_attrs spice_attrs if(extra) { print extra print extra_pinnumber } print "}" } else { - print "G {}" + print "K {}" } + print "G {}" print "V {}" print "S {}" print "E {}" diff --git a/src/hilight.c b/src/hilight.c index 70957562..174b3ef5 100644 --- a/src/hilight.c +++ b/src/hilight.c @@ -1091,8 +1091,9 @@ void print_hilight_net(int show) /* 20170323 this delete_netlist_structs is necessary, without it segfaults when going back (ctrl-e) */ /* from a schematic after placing pins (ctrl-j) and changing some pin direction (ipin -->iopin) */ - prepared_hilight_structs=0; /* 20171212 */ - prepared_netlist_structs=0; /* 20171212 */ + prepared_hilight_structs=0; + prepared_netlist_structs=0; + /* delete_netlist_structs(); */ my_free(781, &filetmp1); my_free(782, &filetmp2); diff --git a/src/make_sym.awk b/src/make_sym.awk index c38eeb34..9716a10e 100755 --- a/src/make_sym.awk +++ b/src/make_sym.awk @@ -68,7 +68,7 @@ function beginfile(f) text_voffset=20 lab_voffset=4 ip=op=n_pin=0 - print "v {xschem version=2.9.7 file_version=1.1}" > sym + print "v {xschem version=2.9.8 file_version=1.2}" > sym if(template=="") { printf "%s", "K {type=subcircuit\nformat=\"@name @pinlist @symname\"\n" >sym printf "%s\n", "template=\"name=x1\"" >sym diff --git a/src/netlist.c b/src/netlist.c index 27e58769..34d96dec 100644 --- a/src/netlist.c +++ b/src/netlist.c @@ -627,10 +627,15 @@ void prepare_netlist_structs(int for_netlist) char *class=NULL; char *global_node=NULL; int inst_mult, pin_mult; + int print_erc; + static int startlevel = 0; if (for_netlist>0 && prepared_netlist_structs) return; /* 20160413 */ else if (!for_netlist && prepared_hilight_structs) return; /* 20171210 */ else delete_netlist_structs(); + if(netlist_count == 0 ) startlevel = currentsch; + print_erc = netlist_count == 0 || startlevel < currentsch; + if (for_netlist>0) { my_snprintf(nn, S(nn), "-----------%s", schematic[currentsch]); statusmsg(nn,2); @@ -662,6 +667,20 @@ void prepare_netlist_structs(int for_netlist) if (inst_ptr[i].ptr<0) continue; my_strdup(248, &type,(inst_ptr[i].ptr+instdef)->type); /* 20150409 */ + if(print_erc && (!inst_ptr[i].instname || !inst_ptr[i].instname[0]) ) { + char str[2048]; + my_snprintf(str, S(str), "instance: %d (%s): no name attribute set", i, inst_ptr[i].name); + statusmsg(str,2); + inst_ptr[i].flags |=4; + hilight_nets=1; + } + if(print_erc && (!type || !type[0]) ) { + char str[2048]; + my_snprintf(str, S(str), "Symbol: %s: no type attribute set", inst_ptr[i].name); + statusmsg(str,2); + inst_ptr[i].flags |=4; + hilight_nets=1; + } if(type && inst_ptr[i].node && IS_LABEL_OR_PIN(type) ) { /* instance must have a pin! */ if (for_netlist>0) { /* 20150918 skip labels / pins if ignore property specified on instance */ @@ -983,8 +1002,10 @@ void prepare_netlist_structs(int for_netlist) } /* end for(i...) */ /*---------------------- */ rebuild_selected_array(); - if (for_netlist>0) prepared_netlist_structs=1; - else prepared_hilight_structs=1; + if (for_netlist>0) { + prepared_netlist_structs=1; + prepared_hilight_structs=1; + } else prepared_hilight_structs=1; my_free(835, &dir); my_free(836, &type); diff --git a/src/spice_netlist.c b/src/spice_netlist.c index 7fda8118..7a5f33ce 100644 --- a/src/spice_netlist.c +++ b/src/spice_netlist.c @@ -197,10 +197,8 @@ void global_spice_netlist(int global) /* netlister driver */ prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */ /* symbol vs schematic pin check, we do it here since now we have ALL symbols loaded */ sym_vs_sch_pins(); - /* restore hilight flags from errors found analyzing top level before descending hierarchy */ for(i=0;i