pushing in the meanwhile

This commit is contained in:
2022-02-21 18:27:41 +01:00
parent 0a5a271409
commit 6dd5df58a1
7 changed files with 157 additions and 17 deletions

View File

@ -269,7 +269,7 @@ namespace tmpl {
[keeper=0] ~a & ~s | ~b & ~_s -> _y+
a & _s | b & s -> _y-
_y => -y
_y => y-
}
sizing { _s{-1}; y{-1}; _y{-1}}
}
@ -296,7 +296,7 @@ namespace tmpl {
~_yab & ~s1 | ~_ycd & ~_s1 -> y+
}
sizing {_s0{-1}; _s1{-1}; y{-1}; _yab{-1} _ycd{-1}}
sizing {_s0{-1}; _s1{-1}; y{-1}; _yab{-1}; _ycd{-1}}
}

View File

@ -36,7 +36,6 @@ namespace tmpl {
export deftype power (bool?! vdd, vss) { }
export template<pint N>
defproc ortree (bool? in[N]; bool! out; power supply)
{
@ -49,7 +48,9 @@ defproc ortree (bool? in[N]; bool! out; power supply)
end = N-1;
pint lenTree2Count, lenTree3Count;
/* Pre"calculate" the number of C cells required, look below if confused */
lenTree2Count = 0;
lenTree3Count = 0;
/* Pre"calculate" the number of C cells required, look below if confused */
*[ i != end ->
j = 0;
*[ i < end ->
@ -72,7 +73,7 @@ defproc ortree (bool? in[N]; bool! out; power supply)
]
/* array that holds ALL the nodes in the completion tree */
bool tmp[end];
bool tmp[end+1];
(k:N:tmp[k] = in[k];)
/* array to hold the actual C-elments, either A2C or A3C */
@ -104,27 +105,26 @@ defproc ortree (bool? in[N]; bool! out; power supply)
*[ i < end ->
/*-- there are still signals that need to be combined --*/
j = j + 1;
bool tmp[end+j..end+j];
[ i+1 >= end ->
/*-- last piece: use either a 2 input C-element --*/
C2Els[tree2Index].c1 = tmp[i];
C2Els[tree2Index].c2 = tmp[i+1];
C2Els[tree2Index].a = tmp[i];
C2Els[tree2Index].b = tmp[i+1];
C2Els[tree2Index].y = tmp[end+j];
tree2Index = tree2Index +1;
i = end;
[] i+2 >= end ->
/*-- last piece: use either a 3 input C-element --*/
C3Els[tree3Index].c1 = tmp[i];
C3Els[tree3Index].c2 = tmp[i+1];
C3Els[tree3Index].c3 = tmp[i+2];
C3Els[tree3Index].a = tmp[i];
C3Els[tree3Index].b = tmp[i+1];
C3Els[tree3Index].c = tmp[i+2];
C3Els[tree3Index].y = tmp[end+j];
tree3Index = tree3Index +1;
i = end;
[] else ->
/*-- more to come; so use a two input C-element --*/
C2Els[tree2Index].c1 = tmp[i];
C2Els[tree2Index].c2 = tmp[i+1];
C2Els[tree2Index].a = tmp[i];
C2Els[tree2Index].b = tmp[i+1];
C2Els[tree2Index].y = tmp[end+j];
tree2Index = tree2Index +1;
i = i + 2;
@ -175,7 +175,7 @@ defproc ctree (bool? in[N]; bool! out; power supply)
]
/* array that holds ALL the nodes in the completion tree */
bool tmp[end];
bool tmp[end+1];
(k:N:tmp[k] = in[k];)
/* array to hold the actual C-elments, either A2C or A3C */
@ -207,7 +207,6 @@ defproc ctree (bool? in[N]; bool! out; power supply)
*[ i < end ->
/*-- there are still signals that need to be combined --*/
j = j + 1;
bool tmp[end+j..end+j];
[ i+1 >= end ->
/*-- last piece: use either a 2 input C-element --*/
C2Els[tree2Index].c1 = tmp[i];