diff --git a/dataflow_neuro/primitives.act b/dataflow_neuro/primitives.act index 63edeeb..9d51a99 100644 --- a/dataflow_neuro/primitives.act +++ b/dataflow_neuro/primitives.act @@ -849,15 +849,23 @@ defproc slice_data(avMx1of2 in; avMx1of2 out; { 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: @@ -898,4 +906,33 @@ defproc slice_data(avMx1of2 in; avMx1of2 out; + + (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;) + } + + }}