added decoder dualrail refresh
This commit is contained in:
@ -86,6 +86,63 @@ defproc decoder_dualrail (Mx1of2<Nc> in; bool? out[N]; power supply) {
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Dualrail decoder, but the signals to the decoders are refreshed every 48 gates.
|
||||
* final_refresh is signal at the end of the refresh line.
|
||||
* Is needed for doing validity checking etc, since it is the laggiest signal.
|
||||
*/
|
||||
export template<pint Nc, N>
|
||||
defproc decoder_dualrail_refresh (Mx1of2<Nc> in; bool? out[N]; Mx1of2<Nc> final_refresh; power supply) {
|
||||
// signal buffers
|
||||
pint index;
|
||||
pint NUM_REFRESH = N/(48*2); // x2 bc only half the output bits look for it.
|
||||
BUF_X12 in_tX[Nc*(NUM_REFRESH+1)];
|
||||
BUF_X12 in_fX[Nc*(NUM_REFRESH+1)];
|
||||
|
||||
(i:Nc:
|
||||
// Connect start
|
||||
in_tX[i].a = in.d[i].t;
|
||||
in_fX[i].a = in.d[i].f;
|
||||
|
||||
// Connect mid bois
|
||||
(j:NUM_REFRESH:
|
||||
index = i + (1+j)*Nc;
|
||||
in_tX[index].a = in_tX[index-Nc].y;
|
||||
)
|
||||
|
||||
// Connect end
|
||||
in_tX[i+NUM_REFRESH*Nc].y = final_refresh.d[i].t;
|
||||
in_fX[i+NUM_REFRESH*Nc].y = final_refresh.d[i].f;
|
||||
)
|
||||
|
||||
(i:Nc*(NUM_REFRESH+1):
|
||||
in_tX[i].vdd = supply.vdd;
|
||||
in_tX[i].vss = supply.vss;
|
||||
in_fX[i].vdd = supply.vdd;
|
||||
in_fX[i].vss = supply.vss;
|
||||
)
|
||||
|
||||
// AND trees
|
||||
pint bitval;
|
||||
andtree<Nc> atree[N];
|
||||
(k:0..N-1:atree[k].supply = supply;)
|
||||
(i:0..N-1:
|
||||
(j:0..Nc-1:
|
||||
bitval = (i & ( 1 << j )) >> j; // Get binary digit of integer i, column j
|
||||
[bitval = 1 ->
|
||||
atree[i].in[j] = in_tX[j+(i/96)*Nc].y;
|
||||
// atree[i].in[j] = addr_buf.out.d.d[j].t;
|
||||
[]bitval = 0 ->
|
||||
atree[i].in[j] = in_fX[j+(i/96)*Nc].y;
|
||||
// atree[i].in[j] = addr_buf.out.d.d[j].f;
|
||||
[]bitval >= 2 -> {false : "fuck"};
|
||||
]
|
||||
atree[i].out = out[i];
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Dualrail decoder with buffered outputs.
|
||||
* Be careful of out[] indexing.
|
||||
|
Reference in New Issue
Block a user