add command `xschem raw_query add <node>` to add a vector <node> with all zeros to the loaded raw file. This vector can then populated with programmatic values using z `xschem raw_query set <node> point value` loop
This commit is contained in:
parent
965bf381ea
commit
be22993410
|
|
@ -548,6 +548,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li><kbd> abort_operation</kbd></li><pre>
|
||||
|
|
@ -1094,29 +1095,30 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
|
|||
<li><kbd> push_undo</kbd></li><pre>
|
||||
Push current state on undo stack </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 | table_read
|
||||
Load / clear / switch additional raw files
|
||||
if sweep1, sweep2 interval is given in 'read' subcommand load only the interval
|
||||
sweep1 <= sweep_var < sweep2 </pre>
|
||||
<li><kbd> raw_clear </kbd></li><pre>
|
||||
Unload all simulation raw files </pre>
|
||||
<li><kbd> raw_query loaded|value|index|values|datasets|vars|list|set</kbd></li><pre>
|
||||
<li><kbd> raw_query loaded|value|index|values|datasets|vars|list|set|add</kbd></li><pre>
|
||||
xschem raw_query list: get list of saved simulation variables
|
||||
xschem raw_query vars: get number of simulation variables
|
||||
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
|
||||
If n is given 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
|
||||
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 sim_type: return raw loaded simulation type (ac, op, tran, ...)
|
||||
xschem raw_query index node: get index of simulation variable 'node'.
|
||||
Example: raw_query index v(led) --> 46
|
||||
xschem raw_query values node [dset] : print all simulation
|
||||
values of 'node' for dataset 'dset' (default dset=0)
|
||||
xschem raw_query points [dset] : print simulation points for
|
||||
dataset 'dset' (default: all dataset points combined)
|
||||
xschem raw_query set node n value [dataset] : change loaded raw file data node[n] to value
|
||||
xschem raw_query values node [dset]: print all simulation
|
||||
values of 'node' for dataset 'dset' (default dset=0)
|
||||
xschem raw_query points [dset]: print simulation points for
|
||||
dataset 'dset' (default: all dataset points combined)
|
||||
xschem raw_query set node n value [dataset]: change loaded raw file data node[n] to value
|
||||
xschem raw_query add varname: add a 'varname' vector with all values set to 0 to loaded raw file
|
||||
</pre>
|
||||
<li><kbd> raw_read [file] [sim] [sweep1 sweep2]</kbd></li><pre>
|
||||
If a raw file is already loaded delete from memory
|
||||
|
|
@ -1514,7 +1516,6 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
|
|
|||
22
src/save.c
22
src/save.c
|
|
@ -824,6 +824,28 @@ int raw_read_from_attr(Raw **rawptr, const char *type, double sweep1, double swe
|
|||
return res;
|
||||
}
|
||||
|
||||
int raw_add_vector(const char *varname)
|
||||
{
|
||||
int f;
|
||||
Raw *raw = xctx->raw;
|
||||
if(!raw || !raw->values) return 0;
|
||||
|
||||
raw->nvars++;
|
||||
my_realloc(_ALLOC_ID_, &raw->names, raw->nvars * sizeof(char *));
|
||||
raw->names[raw->nvars - 1] = NULL;
|
||||
my_strdup2(_ALLOC_ID_, &raw->names[raw->nvars - 1], varname);
|
||||
int_hash_lookup(&raw->table, raw->names[raw->nvars - 1], raw->nvars - 1, XINSERT_NOREPLACE);
|
||||
|
||||
my_realloc(_ALLOC_ID_, &raw->values, (raw->nvars + 1) * sizeof(SPICE_DATA *));
|
||||
raw->values[raw->nvars] = NULL;
|
||||
my_realloc(_ALLOC_ID_, &raw->values[raw->nvars], raw->allpoints * sizeof(SPICE_DATA));
|
||||
for(f = 0; f < raw->allpoints; f++) {
|
||||
raw->values[raw->nvars - 1][f] = 0.0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* read a ngspice raw file (with data portion in binary format) */
|
||||
int raw_read(const char *f, Raw **rawptr, const char *type, double sweep1, double sweep2)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3480,23 +3480,24 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
Tcl_ResetResult(interp);
|
||||
}
|
||||
|
||||
/* raw_query loaded|value|index|values|datasets|vars|list|set
|
||||
/* raw_query loaded|value|index|values|datasets|vars|list|set|add
|
||||
* xschem raw_query list: get list of saved simulation variables
|
||||
* xschem raw_query vars: get number of simulation variables
|
||||
* 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
|
||||
* If n is given 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
|
||||
* 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 sim_type: return raw loaded simulation type (ac, op, tran, ...)
|
||||
* xschem raw_query index node: get index of simulation variable 'node'.
|
||||
* Example: raw_query index v(led) --> 46
|
||||
* xschem raw_query values node [dset] : print all simulation
|
||||
* values of 'node' for dataset 'dset' (default dset=0)
|
||||
* xschem raw_query points [dset] : print simulation points for
|
||||
* dataset 'dset' (default: all dataset points combined)
|
||||
* xschem raw_query set node n value [dataset] : change loaded raw file data node[n] to value
|
||||
* xschem raw_query values node [dset]: print all simulation
|
||||
* values of 'node' for dataset 'dset' (default dset=0)
|
||||
* xschem raw_query points [dset]: print simulation points for
|
||||
* dataset 'dset' (default: all dataset points combined)
|
||||
* xschem raw_query set node n value [dataset]: change loaded raw file data node[n] to value
|
||||
* xschem raw_query add varname: add a 'varname' vector with all values set to 0 to loaded raw file
|
||||
*
|
||||
*/
|
||||
else if(!strcmp(argv[1], "raw_query"))
|
||||
|
|
@ -3552,6 +3553,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
Tcl_AppendResult(interp, n, " ", NULL);
|
||||
}
|
||||
}
|
||||
} else if(argc > 3 && !strcmp(argv[2], "add")) {
|
||||
int res = 0;
|
||||
res = raw_add_vector(argv[3]);
|
||||
Tcl_SetResult(interp, my_itoa(res), TCL_VOLATILE);
|
||||
} else if(argc > 2 && !strcmp(argv[2], "datasets")) {
|
||||
Tcl_SetResult(interp, my_itoa(raw->datasets), TCL_VOLATILE);
|
||||
} else if(argc > 2 && !strcmp(argv[2], "points")) {
|
||||
|
|
|
|||
|
|
@ -1223,6 +1223,7 @@ extern int filter_data(const char *din, const size_t ilen,
|
|||
extern int embed_rawfile(const char *rawfile);
|
||||
extern int read_rawfile_from_attr(const char *b64s, size_t length, const char *type);
|
||||
extern int raw_read_from_attr(Raw **rawptr, const char *type, double sweep1, double sweep2);
|
||||
extern int raw_add_vector(const char *varname);
|
||||
extern char *base64_from_file(const char *f, size_t *length);
|
||||
extern int set_rect_flags(xRect *r);
|
||||
extern int set_text_flags(xText *t);
|
||||
|
|
|
|||
Loading…
Reference in New Issue