From 0ade5522a2c2f2e86d840599d1d7dce804a3c4d4 Mon Sep 17 00:00:00 2001 From: Hugh Date: Mon, 4 Apr 2022 17:46:51 +0200 Subject: [PATCH] merge of prims --- dataflow_neuro/primitives.act | 66 +++++++++-------------------------- 1 file changed, 17 insertions(+), 49 deletions(-) diff --git a/dataflow_neuro/primitives.act b/dataflow_neuro/primitives.act index 9d51a99..e492527 100644 --- a/dataflow_neuro/primitives.act +++ b/dataflow_neuro/primitives.act @@ -78,8 +78,8 @@ namespace tmpl { [(&i:M: d.d[i].t | d.d[i].f)]; self := 0; (;i:M: [ d.d[i].t -> self := self | (1 << i) - [] else -> skip - ] + [] else -> skip + ] ) } @@ -117,8 +117,8 @@ namespace tmpl { BUF_X1 reset_buf(.a=reset_B, .y=_reset_BX,.vdd=supply.vdd,.vss=supply.vss); - sigbuf reset_bufarray(.in=_reset_BX, .out=_reset_BXX); - + sigbuf reset_bufarray(.in=_reset_BX, .out=_reset_BXX); + //validity bool _in_v; vtree vc(.in=in.d,.out=_in_v,.supply=supply); @@ -429,6 +429,7 @@ namespace tmpl { BUF_X1 c_buf_tk_inv(.a=cond_inv_t, .y=_c_tk_buf, .vss = supply.vss, .vdd = supply.vdd); sigbuf c_buf_d_inv(.in=cond_inv_f, .out=_c_d_buf, .supply=supply); ] + vtree vc(.in=in.d,.out=_in_v,.supply=supply); @@ -844,57 +845,12 @@ defproc slice_data(avMx1of2 in; avMx1of2 out; // {N0 >= 0 : "N0 can be minimum 0!"}; // {N1 <= N : "N1 can be maximum N"}; - export template - defproc demux_bit (avMx1of2 in; avMx1of2 out1; avMx1of2 out2; bool? reset_B; power supply) - { - demux demux(.reset_B = reset_B, .out1=out1, .out2=out2); pint _N1, _N0; - export template - defproc demux_bit (avMx1of2 in; avMx1of2 out1; avMx1of2 out2; bool? reset_B; power supply) - { - demux demux(.reset_B = reset_B, .out1=out1, .out2=out2); - in.d.d[CONDITION_BIT].f = demux.cond.d.d[0].f; - in.d.d[CONDITION_BIT].t = demux.cond.d.d[0].t; _N1 = std::min(N1,N); _N0 = std::max(N0,0); - in.d.d[CONDITION_BIT].f = demux.cond.d.d[0].f; - in.d.d[CONDITION_BIT].t = demux.cond.d.d[0].t; - in.v = demux.in.v; - in.a = demux.in.a; BUF_X1 ack_buf(.a = out.a, .y = in.a, .vss = supply.vss, .vdd = supply.vdd); - in.v = demux.in.v; - in.a = demux.in.a; - - - (i:0..CONDITION_BIT: - in.d.d[i].f = demux.in.d.d[i].f; - in.d.d[i].t = demux.in.d.d[i].t;) - - (i:CONDITION_BIT..N-1: - in.d.d[i].f = demux.in.d.d[i].f; - in.d.d[i].t = demux.in.d.d[i].t;) - - } - - export template - defproc demux_bit_msb (avMx1of2 in; avMx1of2 out1; avMx1of2 out2; bool? reset_B; power supply) - { - demux demux(.reset_B = reset_B, .out1=out1, .out2=out2); - - in.d.d[N+1].f = demux.cond.d.d[0].f; - in.d.d[N+1].t = demux.cond.d.d[0].t; - - in.v = demux.in.v; - in.a = demux.in.a; - - - (i:0..N: - in.d.d[i].f = demux.in.d.d[i].f; - in.d.d[i].t = demux.in.d.d[i].t;) - } - vtree in_vt(.in = in.d, .out = in.v, .supply = supply); (i:_N1-_N0: @@ -905,6 +861,16 @@ defproc slice_data(avMx1of2 in; avMx1of2 out; } + export template + defproc demux_bit (avMx1of2 in; avMx1of2 out1; avMx1of2 out2; bool? reset_B; power supply) + { + demux demux(.reset_B = reset_B, .out1=out1, .out2=out2); + + in.d.d[CONDITION_BIT].f = demux.cond.d.d[0].f; + in.d.d[CONDITION_BIT].t = demux.cond.d.d[0].t; + + in.v = demux.in.v; + in.a = demux.in.a; (i:0..CONDITION_BIT: @@ -935,4 +901,6 @@ defproc slice_data(avMx1of2 in; avMx1of2 out; } + + }}