added xschem raw_query set node n value [dset] command to change loaded raw data

This commit is contained in:
stefan schippers 2024-02-20 17:17:38 +01:00
parent 31078e45d3
commit 1336e25e68
3 changed files with 39 additions and 9 deletions

View File

@ -547,6 +547,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
<li><kbd> abort_operation</kbd></li><pre> <li><kbd> abort_operation</kbd></li><pre>
@ -1093,18 +1094,18 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
<li><kbd> push_undo</kbd></li><pre> <li><kbd> push_undo</kbd></li><pre>
Push current state on undo stack </pre> Push current state on undo stack </pre>
<li><kbd> raw what [rawfile type] [sweep1 sweep2]</kbd></li><pre> <li><kbd> raw what [rawfile type] [sweep1 sweep2]</kbd></li><pre>
what = read | clear | info | switch | switch_back what = read | clear | info | switch | switch_back
Load / clear / switch additional raw files Load / clear / switch additional raw files
if sweep1, sweep2 interval is given in 'read' subcommand load only the interval if sweep1, sweep2 interval is given in 'read' subcommand load only the interval
sweep1 &lt;= sweep_var &lt; sweep2 </pre> sweep1 &lt;= sweep_var &lt; sweep2 </pre>
<li><kbd> raw_clear </kbd></li><pre> <li><kbd> raw_clear </kbd></li><pre>
Unload all simulation raw files </pre> Unload all simulation raw files </pre>
<li><kbd> raw_query loaded|value|index|values|datasets|vars|list </kbd></li><pre> <li><kbd> raw_query loaded|value|index|values|datasets|vars|list|set</kbd></li><pre>
xschem raw_query list: get list of saved simulation variables xschem raw_query list: get list of saved simulation variables
xschem raw_query vars: get number of simulation variables xschem raw_query vars: get number of simulation variables
xschem raw_query datasets: get number of datasets (simulation runs) xschem raw_query datasets: get number of datasets (simulation runs)
xschem raw_query value node n [dataset]: return n-th value of 'node' in raw file xschem raw_query value node n [dataset]: return n-th value of 'node' in raw file
If n is egiven as empty string {} return value at cursor b, dataset not used in this case If n is given as empty string {} return value at cursor b, dataset not used in this case
xschem raw_query loaded: return hierarchy level xschem raw_query loaded: return hierarchy level
where raw file was loaded or -1 if no raw loaded where raw file was loaded or -1 if no raw loaded
xschem raw_query rawfile: return raw filename xschem raw_query rawfile: return raw filename
@ -1114,7 +1115,9 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
xschem raw_query values node [dset] : print all simulation xschem raw_query values node [dset] : print all simulation
values of 'node' for dataset 'dset' (default dset=0) values of 'node' for dataset 'dset' (default dset=0)
xschem raw_query points [dset] : print simulation points for xschem raw_query points [dset] : print simulation points for
dataset 'dset' (default: all dataset points combined)</pre> dataset 'dset' (default: all dataset points combined)
xschem raw_query set node n value [dataset] : change loaded raw file data node[n] to value
</pre>
<li><kbd> raw_read [file] [sim] [sweep1 sweep2]</kbd></li><pre> <li><kbd> raw_read [file] [sim] [sweep1 sweep2]</kbd></li><pre>
If a raw file is already loaded delete from memory If a raw file is already loaded delete from memory
then load specified file and analysis 'sim' (dc, ac, tran, op, ...) then load specified file and analysis 'sim' (dc, ac, tran, op, ...)
@ -1512,7 +1515,6 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
</ul> </ul>

View File

@ -265,7 +265,7 @@ The following syntax:
<p> The graph dialog box has a <kbd>Sweep</kbd> textbox where you can write the <p> The graph dialog box has a <kbd>Sweep</kbd> textbox where you can write the
X-axis variable. By default xschem uses the first variable in the raw file for the X-axis, and this is the X-axis variable. By default xschem uses the first variable in the raw file for the X-axis, and this is the
sweep variable the simulation was done, so time for transients, frequency for AC sims, voltage or current sweep sweep variable the simulation was done, so time for transients, frequency for AC sims, voltage or current sweep
for DC sims. Example below shows a cmos latch where a DC simulation has vbeen done sweeping the voltage generator for DC sims. Example below shows a cmos latch where a DC simulation has been done sweeping the voltage generator
on the <kbd>a</kbd> input from 0 to 3V.<br> on the <kbd>a</kbd> input from 0 to 3V.<br>
<img src="graphs21.png"><br><br> <img src="graphs21.png"><br><br>
If <kbd>v(a) v(z)</kbd> is specified in the Sweep textbox (or <kbd>a z</kbd>) the <kbd>z</kbd> signal If <kbd>v(a) v(z)</kbd> is specified in the Sweep textbox (or <kbd>a z</kbd>) the <kbd>z</kbd> signal

View File

@ -3418,7 +3418,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
break; break;
case 'r': /*----------------------------------------------*/ case 'r': /*----------------------------------------------*/
/* raw what [rawfile type] [sweep1 sweep2] /* raw what [rawfile type] [sweep1 sweep2]
* what = read | clear | info | switch | switch_back * what = read | clear | info | switch | switch_back
* Load / clear / switch additional raw files * Load / clear / switch additional raw files
* if sweep1, sweep2 interval is given in 'read' subcommand load only the interval * if sweep1, sweep2 interval is given in 'read' subcommand load only the interval
* sweep1 <= sweep_var < sweep2 */ * sweep1 <= sweep_var < sweep2 */
@ -3477,12 +3477,12 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_ResetResult(interp); Tcl_ResetResult(interp);
} }
/* raw_query loaded|value|index|values|datasets|vars|list /* raw_query loaded|value|index|values|datasets|vars|list|set
* xschem raw_query list: get list of saved simulation variables * xschem raw_query list: get list of saved simulation variables
* xschem raw_query vars: get number of simulation variables * xschem raw_query vars: get number of simulation variables
* xschem raw_query datasets: get number of datasets (simulation runs) * xschem raw_query datasets: get number of datasets (simulation runs)
* xschem raw_query value node n [dataset]: return n-th value of 'node' in raw file * xschem raw_query value node n [dataset]: return n-th value of 'node' in raw file
* If n is egiven as empty string {} return value at cursor b, dataset not used in this case * If n is given as empty string {} return value at cursor b, dataset not used in this case
* xschem raw_query loaded: return hierarchy level * xschem raw_query loaded: return hierarchy level
* where raw file was loaded or -1 if no raw loaded * where raw file was loaded or -1 if no raw loaded
* xschem raw_query rawfile: return raw filename * xschem raw_query rawfile: return raw filename
@ -3493,6 +3493,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
* values of 'node' for dataset 'dset' (default dset=0) * values of 'node' for dataset 'dset' (default dset=0)
* xschem raw_query points [dset] : print simulation points for * xschem raw_query points [dset] : print simulation points for
* dataset 'dset' (default: all dataset points combined) * dataset 'dset' (default: all dataset points combined)
* xschem raw_query set node n value [dataset] : change loaded raw file data node[n] to value
*
*/ */
else if(!strcmp(argv[1], "raw_query")) else if(!strcmp(argv[1], "raw_query"))
{ {
@ -3568,6 +3570,32 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
if(i > 0) Tcl_AppendResult(interp, "\n", NULL); if(i > 0) Tcl_AppendResult(interp, "\n", NULL);
Tcl_AppendResult(interp, raw->names[i], NULL); Tcl_AppendResult(interp, raw->names[i], NULL);
} }
/* 0 1 2 3 4 5 6
* xschem raw_query set node n value [dataset] */
} else if(argc > 5 && !strcmp(argv[2], "set")) {
int dataset = -1, ofs = 0;
int point = atoi(argv[4]);
const char *node = argv[3];
int idx = -1;
if(argc > 6) dataset = atoi(argv[6]);
idx = get_raw_index(node);
if(idx >= 0) {
if( dataset < xctx->raw->datasets &&
( (dataset >=0 && point >= 0 && point < raw->npoints[dataset]) ||
(dataset == -1 && point >= 0 && point < raw->allpoints) )
) {
if(dataset != -1) {
for(i = 0; i < dataset; ++i) {
ofs += xctx->raw->npoints[i];
}
if(ofs + point < xctx->raw->allpoints) {
point += ofs;
}
}
xctx->raw->values[idx][point] = (SPICE_DATA) atof(argv[5]);
Tcl_SetResult(interp, dtoa(xctx->raw->values[idx][point]), TCL_VOLATILE);
}
}
} }
} }
} }