`xschem annotate_op file [level]`: added `level` optional integer to specify the hierarchy level op raw data refers to. Add xschem set raw_level to modify the raw level loaded raw file refers to

This commit is contained in:
stefan schippers 2023-11-18 12:55:57 +01:00
parent 2c48b7399e
commit 84d945238f
2 changed files with 40 additions and 7 deletions

View File

@ -525,6 +525,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
<li><kbd> abort_operation</kbd></li><pre>
@ -537,11 +538,13 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
Ask user to choose a png file and start a GUI placement of the image </pre>
<li><kbd> align</kbd></li><pre>
Align currently selected objects to current snap setting </pre>
<li><kbd> annotate_op [raw_file]</kbd></li><pre>
<li><kbd> annotate_op [raw_file] [level]</kbd></li><pre>
Annotate operating point data into current schematic.
use &lt;schematic name&gt;.raw or use supplied argument as raw file to open
look for operating point data and annotate voltages/currents
into schematic </pre>
look for operating point data and annotate voltages/currents into schematic.
The optional 'level' integer specifies the hierarchy level the raw file refers to.
This is necessary if annotate_op is called from a sub schematic at a hierarchy
level &gt; 0 but simulation was done at top level (hierarchy 0, for example)</pre>
<li><kbd> arc</kbd></li><pre>
Start a GUI placement of an arc.
User should click 3 unaligned points to define the arc </pre>
@ -643,7 +646,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
Enable/disable layers depending on tcl array variable enable_layer() </pre>
<li><kbd> escape_chars source</kbd></li><pre>
escape tcl special characters with backslash </pre>
<li><kbd> exit [closewindow]</kbd></li><pre>
<li><kbd> exit [closewindow] [force]</kbd></li><pre>
Exit the program, ask for confirm if current file modified.
if 'closewindow' is given close the window, otherwise leave with a blank schematic
when closing the last remaining window
@ -1207,6 +1210,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
<li><kbd> netlist_type </kbd> set netlisting mode (spice, verilog, vhdl, tedax, symbol) </li>
<li><kbd> no_draw </kbd> set no drawing flag (0 or 1) </li>
<li><kbd> no_undo </kbd> set to 1 to disable undo </li>
<li><kbd> raw_level </kbd> set hierarchy level loaded raw file refers to </li>
<li><kbd> rectcolor </kbd> set current layer (0, 1, .... , cadlayers-1) </li>
<li><kbd> sch_to_compare </kbd> set name of schematic to compare current window with </li>
<li><kbd> schsymbolprop </kbd> set global symbol attribute string </li>

View File

@ -255,15 +255,25 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
draw();
}
/* annotate_op [raw_file]
/* annotate_op [raw_file] [level]
* Annotate operating point data into current schematic.
* use <schematic name>.raw or use supplied argument as raw file to open
* look for operating point data and annotate voltages/currents
* into schematic */
* look for operating point data and annotate voltages/currents into schematic.
* The optional 'level' integer specifies the hierarchy level the raw file refers to.
* This is necessary if annotate_op is called from a sub schematic at a hierarchy
* level > 0 but simulation was done at top level (hierarchy 0, for example)
*/
else if(!strcmp(argv[1], "annotate_op"))
{
int level = -1;
char f[PATH_MAX + 100];
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
if(argc > 3) {
level = atoi(argv[3]);
if(level < 0 || level > xctx->currsch) {
level = -1;
}
}
if(argc > 2) {
my_snprintf(f, S(f),"regsub {^~/} {%s} {%s/}", argv[2], home_dir);
tcleval(f);
@ -275,6 +285,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
extra_rawfile(3, NULL, NULL);
free_rawfile(&xctx->raw, 1);
raw_read(f, &xctx->raw, "op");
if(level >= 0) {
xctx->raw->level = level;
my_strdup2(_ALLOC_ID_, &xctx->raw->schname, xctx->sch[level]);
}
update_op();
draw();
}
@ -4140,6 +4154,17 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
xctx->no_undo=s;
}
else if(!strcmp(argv[2], "raw_level")) { /* set hierarchy level loaded raw file refers to */
int n = atoi(argv[3]);
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
if(n >= 0 && n <= xctx->currsch) {
xctx->raw->level = atoi(argv[3]);
my_strdup2(_ALLOC_ID_, &xctx->raw->schname, xctx->sch[xctx->raw->level]);
Tcl_SetResult(interp, my_itoa(n), TCL_VOLATILE);
} else {
Tcl_SetResult(interp, "-1", TCL_VOLATILE);
}
}
else if(!strcmp(argv[2], "rectcolor")) { /* set current layer (0, 1, .... , cadlayers-1) */
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
xctx->rectcolor=atoi(argv[3]);
@ -4739,6 +4764,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Xschem_ctx **save_xctx = get_save_xctx();
save_xctx[1]->raw = save_xctx[0]->raw;
}
else if(argc > 4 && atoi(argv[2]) == 4) {
raw_read(argv[3], &xctx->raw, argv[4]);
xctx->raw->level = 0;
}
Tcl_ResetResult(interp);
}