Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@ -5,6 +5,8 @@
|
||||
* Copyright (c) 2022 University of Groningen - Ole Richter
|
||||
* Copyright (c) 2022 University of Groningen - Michele Mastella
|
||||
* Copyright (c) 2022 University of Groningen - Hugh Greatorex
|
||||
* Copyright (c) 2022 University of Groningen - Madison Cotteret
|
||||
*
|
||||
*
|
||||
* This source describes Open Hardware and is licensed under the CERN-OHL-W v2 or later
|
||||
*
|
||||
@ -149,6 +151,64 @@ namespace tmpl {
|
||||
f_buf_func[i].sr_B = _reset_BXX[i];
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Buffer_S template.
|
||||
* S maybe stands for special.
|
||||
* Like a buffer, except that the output function block does not load the data in
|
||||
* until the input data is valid.
|
||||
* Not entirely sure what the point of it is,
|
||||
* Ole says is useful for funky timing scenarios.
|
||||
*/
|
||||
export template<pint N>
|
||||
defproc buffer_s (avMx1of2<N> in; avMx1of2<N> out; bool? reset_B; power supply) {
|
||||
//control
|
||||
bool _en, _reset_BX,_reset_BXX[N];
|
||||
A_3C_RB_X4 inack_ctl(.c1=_en,.c2=in.v,.c3=out.v,.y=in.a,.pr_B=_reset_BX,.sr_B=_reset_BX,.vdd=supply.vdd,.vss=supply.vss);
|
||||
A_1C1P_X1 en_ctl(.c1=in.a,.p1=out.v,.y=_en,.vdd=supply.vdd,.vss=supply.vss);
|
||||
|
||||
|
||||
BUF_X1 reset_buf(.a=reset_B, .y=_reset_BX,.vdd=supply.vdd,.vss=supply.vss);
|
||||
sigbuf<N> reset_bufarray(.in=_reset_BX, .out=_reset_BXX);
|
||||
|
||||
//validity
|
||||
bool _in_v, _in_vX[N];
|
||||
vtree<N> vc(.in=in.d,.out=_in_v,.supply=supply);
|
||||
BUF_X4 in_v_buf4(.a=_in_v, .y=in.v,.vdd=supply.vdd,.vss=supply.vss);
|
||||
sigbuf<N> in_v_bufN(.in = in.v, .out = _in_vX, .supply = supply);
|
||||
|
||||
//function
|
||||
bool _out_a_BX_t[N],_out_a_BX_f[N],_out_a_B,_en_X_t[N],_en_X_f[N];
|
||||
A_2C2N_RB_X4 f_buf_func[N];
|
||||
A_2C2N_RB_X4 t_buf_func[N];
|
||||
sigbuf<N> en_buf_t(.in=_en, .out=_en_X_t, .supply=supply);
|
||||
sigbuf<N> en_buf_f(.in=_en, .out=_en_X_f, .supply=supply);
|
||||
INV_X1 out_a_inv(.a=out.a,.y=_out_a_B);
|
||||
sigbuf<N> out_a_B_buf_f(.in=_out_a_B,.out=_out_a_BX_t);
|
||||
sigbuf<N> out_a_B_buf_t(.in=_out_a_B,.out=_out_a_BX_f);
|
||||
// check if you can also do single var to array connect a=b[N]
|
||||
// and remove them from the loop
|
||||
(i:N:
|
||||
f_buf_func[i].y=out.d.d[i].f;
|
||||
t_buf_func[i].y=out.d.d[i].t;
|
||||
f_buf_func[i].c1=_en_X_f[i];
|
||||
t_buf_func[i].c1=_en_X_t[i];
|
||||
f_buf_func[i].c2=_out_a_BX_f[i];
|
||||
t_buf_func[i].c2=_out_a_BX_t[i];
|
||||
f_buf_func[i].n1=in.d.d[i].f;
|
||||
t_buf_func[i].n1=in.d.d[i].t;
|
||||
f_buf_func[i].n2=_in_vX[i];
|
||||
t_buf_func[i].n2=_in_vX[i];
|
||||
f_buf_func[i].vdd=supply.vdd;
|
||||
t_buf_func[i].vdd=supply.vdd;
|
||||
f_buf_func[i].vss=supply.vss;
|
||||
t_buf_func[i].vss=supply.vss;
|
||||
t_buf_func[i].pr_B = _reset_BXX[i];
|
||||
t_buf_func[i].sr_B = _reset_BXX[i];
|
||||
f_buf_func[i].pr_B = _reset_BXX[i];
|
||||
f_buf_func[i].sr_B = _reset_BXX[i];
|
||||
)
|
||||
}
|
||||
|
||||
export template<pint N>
|
||||
defproc demux (avMx1of2<N> in; avMx1of2<N> out1; avMx1of2<N> out2; bool? reset_B; avMx1of2<1> cond; power supply) {
|
||||
|
@ -3,6 +3,9 @@
|
||||
* This file is part of ACT dataflow neuro library
|
||||
*
|
||||
* Copyright (c) 2022 University of Groningen - Ole Richter
|
||||
* Copyright (c) 2022 University of Groningen - Madison Cotteret
|
||||
* Copyright (c) 2022 University of Groningen - Hugh Greatorex
|
||||
* Copyright (c) 2022 University of Groningen - Michele Mastella
|
||||
* Copyright (c) 2021 Rajit Manohar
|
||||
*
|
||||
* This source describes Open Hardware and is licensed under the CERN-OHL-W v2 or later
|
||||
@ -79,12 +82,121 @@ defproc ortree (bool? in[N]; bool! out; power supply)
|
||||
|
||||
/* array to hold the actual C-elments, either A2C or A3C */
|
||||
|
||||
[lenTree2Count > 0 ->
|
||||
[lenTree2Count > 0 ->
|
||||
OR2_X1 C2Els[lenTree2Count];
|
||||
]
|
||||
|
||||
[lenTree3Count > 0 ->
|
||||
OR3_X1 C3Els[lenTree3Count];
|
||||
OR3_X1 C3Els[lenTree3Count];
|
||||
]
|
||||
|
||||
(h:lenTree2Count:C2Els[h].vdd = supply.vdd;)
|
||||
(h:lenTree3Count:C3Els[h].vdd = supply.vdd;)
|
||||
|
||||
(h:lenTree2Count:C2Els[h].vss = supply.vss;)
|
||||
(h:lenTree3Count:C3Els[h].vss = supply.vss;)
|
||||
|
||||
/* Reset the variables we just stole lol */
|
||||
i = 0;
|
||||
end = N-1;
|
||||
j = 0;
|
||||
pint tree2Index = 0;
|
||||
pint tree3Index = 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+1 >= end ->
|
||||
/*-- last piece: use either a 2 input C-element --*/
|
||||
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].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].a = tmp[i];
|
||||
C2Els[tree2Index].b = tmp[i+1];
|
||||
C2Els[tree2Index].y = tmp[end+j];
|
||||
tree2Index = tree2Index +1;
|
||||
i = i + 2;
|
||||
]
|
||||
]
|
||||
/*-- update range that has to be combined --*/
|
||||
i = end+1;
|
||||
end = end+j;
|
||||
j = 0;
|
||||
]
|
||||
|
||||
out = tmp[end];
|
||||
}
|
||||
|
||||
export template<pint N>
|
||||
defproc andtree (bool? in[N]; bool! out; power supply)
|
||||
{
|
||||
bool tout;
|
||||
|
||||
{ N > 0 : "What?" };
|
||||
|
||||
pint i, end, j;
|
||||
i = 0;
|
||||
end = N-1;
|
||||
|
||||
pint lenTree2Count, lenTree3Count;
|
||||
lenTree2Count = 0;
|
||||
lenTree3Count = 0;
|
||||
/* Pre"calculate" the number of C cells required, look below if confused */
|
||||
*[ i != end ->
|
||||
j = 0;
|
||||
*[ i < end ->
|
||||
j = j + 1;
|
||||
[ i+1 >= end ->
|
||||
i = end;
|
||||
lenTree2Count = lenTree2Count +1;
|
||||
[] i+2 >= end ->
|
||||
i = end;
|
||||
lenTree3Count = lenTree3Count +1;
|
||||
[] else ->
|
||||
i = i + 2;
|
||||
lenTree2Count = lenTree2Count +1;
|
||||
]
|
||||
]
|
||||
/*-- update range that has to be combined --*/
|
||||
i = end+1;
|
||||
end = end+j;
|
||||
j = 0;
|
||||
]
|
||||
|
||||
/* array that holds ALL the nodes in the completion tree */
|
||||
bool tmp[end+1];
|
||||
(k:N:tmp[k] = in[k];)
|
||||
|
||||
/* array to hold the actual C-elments, either A2C or A3C */
|
||||
|
||||
[lenTree2Count > 0 ->
|
||||
AND2_X1 C2Els[lenTree2Count];
|
||||
]
|
||||
|
||||
[lenTree3Count > 0 ->
|
||||
AND3_X1 C3Els[lenTree3Count];
|
||||
]
|
||||
|
||||
(h:lenTree2Count:C2Els[h].vdd = supply.vdd;)
|
||||
|
Reference in New Issue
Block a user