"@path" will be expanded in symbols with the hierarchy path, so a fully qualified instance name is obtained with @path@name

This commit is contained in:
Stefan Frederik 2022-11-01 12:54:43 +01:00
parent dc6e9e2d9c
commit b0a88325e7
9 changed files with 56 additions and 15 deletions

View File

@ -2844,6 +2844,12 @@ const char *translate(int inst, const char* s)
STR_ALLOC(&result, tmp + result_pos, &size);
memcpy(result+result_pos,tmp_sym_name, tmp+1);
result_pos+=tmp;
} else if(strcmp(token,"@path")==0) {
const char *path = xctx->sch_path[xctx->currsch] + 1;
tmp=strlen(path);
STR_ALLOC(&result, tmp + result_pos, &size);
memcpy(result+result_pos, path, tmp+1);
result_pos+=tmp;
} else if(strcmp(token,"@symname_ext")==0) {
tmp_sym_name=xctx->inst[inst].name ? get_cell_w_ext(xctx->inst[inst].name, 0) : "";
tmp=strlen(tmp_sym_name);
@ -3472,6 +3478,24 @@ const char *translate2(Lcc *lcc, int level, char* s)
memcpy(result + result_pos, token, tmp + 1);
result_pos += tmp;
}
else if(strcmp(token,"@path")==0) {
char *path = NULL;
my_strdup2(1617, &path, "@path@name\\.");
if(level > 1) { /* add parent LCC instance names (X1, Xinv etc) */
int i;
for(i = 1; i <level; i++) {
const char *instname = get_tok_value(lcc[i].prop_ptr, "name", 0);
my_strcat(440, &path, instname);
my_strcat(1071, &path, ".");
}
}
dbg(0, "path=%s\n", path);
tmp=strlen(path);
STR_ALLOC(&result, tmp + result_pos, &size);
memcpy(result+result_pos, path, tmp+1);
my_free(1616, &path);
result_pos+=tmp;
}
else if (strcmp(token, "@symname") == 0) {
tmp_sym_name = lcc[level].symname ? get_cell(lcc[level].symname, 0) : "";
tmp = strlen(tmp_sym_name);

View File

@ -1,4 +1,5 @@
v {xschem version=3.0.0 file_version=1.2 }
v {xschem version=3.1.0 file_version=1.2
}
G {}
K {type=nmos
format="@spiceprefix@name @pinlist @model w=@w l=@l @extra m=@m"
@ -24,7 +25,7 @@ B 5 -22.5 -2.5 -17.5 2.5 {name=g dir=in}
B 5 17.5 27.5 22.5 32.5 {name=s dir=inout}
B 5 17.5 -2.5 22.5 2.5 {name=b dir=in}
T {@w\\/@l\\/@m} 7.5 -18.75 0 0 0.2 0.2 {}
T {@spiceprefix@name} 7.5 7.5 0 0 0.2 0.2 {}
T {@path@spiceprefix@name} 7.5 7.5 0 0 0.2 0.2 {}
T {D} 25 -27.5 0 0 0.15 0.15 {}
T {@#0:net_name} 25 -42.5 0 0 0.15 0.15 {layer=15}
T {@#2:net_name} 25 32.5 0 0 0.15 0.15 {layer=15}

View File

@ -1,4 +1,5 @@
v {xschem version=3.0.0 file_version=1.2 }
v {xschem version=3.1.0 file_version=1.2
}
G {}
K {type=pmos
format="@spiceprefix@name @pinlist @model w=@w l=@l @extra m=@m"
@ -30,7 +31,7 @@ B 5 -22.5 -2.5 -17.5 2.5 {name=g dir=in}
B 5 17.5 -32.5 22.5 -27.5 {name=s dir=inout}
B 5 17.5 -2.5 22.5 2.5 {name=b dir=in}
T {@w\\/@l\\/@m} 7.5 -17.5 0 0 0.2 0.2 {}
T {@spiceprefix@name} 7.5 7.5 0 0 0.2 0.2 {}
T {@path@spiceprefix@name} 7.5 7.5 0 0 0.2 0.2 {}
T {D} 25 20 0 0 0.15 0.15 {}
T {@#2:net_name} 25 -42.5 0 0 0.15 0.15 {layer=15}
T {@#0:net_name} 25 32.5 0 0 0.15 0.15 {layer=15}

View File

@ -50,6 +50,7 @@ sweep="v(a) v(z)"
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 {Example of using a schematic as a component instance
instead of the usual symbol. LCC: Local Custom Cell.
@ -63,6 +64,8 @@ T {Select one or more graphs (and no other objects)
and use arrow keys to zoom / pan waveforms} 20 -1000 0 0 0.3 0.3 {}
T {Butterfly diagram
of a cmos latch} 620 -950 0 0 0.4 0.4 {layer=8}
T {@symname
@name} 1840 -1250 0 1 0.7 0.7 {}
N 410 -100 410 -80 {lab=HALF}
N 410 -190 430 -190 {lab=ZZZ}
N 410 -190 410 -160 {lab=ZZZ}

View File

@ -1,5 +1,7 @@
v {xschem version=2.9.5 file_version=1.1}
G {type=nmos
v {xschem version=3.1.0 file_version=1.2
}
G {}
K {type=nmos
format="@name @pinlist @model w=@w l=@l
+ ad='@w *4.3u' as='@w *4.3u'
+ pd='@w *2+8.6u' ps='@w *2+8.6u'
@ -42,4 +44,4 @@ B 5 -22.5 -2.5 -17.5 2.5 {name=g dir=in}
B 5 17.5 27.5 22.5 32.5 {name=s dir=inout}
B 5 17.5 -2.5 22.5 2.5 {name=b dir=in}
T {@w\\/@l\\/@m} 7.5 -17.5 0 0 0.2 0.2 {}
T {@name} 7.5 5 0 0 0.2 0.2 {}
T {@path@name} 7.5 5 0 0 0.2 0.2 {}

View File

@ -1,4 +1,5 @@
v {xschem version=3.0.0 file_version=1.2 }
v {xschem version=3.1.0 file_version=1.2
}
G {}
K {type=nmos
format="@name @pinlist 0 @model w=@w l=@l
@ -32,4 +33,4 @@ B 5 17.5 -32.5 22.5 -27.5 {name=d dir=inout}
B 5 -22.5 -2.5 -17.5 2.5 {name=g dir=in}
B 5 17.5 27.5 22.5 32.5 {name=s dir=inout}
T {@w\\/@l\\/@m} 7.5 -17.5 0 0 0.2 0.2 {}
T {@name} 7.5 5 0 0 0.2 0.2 {}
T {@path@name} 7.5 5 0 0 0.2 0.2 {}

View File

@ -1,5 +1,7 @@
v {xschem version=2.9.5 file_version=1.1}
G {type=pmos
v {xschem version=3.1.0 file_version=1.2
}
G {}
K {type=pmos
format="@name @pinlist @model w=@w l=@l
+ ad='@w *4.6u' as='@w *4.6u'
+ pd='@w *2+9.2u' ps='@w *2+9.2u'
@ -40,4 +42,4 @@ B 5 -22.5 -2.5 -17.5 2.5 {name=g dir=in}
B 5 17.5 -32.5 22.5 -27.5 {name=s dir=inout}
B 5 17.5 -2.5 22.5 2.5 {name=b dir=in}
T {@w\\/@l\\/@m} 7.5 -17.5 0 0 0.2 0.2 {}
T {@name} 7.5 5 0 0 0.2 0.2 {999}
T {@path@name} 7.5 5 0 0 0.2 0.2 {999}

View File

@ -1,5 +1,7 @@
v {xschem version=2.9.5 file_version=1.1}
G {type=pmos
v {xschem version=3.1.0 file_version=1.2
}
G {}
K {type=pmos
format="@name @pinlist VCC @model w=@w l=@l
+ ad=\{@w *4.4u\}
+ as=\{@w *4.4u\}
@ -37,4 +39,4 @@ B 5 17.5 27.5 22.5 32.5 {name=d dir=inout}
B 5 -22.5 -2.5 -17.5 2.5 {name=g dir=in}
B 5 17.5 -32.5 22.5 -27.5 {name=s dir=inout}
T {@w\\/@l\\/@m} 7.5 -17.5 0 0 0.2 0.2 {}
T {@name} 7.5 5 0 0 0.2 0.2 {999}
T {@path@name} 7.5 5 0 0 0.2 0.2 {999}

View File

@ -176,6 +176,10 @@ N 1530 -350 1530 -330 {lab=vss}
N 1530 -530 1530 -510 {lab=vss}
N 1710 -180 1710 -160 {lab=vss}
N 1530 -180 1530 -160 {lab=vss}
N 780 -900 780 -890 {}
N 780 -930 790 -930 {}
N 730 -930 740 -930 {}
N 780 -970 780 -960 {}
C {title.sym} 170 0 0 0 {name=l3 author="Stefan Schippers"}
C {rom2_coldec.sym} 1190 -890 0 0 {name=xcdec[15:0]}
C {lab_pin.sym} 1040 -910 0 0 {name=p377 lab=LDY1[15:0]}
@ -452,3 +456,4 @@ tclcommand="
\}
"
}
C {n.sym} 760 -930 0 0 {name=m1 model=cmosn w=4u l=2.4u m=1}