removed arbiter tree

This commit is contained in:
alexmadison 2022-03-03 11:56:59 +01:00
parent af52c688a3
commit 6fc3e4b99c
1 changed files with 1 additions and 109 deletions

View File

@ -26,6 +26,7 @@
**************************************************************************/ **************************************************************************/
import "../../dataflow_neuro/cell_lib_async.act"; import "../../dataflow_neuro/cell_lib_async.act";
import "../../dataflow_neuro/cell_lib_std.act"; import "../../dataflow_neuro/cell_lib_std.act";
import std::channel; import std::channel;
open std::channel; open std::channel;
namespace tmpl { namespace tmpl {
@ -419,114 +420,5 @@ defproc sigbuf (bool? in; bool! out[N]; power supply)
/*
* Build a completion tree using a combination of 2-input and 3-input
* arbiters
*/
export template<pint N>
defproc arbtree (bool? in[N]; bool! out; power supply)
{
bool tout;
{ N > 0 : "What?" };
pint i, end, j;
i = 0;
end = N-1;
pint arbCount;
arbCount = 0;
/* Pre"calculate" the number of C cells required, look below if confused */
*[ i != end ->
j = 0;
*[ i <= end ->
j = j + 1;
[i = end ->
i = end+1;
[] i+1 = end ->
i = end+1;
arbCount = arbCount +1;
[] else ->
i = i + 2;
arbCount = arbCount +1;
]
]
/*-- update range that has to be combined --*/
// i = end+1;
end = end+j;
]
/* array that holds ALL the nodes in the completion tree */
bool tmp[end+1];
// Connecting the first nodes to the input
(l:N:
tmp[l] = in[l];
)
/* array to hold the actual C-elments, either A2C or A3C */
[arbCount > 0 ->
OR2_X1 arbs[arbCount];
]
(h:arbCount:arbs[h].vdd = supply.vdd;)
(h:arbCount:arbs[h].vss = supply.vss;)
/* Reset the variables we just stole lol */
i = 0;
end = N-1;
j = 0;
pint arbIndex = 0;
/* Invariant: i <= end */
*[ i != end ->
/*
* Invariant: tmp[i..end] has the current signals that need to be
* combined together, and "isinv" specifies if they are the inverted
* sense or not
*/
j = 0;
*[ i <= end ->
/*-- there are still signals that need to be combined --*/
j = j + 1;
[ i = end ->
/*-- last piece: pipe input through to next layer --*/
tmp[end+j] = tmp[i];
i = end+1;
[] i+1 = end ->
/*-- last piece: use either a 2 input C-element --*/
arbs[arbIndex].a = tmp[i];
arbs[arbIndex].b = tmp[i+1];
arbs[arbIndex].y = tmp[end+j];
arbIndex = arbIndex +1;
i = end+1;
[] else ->
/*-- more to come; so use a two input C-element --*/
arbs[arbIndex].a = tmp[i];
arbs[arbIndex].b = tmp[i+1];
arbs[arbIndex].y = tmp[end+j];
arbIndex = arbIndex +1;
i = i + 2;
]
]
/*-- update range that has to be combined --*/
i = end+1;
end = end+j;
j = 0;
]
out = tmp[end];
}
}} }}