xschem resolved_net command: add [net] parameter; instcheck(): use inst[].lab instead of get_tok_value(inst[].prop_ptr, "lab",0)

This commit is contained in:
Stefan Schippers 2023-06-01 18:00:47 +02:00
parent f3f12da486
commit f5c592c889
5 changed files with 22 additions and 13 deletions

View File

@ -969,9 +969,10 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
Example: xschem replace_symbol R3 capa.sym </pre>
<li><kbd> reset_flags</kbd></li><pre>
Reset cached instance and symbol cached flags (inst-&gt;flags, sym-&gt;flags) </pre>
<li><kbd> resolved_net</kbd></li><pre>
returns the topmost full hierarchy name of selected net/pin/label
nets connected to I/O ports are mapped to upper level recursively </pre>
<li><kbd> resolved_net [net]</kbd></li><pre>
if 'net' is given return its topmost full hierarchy name
else returns the topmost full hierarchy name of selected net/pin/label.
Nets connected to I/O ports are mapped to upper level recursively</pre>
<li><kbd> rotate</kbd></li><pre>
Rotate selected objects around their centers </pre>
<li><kbd> save</kbd></li><pre>

View File

@ -874,7 +874,8 @@ static int instcheck(int n, int p)
const char *tap;
dbg(1, "instcheck: bus tap node: %s\n", inst[n].node[0]);
if(!inst[n].node[1]) { /* still unnamed */
tap = get_tok_value(inst[n].prop_ptr, "lab", 0);
/* tap = get_tok_value(inst[n].prop_ptr, "lab", 0); */
tap = inst[n].lab;
/* Check if this is a bus slice and must be appended to bus base name */
if(tap[0] == '[' || isonlydigit(tap)) {
/* find bus basename, from beginning or first character after ',' and ' ' */

View File

@ -2928,15 +2928,19 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_ResetResult(interp);
}
/* resolved_net
* returns the topmost full hierarchy name of selected net/pin/label
* nets connected to I/O ports are mapped to upper level recursively */
/* resolved_net [net]
* if 'net' is given return its topmost full hierarchy name
* else returns the topmost full hierarchy name of selected net/pin/label.
* Nets connected to I/O ports are mapped to upper level recursively */
else if(!strcmp(argv[1], "resolved_net"))
{
char *net = NULL, *rn = NULL;
const char *net = NULL;
char *rn = NULL;
Tcl_ResetResult(interp);
prepare_netlist_structs(0);
if(xctx->lastsel == 1) {
if(argc > 2) {
net = argv[2];
} else if(xctx->lastsel == 1) {
if(xctx->sel_array[0].type == ELEMENT) {
int n=xctx->sel_array[0].n;
if(xctx->inst[n].ptr >= 0) {

View File

@ -3418,7 +3418,9 @@ const char *translate(int inst, const char* s)
++path;
}
prepare_netlist_structs(0);
if(pin_prop_ptr) net = get_tok_value(pin_prop_ptr, "lab", 0);
if(pin_prop_ptr) {
net = get_tok_value(pin_prop_ptr, "lab", 0);
}
if(net == NULL || net[0] == '\0') net = net_name(inst,0, &multip, 0, 0);
len = strlen(path) + strlen(net) + 1;
dbg(1, "translate() @spice_get_voltage: inst=%s\n", xctx->inst[inst].instname);

View File

@ -1,4 +1,4 @@
v {xschem version=3.1.0 file_version=1.2
v {xschem version=3.4.0 file_version=1.2
}
G {}
K {type=subcircuit
@ -51,7 +51,8 @@ dataset=-1}
P 4 5 560 -700 560 -510 1350 -510 1350 -700 560 -700 {dash=3}
P 4 5 820 -920 820 -730 1350 -730 1350 -920 820 -920 {dash=3}
P 4 5 0 -1160 1840 -1160 1840 0 -0 0 0 -1160 {dash=4}
T {These 2 instances are equivalent} 260 -310 0 0 0.4 0.4 {}
T {These 2 instances
are equivalent} 260 -310 0 0 0.4 0.4 {}
T {Example of using a schematic as a component instance
instead of the usual symbol. LCC: Local Custom Cell.
@ -84,7 +85,7 @@ lab=ZZ}
C {vsource.sym} 50 -140 0 0 {name=V1 value="pwl 0 0 1u 0 5u 3"}
C {lab_pin.sym} 50 -170 0 0 {name=p4 lab=A}
C {lab_pin.sym} 50 -110 0 0 {name=p5 lab=0}
C {code_shown.sym} 510 -250 0 0 {name=STIMULI
C {code_shown.sym} 480 -280 0 0 {name=STIMULI
only_toplevel=true
tclcommand="xschem edit_vi_prop"
value=".control