From 9dbe4343e250f99e3a3a24fe46ab3f2977f2c606 Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Wed, 5 Oct 2022 02:23:37 +0200 Subject: [PATCH] added label notation EN[0:3:6:5]: EN[start:end:offset:repetitions], it will expand to a 20 bit bus: a[0],a[1],a[2],a[3],a[6],a[7],a[8],a[9],a[12],a[13],a[14],a[15],a[18],a[19],a[20],a[21],a[24],a[25],a[26],a[27] --- src/expandlabel.y | 34 +++++++++++++++++++++++++++++++++- src/scheduler.c | 2 +- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/expandlabel.y b/src/expandlabel.y index 208f3a25..6dad6c1d 100644 --- a/src/expandlabel.y +++ b/src/expandlabel.y @@ -361,7 +361,24 @@ list: B_NAME { idxsize=INITIALIDXSIZE; } ; -index: B_IDXNUM ':' B_IDXNUM ':' B_IDXNUM +index: B_IDXNUM ':' B_IDXNUM ':' B_IDXNUM ':' B_IDXNUM + { + /* start : end : extend : repetitions */ + int r, i, sign, offset; + sign = XSIGN($3-$1); + $$=my_malloc(1580, INITIALIDXSIZE*sizeof(int)); + $$[0]=0; + offset = 0; + for(r=0; r < $7; r++) { + for(i = $1;; i += sign) { + check_idx(&$$,++$$[0]); + $$[$$[0]] = i + offset; + if(i == $3) break; + } + offset += $5; + } + } + | B_IDXNUM ':' B_IDXNUM ':' B_IDXNUM { int i; int sign; @@ -399,6 +416,21 @@ index: B_IDXNUM ':' B_IDXNUM ':' B_IDXNUM check_idx(&$$, ++$$[0]); $$[$$[0]]=$1; } + | index ',' B_IDXNUM ':' B_IDXNUM ':' B_IDXNUM ':' B_IDXNUM + { + /* start : end : extend : repetitions */ + int r, i, sign, offset; + sign = XSIGN($5-$3); + offset = 0; + for(r=0; r < $9; r++) { + for(i = $3;; i += sign) { + check_idx(&$$,++$$[0]); + $$[$$[0]] = i + offset; + if(i == $5) break; + } + offset += $7; + } + } | index ',' B_IDXNUM ':' B_IDXNUM ':' B_IDXNUM { int i; diff --git a/src/scheduler.c b/src/scheduler.c index 5fc14bb5..512f9d81 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -758,7 +758,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(argc >=3) { l = expandlabel(argv[2], &tmp); llen = strlen(l); - dbg(0, "l=%s\n", l ? l : ""); + dbg(1, "l=%s\n", l ? l : ""); result = my_malloc(378, llen + 30); my_snprintf(result, llen + 30, "%s %d", l, tmp); Tcl_SetResult(interp, result, TCL_VOLATILE);