From bf71dbc9e7e1d29d4c954b06c23d3be530078b3f Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Fri, 23 Feb 2024 21:58:41 +0100 Subject: [PATCH] command xschem raw new to use `start end step` instead of `start step number` --- doc/xschem_man/developer_info.html | 12 ++++++++---- src/save.c | 5 +++-- src/scheduler.c | 6 +++--- src/xschem.h | 2 +- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/doc/xschem_man/developer_info.html b/doc/xschem_man/developer_info.html index 3ed5e4a2..e3f72cf9 100644 --- a/doc/xschem_man/developer_info.html +++ b/doc/xschem_man/developer_info.html @@ -548,6 +548,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns" +
  • abort_operation
  • @@ -1098,8 +1099,8 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
          Load / clear / switch additional raw files
          if sweep1, sweep2 interval is given in 'read' subcommand load only the interval
          sweep1 <= sweep_var < sweep2
    -   xschem raw new name type sweepvar start step number
    -     create a new raw file with sweep variable 'sweepvar' with number datapoints
    +   xschem raw new name type sweepvar start end step
    +     create a new raw file with sweep variable 'sweepvar' with number=(end - start) / step datapoints
          from start value 'start' and step 'step' 
  • raw_clear
  •     Unload all simulation raw files 
    @@ -1120,7 +1121,11 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns" 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 + xschem raw_query add varname [expr] + add a 'varname' vector with all values set to 0 to loaded raw file if expr not given + otherwise initialize data with values calculated from expr. + If varname is already existing and expr given recalculate data + Example: xschem raw_query add power {outm outp - i(@r1[i]) *}
  • raw_read [file] [sim] [sweep1 sweep2]
  •     If a raw file is already loaded delete from memory
    @@ -1518,7 +1523,6 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
     
     
     
    -
     
     
      
    diff --git a/src/save.c b/src/save.c
    index ded369ec..4007f1b2 100644
    --- a/src/save.c
    +++ b/src/save.c
    @@ -914,13 +914,14 @@ int raw_read(const char *f, Raw **rawptr, const char *type, double sweep1, doubl
       return 0;
     }
     
    -/* create a new raw file with 'number' points with only a sweep variable in it. */
    +/* create a new raw file with '(max - min) / step' points with only a sweep variable in it. */
     int new_rawfile(const char *name, const char *type, const char *sweepvar,
    -                       double start, double step, int number)
    +                       double start, double end, double step)
     {
       int i;
       int ret = 1;
       Raw *raw;
    +  int number = (int)floor((end - start) / step) + 1;
     
       /* if not already done insert base raw file (if there is one) into xctx->extra_raw_arr[0] */
       if(xctx->raw && xctx->extra_raw_n == 0) {
    diff --git a/src/scheduler.c b/src/scheduler.c
    index cf7f54bc..c7a925d6 100644
    --- a/src/scheduler.c
    +++ b/src/scheduler.c
    @@ -3422,8 +3422,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
          *     Load / clear / switch additional raw files
          *     if sweep1, sweep2 interval is given in 'read' subcommand load only the interval
          *     sweep1 <= sweep_var < sweep2
    -     *   xschem raw new name type sweepvar start step number
    -     *     create a new raw file with sweep variable 'sweepvar' with number datapoints
    +     *   xschem raw new name type sweepvar start end step
    +     *     create a new raw file with sweep variable 'sweepvar' with number=(end - start) / step datapoints
          *     from start value 'start' and step 'step' */
         if(!strcmp(argv[1], "raw"))
         {
    @@ -3453,7 +3453,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
             update_op();
             Tcl_SetResult(interp, my_itoa(ret), TCL_VOLATILE);
           } else if(argc ==9 && !strcmp(argv[2], "new")) {
    -        ret = new_rawfile(argv[3], argv[4], argv[5], atof(argv[6]), atof(argv[7]),atoi(argv[8]));
    +        ret = new_rawfile(argv[3], argv[4], argv[5], atof(argv[6]), atof(argv[7]),atof(argv[8]));
             Tcl_SetResult(interp, my_itoa(ret), TCL_VOLATILE);
           } else if(argc > 2 && !strcmp(argv[2], "info")) {
             ret = extra_rawfile(4, NULL, NULL, -1.0, -1.0);
    diff --git a/src/xschem.h b/src/xschem.h
    index 75523d62..58c0f344 100644
    --- a/src/xschem.h
    +++ b/src/xschem.h
    @@ -1225,7 +1225,7 @@ extern int read_rawfile_from_attr(const char *b64s, size_t length, const char *t
     extern int raw_read_from_attr(Raw **rawptr, const char *type, double sweep1, double sweep2);
     extern int raw_add_vector(const char *varname, const char *expr);
     extern int new_rawfile(const char *name, const char *type, const char *sweepvar,
    -                       double start, double step, int number);
    +                       double start, double end, double step);
     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);