Xyce support for node/current probing to graph

This commit is contained in:
Stefan Frederik 2022-01-31 00:14:34 +01:00
parent a79af0c7e5
commit e7ebb2c2af
5 changed files with 43 additions and 25 deletions

View File

@ -2365,7 +2365,7 @@ void draw_graph(int i, const int flags, Graph_ctx *gr)
nptr = cptr = sptr = NULL;
dbg(1, "ntok=%s ctok=%s\n", ntok, ctok? ctok: "NULL");
if(ctok && ctok[0]) wave_color = atoi(ctok);
if(wave_color < 0) wave_color = 0;
if(wave_color < 0) wave_color = 4;
if(wave_color >= cadlayers) wave_color = cadlayers - 1;
if(stok && stok[0]) {
sweep_idx = get_raw_index(stok);

View File

@ -920,11 +920,20 @@ static void send_net_to_graph(char **s, int simtype, const char *node)
my_strdup2(1499, &p, xctx->sch_path[xctx->currsch]+1);
for(k=1; k<=tok_mult; k++) {
my_strdup(1503, &t, find_nth(expanded_tok, ',', k));
if(simtype == 0 ) { /* spice */
if(simtype == 0 ) { /* ngspice */
dbg(1, "%s%s color=%d\n", strtolower(p), strtolower(t), c);
my_snprintf(ss, S(ss), "%s%s %d ", strtolower(p), strtolower(t), c);
my_strcat(1502, s, ss);
} else { /* Xyce */
char *pp=p;
while(*pp){
if(*pp == '.') *pp = ':'; /* Xyce uses : as path separator */
pp++;
}
my_snprintf(ss, S(ss), "%s%s %d", strtoupper(p), strtoupper(t), c);
my_strcat(536, s, ss);
}
}
my_free(1500, &p);
my_free(1501, &t);
@ -954,7 +963,7 @@ static void send_net_to_gaw(int simtype, const char *node)
my_strdup2(254, &p, xctx->sch_path[xctx->currsch]+1);
for(k=1; k<=tok_mult; k++) {
my_strdup(246, &t, find_nth(expanded_tok, ',', k));
if(simtype == 0 ) { /* spice */
if(simtype == 0 ) { /* ngspice */
tclvareval("puts $gaw_fd {copyvar v(", strtolower(p), strtolower(t),
") sel #", color_str, "}\nvwait gaw_fd\n", NULL);
} else { /* Xyce */
@ -1056,7 +1065,16 @@ static void send_current_to_graph(char **s, int simtype, const char *node)
if(!simtype) { /* ngspice */
my_snprintf(ss, S(ss), "i(%s%s%s) %d", xctx->currsch>0 ? "v." : "",
strtolower(p), strtolower(t), c);
my_strcat(1502, s, ss);
my_strcat(537, s, ss);
} else { /* Xyce */
char *pp=p;
while(*pp){
if(*pp == '.') *pp = ':'; /* Xyce uses : as path separator */
pp++;
}
my_snprintf(ss, S(ss), "%s%s%s#branch %d", xctx->currsch>0 ? "V:" : "",
strtoupper(p), strtoupper(xctx->currsch>0 ? t+1 : t ), c);
my_strcat(535, s, ss);
}
}
my_free(533, &p);

View File

@ -1405,7 +1405,6 @@ proc graph_add_nodes_from_list {nodelist} {
append ccc $cc
xschem setprop rect 2 [xschem get graph_lastsel] node $nnn
xschem setprop rect 2 [xschem get graph_lastsel] color $ccc
puts $nodelist
}
}
@ -2969,9 +2968,13 @@ proc tclpropeval2 {s} {
if {$debug_var <=-1} {puts "tclpropeval2: $s"}
set path [string range [xschem get sch_path] 1 end]
if { $netlist_type eq {spice} } {
# this is necessary if spiceprefix is being used in netlists
regsub {^([^xX])} $path {x\1} path
while { [regsub {\.([^xX])} $path {.x\1} path] } {}
}
if { [sim_is_xyce]} {
regsub -all {\.} [string toupper $path] {:} path
}
if { $debug_var<=-1 } { puts "---> path=$path" }
regsub {^tcleval\(} $s {} s
regsub {\)([ \n\t]*)$} $s {\1} s

File diff suppressed because one or more lines are too long

View File

@ -15,21 +15,21 @@ L 18 880 -530 900 -580 {}
L 18 880 -530 880 -450 {}
L 18 900 -580 900 -400 {}
B 2 1260 -230 1940 -40 {flags=graph
y1 = 0.039127
y2 = 0.0391312
y1 = -3.5e-08
y2 = 0.04
divy = 5
x1=0.0257846
x2=0.0261791
x1=0
x2=0.02
divx=10
node=V:X1:3#branch
color=11 unitx=m unity=m
}
B 2 1260 -430 1940 -240 {flags=graph
y1 = 0
y2 = 12
y1 = -0.02
y2 = 11
divy = 6
x1=0.0257846
x2=0.0261791
x1=0
x2=0.02
divx=10
node="V:X1:U#branch
V:X0:U#branch
@ -39,11 +39,11 @@ color="11 13 12 7"
unitx=m
}
B 2 1260 -760 1940 -450 {flags=graph
y1 = -60
y2 = 60
y1 = -50
y2 = 50
divy = 12
x1=0.0257846
x2=0.0261791
x1=0
x2=0.02
divx=10
node="OUTP
OUTM
@ -139,7 +139,7 @@ vvss vss 0 dc 0
.param frequ=20e3
.param gain=42
* .tran \{2e-3/frequ\} \{1e-3 + 160/frequ\} uic
.tran 6e-7 0.06 uic
.tran 6e-6 0.06 uic
** models are generally not free: you must download
** SPICE models for active devices and put them into the below