differentiated between ctree and vtree, all primitives updated

This commit is contained in:
Michele
2022-03-01 09:44:51 +01:00
parent 92b0b36325
commit 8b40e70058
8 changed files with 789 additions and 115 deletions

View File

@ -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
@ -167,7 +167,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);
@ -251,7 +251,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
@ -312,107 +312,80 @@ namespace tmpl {
}
export template<pint N, pbool invout>
defproc demux_td (avMx1of2<N> in; avMx1of2<N> out1; avMx1of2<1> token; bool? reset_B; avMx1of2<1> cond; power supply) {
//control
bool _en, _reset_BX,_reset_BXX[2*N], _out_v, _in_c_v_;
// export template<pint N, pbool invout>
// defproc demux_td (avMx1of2<N> in; avMx1of2<N> out1; avMx1of2<1> token; bool? reset_B; avMx1of2<1> cond; power supply) {
// //control
// bool _en, _reset_BX,_reset_BXX[2*N], _out_v, _in_c_v_;
OR2_X1 out_or(.a=out1.v, .b=out2.v, .y=_out_v,.vdd=supply.vdd,.vss=supply.vss);
A_3C_RB_X4 inack_ctl(.c1=_en,.c2=_in_c_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<2*N> reset_bufarray(.in=_reset_BX, .out=_reset_BXX);
//validity
bool _in_v, _c_f_buf[N], _c_t_buf[N], _c_v;
// OR2_X1 out_or(.a=out1.v, .b=out2.v, .y=_out_v,.vdd=supply.vdd,.vss=supply.vss);
// A_3C_RB_X4 inack_ctl(.c1=_en,.c2=_in_c_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<2*N> reset_bufarray(.in=_reset_BX, .out=_reset_BXX);
// //validity
// bool _in_v, _c_f_buf[N], _c_t_buf[N], _c_v;
sigbuf<N> c_buf_t(.in=cond.d.d[0].t, .out=_c_t_buf);
sigbuf<N> c_buf_f(.in=cond.d.d[0].f, .out=_c_f_buf);
// sigbuf<N> c_buf_t(.in=cond.d.d[0].t, .out=_c_t_buf);
// sigbuf<N> c_buf_f(.in=cond.d.d[0].f, .out=_c_f_buf);
//orientation of condition
[ invout < 0 ->
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);
[] invout > 0 ->
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);
]
// //orientation of condition
// [ invout < 0 ->
// 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);
// [] invout > 0 ->
// 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);
// 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);
//function
//func buffer out1
bool _out1_a_BX_t[N],_out1_a_BX_f[N],_out1_a_B,_en1_X_t[N],_en1_X_f[N];
A_2C2N_RB_X4 out1_f_buf_func[N];
A_2C2N_RB_X4 out1_t_buf_func[N];
sigbuf<N> out1_en_buf_t(.in=_en, .out=_en1_X_t, .supply=supply);
sigbuf<N> out1_en_buf_f(.in=_en, .out=_en1_X_f, .supply=supply);
INV_X1 out1_a_inv(.a=out1.a,.y=_out1_a_B);
sigbuf<N> out1_a_B_buf_f(.in=_out1_a_B,.out=_out1_a_BX_t);
sigbuf<N> out1_a_B_buf_t(.in=_out1_a_B,.out=_out1_a_BX_f);
(i:N:
out1_f_buf_func[i].y=out1.d.d[i].f;
out1_t_buf_func[i].y=out1.d.d[i].t;
out1_f_buf_func[i].c1=_en1_X_f[i];
out1_t_buf_func[i].c1=_en1_X_t[i];
out1_f_buf_func[i].c2=_out1_a_BX_f[i];
out1_t_buf_func[i].c2=_out1_a_BX_t[i];
out1_f_buf_func[i].n1=in.d.d[i].f;
out1_t_buf_func[i].n1=in.d.d[i].t;
out1_f_buf_func[i].vdd=supply.vdd;
out1_t_buf_func[i].vdd=supply.vdd;
out1_f_buf_func[i].vss=supply.vss;
out1_t_buf_func[i].vss=supply.vss;
out1_t_buf_func[i].pr_B = _reset_BXX[i];
out1_t_buf_func[i].sr_B = _reset_BXX[i];
out1_f_buf_func[i].pr_B = _reset_BXX[i];
out1_f_buf_func[i].sr_B = _reset_BXX[i];
out1_f_buf_func[i].n2=_c_t_buf[i];
out1_t_buf_func[i].n2=_c_t_buf[i];
)
// //function
// //func buffer out1
// bool _out1_a_BX_t[N],_out1_a_BX_f[N],_out1_a_B,_en1_X_t[N],_en1_X_f[N];
// A_2C2N_RB_X4 out1_f_buf_func[N];
// A_2C2N_RB_X4 out1_t_buf_func[N];
// sigbuf<N> out1_en_buf_t(.in=_en, .out=_en1_X_t, .supply=supply);
// sigbuf<N> out1_en_buf_f(.in=_en, .out=_en1_X_f, .supply=supply);
// INV_X1 out1_a_inv(.a=out1.a,.y=_out1_a_B);
// sigbuf<N> out1_a_B_buf_f(.in=_out1_a_B,.out=_out1_a_BX_t);
// sigbuf<N> out1_a_B_buf_t(.in=_out1_a_B,.out=_out1_a_BX_f);
// (i:N:
// out1_f_buf_func[i].y=out1.d.d[i].f;
// out1_t_buf_func[i].y=out1.d.d[i].t;
// out1_f_buf_func[i].c1=_en1_X_f[i];
// out1_t_buf_func[i].c1=_en1_X_t[i];
// out1_f_buf_func[i].c2=_out1_a_BX_f[i];
// out1_t_buf_func[i].c2=_out1_a_BX_t[i];
// out1_f_buf_func[i].n1=in.d.d[i].f;
// out1_t_buf_func[i].n1=in.d.d[i].t;
// out1_f_buf_func[i].vdd=supply.vdd;
// out1_t_buf_func[i].vdd=supply.vdd;
// out1_f_buf_func[i].vss=supply.vss;
// out1_t_buf_func[i].vss=supply.vss;
// out1_t_buf_func[i].pr_B = _reset_BXX[i];
// out1_t_buf_func[i].sr_B = _reset_BXX[i];
// out1_f_buf_func[i].pr_B = _reset_BXX[i];
// out1_f_buf_func[i].sr_B = _reset_BXX[i];
// out1_f_buf_func[i].n2=_c_t_buf[i];
// out1_t_buf_func[i].n2=_c_t_buf[i];
// )
//token out
// //token out
A_2C2N_RB_X4 token_buf;
// A_2C2N_RB_X4 token_buf;
token_buf.y = ;
token_buf.c1 = ;
token_buf.c2 = ;
token_buf.n1 = ;
token_buf.n2 = ;
token_buf.vdd = supply.vdd;
token_buf.vss = supply.vss;
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
// token_buf.y = ;
// token_buf.c1 = ;
// token_buf.c2 = ;
// token_buf.n1 = ;
// token_buf.n2 = ;
// token_buf.vdd = supply.vdd;
// token_buf.vss = supply.vss;
// token_buf.pr_B ;
// token_buf.sr_b ;
// }
export
defproc arbiter_handshake(a1of1 in1; a1of1 in2; a1of1 out; power supply)
@ -466,8 +439,8 @@ namespace tmpl {
bool _in1_arb2function,_in2_arb2function;
bool _in1_arb2function_X[2*N],_in2_arb2function_X[2*N];
valtree<N> vc1(.in=in1.d,.out=in1.v,.supply=supply);
valtree<N> vc2(.in=in2.d,.out=in2.v,.supply=supply);
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;

View File

@ -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)
{