added label notation EN[0:3:6:5]: EN[start🔚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]

This commit is contained in:
Stefan Frederik 2022-10-05 02:23:37 +02:00
parent 5fe2f1586b
commit 9dbe4343e2
2 changed files with 34 additions and 2 deletions

View File

@ -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;

View File

@ -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 : "<NULL>");
dbg(1, "l=%s\n", l ? l : "<NULL>");
result = my_malloc(378, llen + 30);
my_snprintf(result, llen + 30, "%s %d", l, tmp);
Tcl_SetResult(interp, result, TCL_VOLATILE);