merged buf_s into primitives
This commit is contained in:
@ -116,7 +116,7 @@ namespace tmpl {
|
||||
|
||||
//validity
|
||||
bool _in_v;
|
||||
ctree<N> vc(.in=in.d,.out=_in_v,.supply=supply);
|
||||
vtree<N> vc(.in=in.d,.out=_in_v,.supply=supply);
|
||||
BUF_X4 in_v_buf(.a=_in_v, .y=in.v,.vdd=supply.vdd,.vss=supply.vss);
|
||||
|
||||
//function
|
||||
@ -225,7 +225,7 @@ namespace tmpl {
|
||||
sigbuf<N> c_buf_f(.in=cond.d.d[0].f, .out=_c_f_buf);
|
||||
|
||||
OR2_X1 c_f_c_t_or(.a=cond.d.d[0].t, .b=cond.d.d[0].f, .y=_c_v,.vdd=supply.vdd,.vss=supply.vss);
|
||||
ctree<N> vc(.in=in.d,.out=_in_v,.supply=supply);
|
||||
vtree<N> vc(.in=in.d,.out=_in_v,.supply=supply);
|
||||
|
||||
A_2C_B_X1 c_el(.c1=_c_v, .c2=_in_v, .y=_in_c_v_,.vdd=supply.vdd,.vss=supply.vss);
|
||||
BUF_X4 in_v_buf(.a=_in_v, .y=in.v,.vdd=supply.vdd,.vss=supply.vss);
|
||||
@ -309,7 +309,7 @@ namespace tmpl {
|
||||
|
||||
//validity
|
||||
bool _in_v;
|
||||
ctree<N> vc(.in=in.d,.out=_in_v,.supply=supply);
|
||||
vtree<N> vc(.in=in.d,.out=_in_v,.supply=supply);
|
||||
BUF_X4 in_v_buf(.a=_in_v, .y=in.v,.vdd=supply.vdd,.vss=supply.vss);
|
||||
|
||||
//function
|
||||
@ -394,7 +394,7 @@ namespace tmpl {
|
||||
// OR2_X1 c_f_c_t_or(.a=cond.d.d[0].f, .b=cond.d.d[0].t, .y=_c_v,.vdd=supply.vdd,.vss=supply.vss);
|
||||
// ]
|
||||
|
||||
// ctree<N> vc(.in=in.d,.out=_in_v,.supply=supply);
|
||||
// vtree<N> vc(.in=in.d,.out=_in_v,.supply=supply);
|
||||
|
||||
// A_2C_B_X1 c_el(.c1=_c_v, .c2=_in_v, .y=_in_c_v_,.vdd=supply.vdd,.vss=supply.vss);
|
||||
// BUF_X4 in_v_buf(.a=_in_v, .y=in.v,.vdd=supply.vdd,.vss=supply.vss);
|
||||
@ -445,33 +445,6 @@ namespace tmpl {
|
||||
// token_buf.pr_B ;
|
||||
// token_buf.sr_b ;
|
||||
// }
|
||||
|
||||
// export template<pint N>
|
||||
// defproc merge (avMx1of2<N> in1; avMx1of2<N> in2; avMx1of2<N> out ; bool? reset_B; power supply) {
|
||||
|
||||
// //control
|
||||
// bool _en, _reset_BX,_reset_BXX[N];
|
||||
// A_4C_RB_X4 in1ack_ctl(.c1=in1arb,.c2=_en,.c3=in1.v,.c4=out.v,.y=in1.a,.pr_B=_reset_BX,.sr_B=_reset_BX,.vdd=supply.vdd,.vss=supply.vss);
|
||||
// A_4C_RB_X4 in2ack_ctl(.c1=in2arb,.c2=_en,.c3=in2.v,.c4=out.v,.y=in2.a,.pr_B=_reset_BX,.sr_B=_reset_BX,.vdd=supply.vdd,.vss=supply.vss);
|
||||
// A_4P_1N1N en_ctl(.p1 = in1.a,.p2=in2.a,.p3=out_a_X,.p4 = out.v, .n1 = in1.a,.y = _en,.vdd=supply.vdd,.vss=supply.vss);
|
||||
|
||||
// //reset_buffers
|
||||
// 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 _in1_v,_in2_v;
|
||||
// a1of1 _in1_temp,_in2_temp,_out_temp;
|
||||
// ctree<N> vc1(.in=in1.d,.out=in1.v,.supply=supply);
|
||||
// ctree<N> vc2(.in=in2.d,.out=in2.v,.supply=supply);
|
||||
// arbiter_handshake validity_arb(.in1 = _in1_temp,.in2 = _in2_temp,.out =_out_temp)
|
||||
// _in1_temp.r = in1.v
|
||||
// _in2_temp.r = in2.v
|
||||
// _in1_temp.a =
|
||||
// _in1_temp.a =
|
||||
// _out_temp.r = _out_temp.a
|
||||
//function
|
||||
// }
|
||||
export
|
||||
defproc arbiter_handshake(a1of1 in1; a1of1 in2; a1of1 out; power supply)
|
||||
{
|
||||
@ -502,6 +475,74 @@ namespace tmpl {
|
||||
BUF_X1 reset_buf(.a=reset_B, .y=_reset_BX,.vdd=supply.vdd,.vss=supply.vss);
|
||||
}
|
||||
|
||||
export template<pint N>
|
||||
defproc merge (avMx1of2<N> in1; avMx1of2<N> in2; avMx1of2<N> out ; bool? reset_B; power supply) {
|
||||
|
||||
//control
|
||||
bool _in1_a_B,_in2_a_B,_en, _reset_BX,_reset_BXX[2*N];
|
||||
bool _in1_arb,_in2_arb,_out_a_X[2*N+1];
|
||||
A_4C_RB_X4 in1ack_ctl(.c1=_in1_arb,.c2=_en,.c3=in1.v,.c4=out.v,.y=in1.a,.pr_B=_reset_BX,.sr_B=_reset_BX,.vdd=supply.vdd,.vss=supply.vss);
|
||||
A_4C_RB_X4 in2ack_ctl(.c1=_in2_arb,.c2=_en,.c3=in2.v,.c4=out.v,.y=in2.a,.pr_B=_reset_BX,.sr_B=_reset_BX,.vdd=supply.vdd,.vss=supply.vss);
|
||||
A_4P1N1N_X1 en_ctl(.p1 = in1.a,.p2=in2.a,.p3=_out_a_X[N],.p4 = out.v, .n1 = in1.a,.y = _en,.vdd=supply.vdd,.vss=supply.vss);
|
||||
INV_X1 in1ack_ctl_inv(.a=in1.a,.y=_in1_a_B,.vdd=supply.vdd,.vss=supply.vss);
|
||||
INV_X1 in2ack_ctl_inv(.a=in2.a,.y=_in2_a_B,.vdd=supply.vdd,.vss=supply.vss);
|
||||
|
||||
//reset_buffers
|
||||
BUF_X1 reset_buf(.a=reset_B, .y=_reset_BX,.vdd=supply.vdd,.vss=supply.vss);
|
||||
sigbuf<N*2> reset_bufarray(.in=_reset_BX, .out=_reset_BXX);
|
||||
|
||||
//validity
|
||||
a1of1 _in1_temp,_in2_temp,_out_temp;
|
||||
|
||||
bool _in1_arb2function,_in2_arb2function;
|
||||
bool _in1_arb2function_X[2*N],_in2_arb2function_X[2*N];
|
||||
|
||||
vtree<N> vc1(.in=in1.d,.out=in1.v,.supply=supply);
|
||||
vtree<N> vc2(.in=in2.d,.out=in2.v,.supply=supply);
|
||||
arbiter_handshake validity_arb(.in1 = _in1_temp,.in2 = _in2_temp,.out =_out_temp);
|
||||
_in1_temp.r = in1.v;
|
||||
_in2_temp.r = in2.v;
|
||||
_in1_temp.a = _in1_arb;
|
||||
_in1_temp.a = _in2_arb;
|
||||
_out_temp.r = _out_temp.a;
|
||||
AND2_X1 AND_arb1(.a = _in2_a_B,.b = _in1_arb, .y = _in1_arb2function);
|
||||
AND2_X1 AND_arb2(.a = _in1_a_B,.b = _in2_arb, .y = _in2_arb2function);
|
||||
sigbuf<2*N> arb2function1(.in = _in1_arb2function,.out = _in1_arb2function_X);
|
||||
sigbuf<2*N> arb2function2(.in = _in2_arb2function,.out = _in2_arb2function_X);
|
||||
|
||||
//function
|
||||
A_2C2N2N_R_X1 merge_func_t[N];
|
||||
A_2C2N2N_R_X1 merge_func_f[N];
|
||||
sigbuf<N*2+1> buf_out_a(.in = out.a,.out = _out_a_X);
|
||||
buf_out_a.supply=supply;
|
||||
buf_out_a.supply=supply;
|
||||
(i:N:
|
||||
merge_func_t[i].c1 = _en;
|
||||
merge_func_t[i].c2 = _out_a_X[i];
|
||||
merge_func_t[i].n1 = _in1_arb2function_X[i];
|
||||
merge_func_t[i].n2 = in1.d.d[i].t;
|
||||
merge_func_t[i].n3 = _in2_arb2function_X[i];
|
||||
merge_func_t[i].n4 = in2.d.d[i].t;
|
||||
merge_func_t[i].y = out.d.d[i].t;
|
||||
merge_func_t[i].vdd=supply.vdd;
|
||||
merge_func_t[i].vss=supply.vss;
|
||||
merge_func_t[i].pr_B = _reset_BXX[i+N-1];
|
||||
merge_func_t[i].sr_B = _reset_BXX[i+N-1];
|
||||
|
||||
merge_func_f[i].c1 = _en;
|
||||
merge_func_f[i].c2 = _out_a_X[i+N-1];
|
||||
merge_func_f[i].n1 = _in1_arb2function_X[i+N-1];
|
||||
merge_func_f[i].n2 = in1.d.d[i].f;
|
||||
merge_func_f[i].n3 = _in2_arb2function_X[i+N-1];
|
||||
merge_func_f[i].n4 = in2.d.d[i].f;
|
||||
merge_func_f[i].y = out.d.d[i].f;
|
||||
merge_func_f[i].vdd=supply.vdd;
|
||||
merge_func_f[i].vss=supply.vss;
|
||||
merge_func_f[i].pr_B = _reset_BXX[i];
|
||||
merge_func_f[i].sr_B = _reset_BXX[i];
|
||||
)
|
||||
}
|
||||
|
||||
export
|
||||
defproc buffer_t(a1of1 in; a1of1 out; bool? reset_B; power supply)
|
||||
{
|
||||
|
@ -151,7 +151,7 @@ defproc ortree (bool? in[N]; bool! out; power supply)
|
||||
* C-elements
|
||||
*/
|
||||
export template<pint N>
|
||||
defproc ctree (std::data::Mx1of2?<N> in; bool! out; power supply)
|
||||
defproc ctree (bool? in[N]; bool! out; power supply)
|
||||
{
|
||||
bool tout;
|
||||
|
||||
@ -187,19 +187,11 @@ defproc ctree (std::data::Mx1of2?<N> in; bool! out; power supply)
|
||||
|
||||
/* array that holds ALL the nodes in the completion tree */
|
||||
bool tmp[end+1];
|
||||
// OR layer for making OR between true and false of in (they are then sent to Ctree)
|
||||
OR2_X1 OR2_tf[N];
|
||||
|
||||
// Connecting the first nodes to the input
|
||||
(l:N:
|
||||
OR2_tf[l].a = in.d[l].t;
|
||||
OR2_tf[l].b = in.d[l].f;
|
||||
OR2_tf[l].y = tmp[l];
|
||||
// OR2_tf[i].a = supply.vdd;
|
||||
// OR2_tf[i].b = supply.vdd;
|
||||
// OR2_tf[i].y = supply.vdd;
|
||||
OR2_tf[l].vdd = supply.vdd;
|
||||
OR2_tf[l].vss = supply.vss;
|
||||
)
|
||||
//(k:N:tmp[k] = in[k];)
|
||||
tmp[l] = in[l];
|
||||
)
|
||||
|
||||
/* array to hold the actual C-elments, either A2C or A3C */
|
||||
[lenTree2Count > 0 ->
|
||||
@ -271,6 +263,22 @@ defproc ctree (std::data::Mx1of2?<N> in; bool! out; power supply)
|
||||
|
||||
}
|
||||
|
||||
export template<pint N>
|
||||
defproc vtree (std::data::Mx1of2?<N> in; bool! out; power supply)
|
||||
{
|
||||
// OR layer for making OR between true and false of in (they are then sent to Ctree)
|
||||
OR2_X1 OR2_tf[N];
|
||||
ctree<N> myctree;
|
||||
(l:N:
|
||||
OR2_tf[l].a = in.d[l].t;
|
||||
OR2_tf[l].b = in.d[l].f;
|
||||
OR2_tf[l].y = myctree.in[l];
|
||||
OR2_tf[l].vdd = supply.vdd;
|
||||
OR2_tf[l].vss = supply.vss;
|
||||
)
|
||||
myctree.supply = supply;
|
||||
out = myctree.out;
|
||||
}
|
||||
export template<pint N>
|
||||
defproc sigbuf (bool? in; bool! out[N]; power supply)
|
||||
{
|
||||
|
Reference in New Issue
Block a user