Compare commits
No commits in common. "4a4c4eeb143218086c2c680c72ffb4b87f83bd43" and "18cf090b45a1a3cc72af36b588f603788b0750fb" have entirely different histories.
4a4c4eeb14
...
18cf090b45
@ -34,14 +34,6 @@ import "../../dataflow_neuro/primitives.act";
|
|||||||
import std::channel;
|
import std::channel;
|
||||||
open std::channel;
|
open std::channel;
|
||||||
|
|
||||||
import std::data;
|
|
||||||
open std::data;
|
|
||||||
|
|
||||||
|
|
||||||
// import dev::channel;
|
|
||||||
// open dev::channel;
|
|
||||||
|
|
||||||
|
|
||||||
namespace tmpl {
|
namespace tmpl {
|
||||||
namespace dataflow_neuro {
|
namespace dataflow_neuro {
|
||||||
|
|
||||||
@ -234,56 +226,6 @@ namespace tmpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Generates the OR-trees required to go from
|
|
||||||
// N one-hot inputs to Nc dual rail binary encoding.
|
|
||||||
export template<pint Nc, N>
|
|
||||||
defproc encoder(bool? in[N]; Mx1of2<Nc> out; power supply) {
|
|
||||||
{N <= 1<<Nc : "Num inputs too wide for encoding channel!"};
|
|
||||||
|
|
||||||
// For each output line, need to precalculate how big of an OR tree it needs
|
|
||||||
// since can't presume that N = 2**Nc
|
|
||||||
// First version however, just be hella lazy and presume N=2**Nc,
|
|
||||||
// connect extra nodes to ground (sorry)
|
|
||||||
pint _N; // N rounded up to a power of 2
|
|
||||||
_N = (1<<Nc);
|
|
||||||
ortree<_N/2> ors_t[Nc];
|
|
||||||
ortree<_N/2> ors_f[Nc];
|
|
||||||
(i:Nc:ors_t[i].supply = supply; ors_t[i].out = out.d[i].t;)
|
|
||||||
(i:Nc:ors_f[i].supply = supply; ors_f[i].out = out.d[i].f;)
|
|
||||||
|
|
||||||
pint num_connected_t; // Number of guys already connected to the current OR tree
|
|
||||||
pint num_connected_f;
|
|
||||||
|
|
||||||
TIELO_X1 tielo(.vdd = supply.vdd, .vss = supply.vss); // I'm sorry
|
|
||||||
pint bitval;
|
|
||||||
(i:0..Nc-1: // For each output line
|
|
||||||
num_connected_t = 0;
|
|
||||||
num_connected_f = 0;
|
|
||||||
(j:0.. _N-1:
|
|
||||||
bitval = (j & ( 1 << i )) >> i; // Get binary digit of integer j, column i
|
|
||||||
[bitval = 1 & j <= N-1->
|
|
||||||
ors_t[i].in[num_connected_t] = in[j];
|
|
||||||
num_connected_t = num_connected_t + 1;
|
|
||||||
[] bitval = 0 & j <= N-1->
|
|
||||||
ors_f[i].in[num_connected_f] = in[j];
|
|
||||||
num_connected_f = num_connected_f + 1;
|
|
||||||
[] bitval = 1 & j > N-1->
|
|
||||||
ors_t[i].in[num_connected_t] = tielo.y;
|
|
||||||
num_connected_t = num_connected_t + 1;
|
|
||||||
[] bitval = 0 & j > N-1->
|
|
||||||
ors_f[i].in[num_connected_f] = tielo.y;
|
|
||||||
num_connected_f = num_connected_f + 1;
|
|
||||||
]
|
|
||||||
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<pint N, pint M,pint address_size, pint ACK_STRENGTH>
|
template<pint N, pint M,pint address_size, pint ACK_STRENGTH>
|
||||||
defproc encoder2D(a1of1 x[N]; a1of1 y[M] ;avMx1of2<address_size> addr; power supply; bool reset_B) {
|
defproc encoder2D(a1of1 x[N]; a1of1 y[M] ;avMx1of2<address_size> addr; power supply; bool reset_B) {
|
||||||
// Reset buffers
|
// Reset buffers
|
||||||
@ -410,10 +352,12 @@ namespace tmpl {
|
|||||||
sigbuf_1output<4> addr_validity_x(.in = _addr_v,.out = addr.v);
|
sigbuf_1output<4> addr_validity_x(.in = _addr_v,.out = addr.v);
|
||||||
addr_validity.supply = supply;
|
addr_validity.supply = supply;
|
||||||
addr_validity_x.supply = supply;
|
addr_validity_x.supply = supply;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user