improved "xschem display_hilights [nets|instances]" that displays highlight nets or instaces or both,with full hierarchy path, not including uninteresting net/pin/net_show elements.

This commit is contained in:
stefan schippers 2023-05-23 09:10:01 +02:00
parent 1774ff4e3a
commit 32460f33c9
8 changed files with 1996 additions and 1941 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Xschem" Language="1033" Version="3.1.2" Manufacturer="Xschem" UpgradeCode="0deb9c17-cbbd-491c-be3e-24446b27ccd5">
<Product Id="*" Name="Xschem" Language="1033" Version="3.4.0" Manufacturer="Xschem" UpgradeCode="0deb9c17-cbbd-491c-be3e-24446b27ccd5">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<WixVariable Id="WixUILicenseRtf"
Value="License.rtf" />

File diff suppressed because it is too large Load Diff

View File

@ -60,6 +60,9 @@
<Component Id="cmp41894FA8F8DE5B9A1B24E5C840E37F54" Guid="{21E36D80-FA79-4ED7-8D0D-E9C04070E0AE}">
<File Id="fil7D307809F11134C2D8C476594BC37391" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\devices\bus_connect_nolab.sym" />
</Component>
<Component Id="cmpCB32699928F7C0FA155C7E2382EB51D6" Guid="{9EAF660E-A261-4503-9D90-8320E9E0A304}">
<File Id="fil2C380CB36B276A572B8C027780D6AA72" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\devices\bus_tap.sym" />
</Component>
<Component Id="cmp30AC1847DBF415B72E23DB678216480F" Guid="{14B2FA83-713B-4E6B-9130-511BC1BFE8C9}">
<File Id="fil7FA35E290A073B1C7608A00F26B2B6C6" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\devices\capa-2.sym" />
</Component>
@ -617,6 +620,12 @@
<Component Id="cmpAEF56BDB09D122243A6EAE07734B3F38" Guid="{3832BB54-5B22-4FCF-BFCE-AA9F5F4D0293}">
<File Id="filF8FB9273C9701B1D5629728BB87CEAFD" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\examples\test_backannotated_subckt.sym" />
</Component>
<Component Id="cmp3E5A61075EFE07AAAD0E62A0477B4DD3" Guid="{CEEB9712-C68F-49BE-98AF-9DD943C63BFB}">
<File Id="fil8D645B0D232FE299FF0894BCF88DEA48" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\examples\test_bus_tap.sch" />
</Component>
<Component Id="cmp281B55312D993BEEFB25763697514596" Guid="{A5CE7786-37F3-4DAD-8699-1C3B9BECD53B}">
<File Id="filA34D170BB279E05BEE62810E66B39E60" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\examples\test_bus_tap.sym" />
</Component>
<Component Id="cmp1CB191EAD2BF728BA3BBB51212CD9247" Guid="{69C694D5-5DD4-4A22-994C-6A3580F442B4}">
<File Id="fil58F186B07EB593663AEED328B4D974F3" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\examples\test_doublepin.sch" />
</Component>
@ -5507,6 +5516,7 @@
<ComponentRef Id="cmp8B38271A0A2367D71EF3F44B18F002CB" />
<ComponentRef Id="cmpD042A22D0CFCBF4CF2BE08A941DD8077" />
<ComponentRef Id="cmp41894FA8F8DE5B9A1B24E5C840E37F54" />
<ComponentRef Id="cmpCB32699928F7C0FA155C7E2382EB51D6" />
<ComponentRef Id="cmp30AC1847DBF415B72E23DB678216480F" />
<ComponentRef Id="cmp0E38139402C0C87A2A3F6AB22A083FF3" />
<ComponentRef Id="cmp6D02DB00008F7CB292CC4AA72D0065C7" />
@ -5692,6 +5702,8 @@
<ComponentRef Id="cmpFE3AD86DCDB95AEE8C922AF6F1910FC1" />
<ComponentRef Id="cmp0F886DAEE595168D462438D292C5868D" />
<ComponentRef Id="cmpAEF56BDB09D122243A6EAE07734B3F38" />
<ComponentRef Id="cmp3E5A61075EFE07AAAD0E62A0477B4DD3" />
<ComponentRef Id="cmp281B55312D993BEEFB25763697514596" />
<ComponentRef Id="cmp1CB191EAD2BF728BA3BBB51212CD9247" />
<ComponentRef Id="cmp67FF7D4EB6E699EEC0A31BF183FA828E" />
<ComponentRef Id="cmpC16AA3364EC55046BA68DBB76C8ED4BB" />

View File

@ -558,7 +558,10 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
instance number to descend into for vector instances (default: 0). </pre>
<li><kbd> descend_symbol</kbd></li><pre>
Descend into the symbol view of selected component instance </pre>
<li><kbd> display_hilights</kbd></li><pre>
<li><kbd> display_hilights [nets|instances]</kbd></li><pre>
Print a list of highlighted objects (nets, net labels/pins, instances)
if 'instances' is specified list only instance highlights
if 'nets' is specified list only net highlights </pre>
Print a list of highlighted objects (nets, net labels/pins, instances) </pre>
<li><kbd> draw_graph [n] [flags]</kbd></li><pre>
Redraw graph rectangle number 'n'.

View File

@ -128,15 +128,20 @@ static Hilight_hashentry *hilight_hash_lookup(const char *token, int value, int
}
/* wrapper function to hash highlighted instances, avoid clash with net names */
Hilight_hashentry *inst_hilight_hash_lookup(const char *token, int value, int what)
Hilight_hashentry *inst_hilight_hash_lookup(int i, int value, int what)
{
const char *token = xctx->inst[i].instname;
char *inst_tok = NULL;
size_t len = strlen(token) + 2; /* token plus one more character and \0 */
int label = 0;
Hilight_hashentry *entry;
if(IS_LABEL_SH_OR_PIN( (xctx->inst[i].ptr+xctx->sym)->type )) label = 1;
dbg(1, "inst_hilight_hash_lookup: token=%s value=%d what=%d\n", token, value, what);
inst_tok = my_malloc(_ALLOC_ID_, len);
/* instance name uglyfication: add a space at beginning so it will never match a valid net name */
my_snprintf(inst_tok, len, " %s", token);
/* use 2 spaces for pins/labels to distinguish from other instances */
if(label) my_snprintf(inst_tok, len, " %s", token);
else my_snprintf(inst_tok, len, " %s", token);
entry = hilight_hash_lookup(inst_tok, value, what);
my_free(_ALLOC_ID_, &inst_tok);
return entry;
@ -183,20 +188,36 @@ Hilight_hashentry *bus_hilight_hash_lookup(const char *token, int value, int wha
return ptr2;
}
void display_hilights(char **str)
/* what:
* 1: list only nets
* 2: list only intances
* 3: list all
*/
void display_hilights(int what, char **str)
{
int i;
int first = 1;
int instance = 0;
const char *ptr;
Hilight_hashentry *entry;
for(i=0;i<HASHSIZE; ++i) {
entry = xctx->hilight_table[i];
while(entry) {
if(!first) my_strcat(_ALLOC_ID_, str, " ");
my_strcat(_ALLOC_ID_, str,"{");
my_strcat(_ALLOC_ID_, str, entry->path+1);
my_strcat(_ALLOC_ID_, str, entry->token);
my_strcat(_ALLOC_ID_, str,"}");
first = 0;
ptr = entry->token;
if(ptr[0] == ' ' && ptr[1] == ' ' ) goto skip; /* do not list net labels / pins / net_show */
if(ptr[0] == ' ') instance = 1;
else instance = 0;
dbg(1, "what=%d, instance=%d, token=%s\n", what, instance, ptr);
if( ((what & 1) && !instance) || ((what & 2) && instance) ) {
if(instance) ptr++; /* skip uglyfication space */
if(!first) my_strcat(_ALLOC_ID_, str, " ");
my_strcat(_ALLOC_ID_, str,"{");
my_strcat(_ALLOC_ID_, str, entry->path+1);
my_strcat(_ALLOC_ID_, str, ptr);
my_strcat(_ALLOC_ID_, str,"}");
first = 0;
}
skip:
entry = entry->next;
}
}
@ -676,7 +697,7 @@ int search(const char *tok, const char *val, int sub, int sel)
dbg(1, "search(): setting hilight flag on inst %d\n",i);
/* xctx->hilight_nets=1; */ /* done in hilight_hash_lookup() */
xctx->inst[i].color = col;
inst_hilight_hash_lookup(xctx->inst[i].instname, col, XINSERT_NOREPLACE);
inst_hilight_hash_lookup(i, col, XINSERT_NOREPLACE);
}
}
if(sel==1) {
@ -827,7 +848,7 @@ static void drill_hilight(int mode)
if( (entry=bus_hilight_hash_lookup(netbitname, 0, XLOOKUP)) ) {
if( hilight_connected_inst || (symbol->type && IS_LABEL_SH_OR_PIN(symbol->type)) ) {
xctx->inst[i].color = entry->value;
inst_hilight_hash_lookup(xctx->inst[i].instname, entry->value, XINSERT_NOREPLACE);
inst_hilight_hash_lookup(i, entry->value, XINSERT_NOREPLACE);
}
my_strdup(_ALLOC_ID_, &propagate_str, get_tok_value(rct[j].prop_ptr, "propag", 0));
if(propagate_str) {
@ -1222,7 +1243,7 @@ void propagate_hilights(int set, int clear, int mode)
if(entry) {
if(set) {
xctx->inst[i].color=entry->value;
inst_hilight_hash_lookup(xctx->inst[i].instname, entry->value, XINSERT_NOREPLACE);
inst_hilight_hash_lookup(i, entry->value, XINSERT_NOREPLACE);
} else {
nohilight_pins = 0; /* at least one connected net is hilighted: keep instance hilighted */
}
@ -1236,7 +1257,7 @@ void propagate_hilights(int set, int clear, int mode)
}
}
else {
entry=inst_hilight_hash_lookup(xctx->inst[i].instname, 0, XLOOKUP);
entry=inst_hilight_hash_lookup(i, 0, XLOOKUP);
if (entry && set) xctx->inst[i].color=entry->value;
}
/* ... else hilight/clear pin/label instances attached to hilight nets */
@ -1244,7 +1265,7 @@ void propagate_hilights(int set, int clear, int mode)
entry=bus_hilight_hash_lookup( xctx->inst[i].node[0], 0, XLOOKUP);
if(entry && set) {
xctx->inst[i].color = entry->value;
inst_hilight_hash_lookup(xctx->inst[i].instname, entry->value, XINSERT_NOREPLACE);
inst_hilight_hash_lookup(i, entry->value, XINSERT_NOREPLACE);
}
else if(!entry && clear) xctx->inst[i].color = -10000;
}
@ -1728,7 +1749,7 @@ void hilight_net(int viewer)
dbg(1, "hilight_net(): setting hilight flag on inst %d\n",n);
/* xctx->hilight_nets=1; */ /* done in hilight_hash_lookup() */
xctx->inst[n].color = xctx->hilight_color;
inst_hilight_hash_lookup(xctx->inst[n].instname, xctx->hilight_color, XINSERT_NOREPLACE);
inst_hilight_hash_lookup(n, xctx->hilight_color, XINSERT_NOREPLACE);
if(type && (!strcmp(type, "ammeter") || !strcmp(type, "vsource")) ) {
if(viewer == XSCHEM_GRAPH) send_current_to_graph(&s, sim_is_xyce, xctx->inst[n].instname);
else if(viewer == GAW) send_current_to_gaw(sim_is_xyce, xctx->inst[n].instname);
@ -1770,7 +1791,7 @@ void unhilight_net(void)
if( xctx->inst[n].node && IS_LABEL_SH_OR_PIN(type) ) { /* instance must have a pin! */
bus_hilight_hash_lookup(xctx->inst[n].node[0], xctx->hilight_color, XDELETE);
} else {
inst_hilight_hash_lookup(xctx->inst[n].instname, xctx->hilight_color, XDELETE);
inst_hilight_hash_lookup(n, xctx->hilight_color, XDELETE);
}
}
xctx->inst[n].color = -10000;

View File

@ -610,12 +610,19 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_ResetResult(interp);
}
/* display_hilights
* Print a list of highlighted objects (nets, net labels/pins, instances) */
/* display_hilights [nets|instances]
* Print a list of highlighted objects (nets, net labels/pins, instances)
* if 'instances' is specified list only instance highlights
* if 'nets' is specified list only net highlights */
else if(!strcmp(argv[1], "display_hilights"))
{
char *str = NULL;
display_hilights(&str);
int what = 3; /* nets and instances */
if(argc > 2) {
if(!strcmp(argv[2], "instances")) what = 2; /* instances only */
else if(!strcmp(argv[2], "nets")) what = 1; /* nets only */
}
display_hilights(what, &str);
Tcl_SetResult(interp, str, TCL_VOLATILE);
my_free(_ALLOC_ID_, &str);
}
@ -1488,7 +1495,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
dbg(1, "xschem hilight_instname: setting hilight flag on inst %d\n",inst);
/* xctx->hilight_nets=1; */ /* done in hilight_hash_lookup() */
xctx->inst[inst].color = xctx->hilight_color;
inst_hilight_hash_lookup(xctx->inst[inst].instname, xctx->hilight_color, XINSERT_NOREPLACE);
inst_hilight_hash_lookup(inst, xctx->hilight_color, XINSERT_NOREPLACE);
if(incr_hi) incr_hilight_color();
}
dbg(1, "hilight_nets=%d\n", xctx->hilight_nets);

View File

@ -129,7 +129,7 @@ void check_unique_names(int rename)
if( (entry = int_hash_lookup(&xctx->inst_table, upinst, i, XINSERT_NOREPLACE) ) && entry->value != i) {
dbg(0, "check_unique_names(): found duplicate: i=%d name=%s\n", i, xctx->inst[i].instname);
xctx->inst[i].color = -PINLAYER;
inst_hilight_hash_lookup(xctx->inst[i].instname, -PINLAYER, XINSERT_NOREPLACE);
inst_hilight_hash_lookup(i, -PINLAYER, XINSERT_NOREPLACE);
if(rename == 1) {
if(first) {
bbox(START,0.0,0.0,0.0,0.0);

View File

@ -1174,7 +1174,7 @@ extern int save(int confirm);
extern void save_ascii_string(const char *ptr, FILE *fd, int newline);
extern Hilight_hashentry *bus_hilight_hash_lookup(const char *token, int value, int what) ;
/* wrapper function to hash highlighted instances, avoid clash with net names */
extern Hilight_hashentry *inst_hilight_hash_lookup(const char *token, int value, int what);
extern Hilight_hashentry *inst_hilight_hash_lookup(int i, int value, int what);
extern Hilight_hashentry *hilight_lookup(const char *token, int value, int what);
extern int search(const char *tok, const char *val, int sub, int sel);
extern int process_options(int argc, char **argv);
@ -1502,7 +1502,7 @@ extern void unhilight_net();
extern void propagate_hilights(int set, int clear, int mode);
extern void select_connected_wires(int stop_at_junction);
extern void draw_hilight_net(int on_window);
extern void display_hilights(char **str);
extern void display_hilights(int what, char **str);
extern void redraw_hilights(int clear);
extern void set_tcl_netlist_type(void);
extern int prepare_netlist_structs(int for_netlist);