From d91daea84cb22cc64486bac87c7e36ca1778500d Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Mon, 1 Jan 2024 01:28:28 +0100 Subject: [PATCH] extend interval raw file loading to `xschem raw read file type sweep1 sweep2` --- doc/xschem_man/developer_info.html | 15 ++++++++++----- src/scheduler.c | 25 +++++++++++++++++-------- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/doc/xschem_man/developer_info.html b/doc/xschem_man/developer_info.html index 28dfab55..953ab1c8 100644 --- a/doc/xschem_man/developer_info.html +++ b/doc/xschem_man/developer_info.html @@ -1080,9 +1080,11 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns" Debug: wrapper to propagate_hilights() function
  • push_undo
  •     Push current state on undo stack 
    -
  • raw what [rawfile type]
  • +   
  • raw what [rawfile type] [sweep1 sweep2]
  •         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 + sweep1 <= sweep_var < sweep2
  • raw_clear
  •     Unload all simulation raw files 
  • raw_query loaded|value|index|values|datasets|vars|list
  • @@ -1101,10 +1103,12 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
        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)
    -
  • raw_read [file] [sim]
  • +   
  • raw_read [file] [sim] [sweep1 sweep2]
  •     If a raw file is already loaded delete from memory
    -   else load specified file and analysis 'sim' (dc, ac, tran, op, ...)
    -   If 'sim' not specified load first section found in raw file. 
    + then load specified file and analysis 'sim' (dc, ac, tran, op, ...) + If 'sim' not specified load first section found in raw file. + if sweep1, sweep2 interval is given load only the interval + sweep1 <= sweep_var < sweep2
  • raw_read_from_attr [sim]
  •     If a simulation raw file is already loaded delete from memory
        else read section 'sim' (tran, dc, ac, op, ...)
    @@ -1477,6 +1481,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
     
     
     
    +
     
     
      
    diff --git a/src/scheduler.c b/src/scheduler.c
    index 4f9d01d3..e1e3e6b5 100644
    --- a/src/scheduler.c
    +++ b/src/scheduler.c
    @@ -3351,17 +3351,24 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
         else { cmd_found = 0;}
         break;
         case 'r': /*----------------------------------------------*/
    -    /* raw what [rawfile type]
    +    /* raw what [rawfile type] [sweep1 sweep2]
          * 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
    +     *   sweep1 <= sweep_var < sweep2 */
         if(!strcmp(argv[1], "raw"))
         {
    +      double sweep1 = -1.0, sweep2 = -1.0;
           int err = 0;
           int ret = 0;
           if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
           if(argc > 3 && !strcmp(argv[2], "read")) {
    -        if(argc > 4) ret = extra_rawfile(1, argv[3], argv[4], -1.0, -1.0);
    -        else ret = extra_rawfile(1, argv[3], NULL, -1.0, -1.0);
    +        if(argc > 6) {
    +          sweep1 = atof_spice(argv[5]);
    +          sweep2 = atof_spice(argv[6]);
    +        }
    +        if(argc > 4) ret = extra_rawfile(1, argv[3], argv[4], sweep1, sweep2);
    +        else ret = extra_rawfile(1, argv[3], NULL, sweep1, sweep2);
             Tcl_SetResult(interp, my_itoa(ret), TCL_VOLATILE);
           } else if(argc > 2 && !strcmp(argv[2], "switch")) {
             if(argc > 4) {
    @@ -3501,8 +3508,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
     
         /* raw_read [file] [sim] [sweep1 sweep2]
          *   If a raw file is already loaded delete from memory
    -     *   else load specified file and analysis 'sim' (dc, ac, tran, op, ...)
    -     *   If 'sim' not specified load first section found in raw file. */
    +     *   then load specified file and analysis 'sim' (dc, ac, tran, op, ...)
    +     *   If 'sim' not specified load first section found in raw file.
    +     *   if sweep1, sweep2 interval is given load only the interval
    +     *   sweep1 <= sweep_var < sweep2 */
         else if(!strcmp(argv[1], "raw_read"))
         {
           char f[PATH_MAX + 100];
    @@ -3524,8 +3533,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
             tcleval(f);
             my_strncpy(f, tclresult(), S(f));
             if(argc > 5) {
    -          sweep1 = atof(argv[4]);
    -          sweep2 = atof(argv[5]);
    +          sweep1 = atof_spice(argv[4]);
    +          sweep2 = atof_spice(argv[5]);
             }
             if(argc > 3) res = raw_read(f, &xctx->raw, argv[3], sweep1, sweep2);
             else res = raw_read(f, &xctx->raw, NULL, -1.0, -1.0);