add xschem list_nets command

This commit is contained in:
stefan schippers 2024-02-19 13:03:28 +01:00
parent f547c86f1e
commit 66ba05fe2c
4 changed files with 44 additions and 0 deletions

View File

@ -922,6 +922,8 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
20221014_091945 {/home/.../ngspice/comp_ngspice.sch}</pre>
<li><kbd> list_hilights [sep]</kbd></li><pre>
Sorted list of highlight nets, separated by character 'sep' (default: space) </pre>
<li><kbd> list_nets</kbd></li><pre>
List all nets with type (in / out / inout / net) </pre>
<li><kbd> list_tokens str with_quotes</kbd></li><pre>
List tokens in string 'str'
with_quotes:

View File

@ -367,3 +367,33 @@ void print_verilog_signals(FILE *fd)
}
if(found) fprintf(fd, "\n" );
}
void list_nets(char **result)
{
Node_hashentry *ptr;
char *type = NULL;
int i;
int netlist_lvs_ignore=tclgetboolvar("lvs_ignore");
prepare_netlist_structs(1);
for(i = 0; i < xctx->instances; i++) {
if(skip_instance(i, 0, netlist_lvs_ignore)) continue;
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
if(type && xctx->inst[i].node && IS_PIN(type)) {
my_mstrcat(_ALLOC_ID_, result,
"{", get_tok_value(xctx->inst[i].prop_ptr, "lab", 0), " ", type, "}\n", NULL);
}
}
if(type) my_free(_ALLOC_ID_, &type);
for(i=0;i<HASHSIZE; ++i) {
ptr = xctx->node_table[i];
while(ptr) {
if(!ptr->d.port) {
my_mstrcat(_ALLOC_ID_, result,
"{", ptr->token, " ", "net", "}\n", NULL);
}
ptr = ptr->next;
}
}
}

View File

@ -2419,6 +2419,17 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
tclvareval("join [lsort -decreasing -dictionary {", tclresult(), "}] ", sep, NULL);
}
/* list_nets
* List all nets with type (in / out / inout / net) */
else if(!strcmp(argv[1], "list_nets"))
{
char *result = NULL;
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
list_nets(&result);
Tcl_SetResult(interp, result, TCL_VOLATILE);
my_free(_ALLOC_ID_, &result);
}
/* list_tokens str with_quotes
* List tokens in string 'str'
* with_quotes:

View File

@ -1647,6 +1647,7 @@ extern void round_schematic_to_grid(double cadsnap);
extern void save_selection(int what);
extern void print_vhdl_signals(FILE *fd);
extern void print_verilog_signals(FILE *fd);
extern void list_nets(char **result);
extern void print_generic(FILE *fd, char *ent_or_comp, int symbol);
extern void print_verilog_param(FILE *fd, int symbol);
extern void hilight_net(int to_waveform);