Compare commits
No commits in common. "fb127d55f59f0b7db240bf4e7d80011fefec21f7" and "746ee34107d0917becf1b0807f1c8824911f3939" have entirely different histories.
fb127d55f5
...
746ee34107
@ -474,112 +474,6 @@ namespace tmpl {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Neuron handshaking.
|
|
||||||
* Looks for a rising edge on the neuron req.
|
|
||||||
* Then performs a 2d handshake out out_y then out_x.
|
|
||||||
*/
|
|
||||||
export
|
|
||||||
defproc neuron_hs_2D(a1of1 in; a1of1 out_x; a1of1 out_y; power supply; bool reset_B) {
|
|
||||||
bool _reset_BX;
|
|
||||||
BUF_X2 reset_buf(.a = reset_B, .y = _reset_BX, .vdd = supply.vdd, .vss = supply.vss);
|
|
||||||
|
|
||||||
bool _en, _req;
|
|
||||||
|
|
||||||
A_1C2N_RB_X1 A_ack(.c1 = _en, .n1 = _req, .n2 = in.r, .y = in.a,
|
|
||||||
.sr_B = _reset_BX, .sr_B = _reset_BX, .vss = supply.vss, .vdd = supply.vdd);
|
|
||||||
|
|
||||||
A_1C1P_X1 A_en(.p1 = _req, .c1 = in.a, .y = _en,
|
|
||||||
.vss = supply.vss, .vdd = supply.vdd);
|
|
||||||
|
|
||||||
bool _y_a_B, _x_a_B;
|
|
||||||
INV_X2 inv_x(.a = out_x.a, .y = _x_a_B, .vss = supply.vss, .vdd = supply.vdd);
|
|
||||||
INV_X2 inv_y(.a = out_y.a, .y = _y_a_B, .vss = supply.vss, .vdd = supply.vdd);
|
|
||||||
|
|
||||||
A_2C1P1N_RB_X1 A_req(.p1 = _x_a_B, .c1 = _en, .c2 = _y_a_B, .n1 = in.r,
|
|
||||||
.sr_B = _reset_BX, .sr_B = _reset_BX, .vdd = supply.vdd, .vss = supply.vss);
|
|
||||||
|
|
||||||
// y_req pull up
|
|
||||||
NAND2_X1 nand_y(.a = _y_a_B, .b = _req, .vdd = supply.vdd, .vss = supply.vss);
|
|
||||||
PULLUP_X4 pu_y(.a = nand_y.y, .y = out_y.r, .vdd = supply.vdd, .vss = supply.vss);
|
|
||||||
|
|
||||||
// x_req pull up
|
|
||||||
NAND3_X1 nand_x(.a = _x_a_B, .b = _req, .c = out_y.a, .vdd = supply.vdd, .vss = supply.vss);
|
|
||||||
PULLUP_X4 pu_x(.a = nand_x.y, .y = out_x.r, .vdd = supply.vdd, .vss = supply.vss);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export
|
|
||||||
defproc line_end_pull_down (bool? in; bool? reset_B; power supply; bool! out)
|
|
||||||
{
|
|
||||||
bool _out, __out, nor_out;
|
|
||||||
BUF_X1 buf1(.a=in, .y=_out, .vdd=supply.vdd,.vss=supply.vss);
|
|
||||||
BUF_X1 buf2(.a=_out, .y=__out, .vdd=supply.vdd,.vss=supply.vss);
|
|
||||||
INV_X1 inv(.a = __out, .vdd=supply.vdd,.vss =supply.vss);
|
|
||||||
|
|
||||||
NAND2_X1 aenor(.a=inv.y, .b=reset_B, .y = nor_out, .vdd=supply.vdd,.vss=supply.vss);
|
|
||||||
|
|
||||||
PULLDOWN_X4 pull_down(.a=nor_out, .y=out);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A 2d grid of neuron handshakers.
|
|
||||||
* Should then slot into the encoder.
|
|
||||||
* Each neuron has an a1of1 channel (in), which is tripped when a neuron spikes.
|
|
||||||
*/
|
|
||||||
export template<pint Nx, Ny>
|
|
||||||
defproc neuron_hs_2D_array(a1of1 in[Nx*Ny]; a1of1 out_x[Nx], out_y[Ny];
|
|
||||||
power supply; bool reset_B) {
|
|
||||||
|
|
||||||
// Make hella signal buffers
|
|
||||||
sigbuf<Ny> rsbx(.in = reset_B, .supply = supply);
|
|
||||||
sigbuf<Nx> rsb[Ny]; // ResetSigBuf
|
|
||||||
(j:Ny:
|
|
||||||
rsb[j].in = rsbx.out[j];
|
|
||||||
rsb[j].supply = supply;
|
|
||||||
)
|
|
||||||
|
|
||||||
// Create handshake grid
|
|
||||||
pint index;
|
|
||||||
neuron_hs_2D neurons[Nx*Ny];
|
|
||||||
(i:0..Nx-1:
|
|
||||||
(j:0..Ny-1:
|
|
||||||
index = i + j*Nx;
|
|
||||||
neurons[index].supply = supply;
|
|
||||||
neurons[index].reset_B = rsb[j].out[i];
|
|
||||||
neurons[index].in = in[index];
|
|
||||||
neurons[index].out_x = out_x[i];
|
|
||||||
neurons[index].out_y = out_y[j];
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
// Create line req pull downs
|
|
||||||
line_end_pull_down pd_x[Nx];
|
|
||||||
sigbuf<Nx> rsb_pd_x(.in = reset_B, .supply = supply);
|
|
||||||
(i:0..Nx-1:
|
|
||||||
pd_x[i].in = out_x[i].a;
|
|
||||||
pd_x[i].out = out_x[i].r;
|
|
||||||
pd_x[i].reset_B = rsb_pd_x.out[i];
|
|
||||||
pd_x[i].supply = supply;
|
|
||||||
)
|
|
||||||
|
|
||||||
// Create line req pull downs
|
|
||||||
line_end_pull_down pd_y[Ny];
|
|
||||||
sigbuf<Ny> rsb_pd_y(.in = reset_B, .supply = supply);
|
|
||||||
(j:0..Ny-1:
|
|
||||||
pd_y[j].in = out_y[j].a;
|
|
||||||
pd_y[j].out = out_y[j].r;
|
|
||||||
pd_y[j].reset_B = rsb_pd_y.out[j];
|
|
||||||
pd_y[j].supply = supply;
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -685,6 +685,33 @@ namespace tmpl {
|
|||||||
(i:((1<<N)-1):dly[i].vss = supply.vss;)
|
(i:((1<<N)-1):dly[i].vss = supply.vss;)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export
|
||||||
|
defproc line_end_pull_up (a1of1 in; bool? reset_B; power supply; bool! out)
|
||||||
|
{
|
||||||
|
bool _out, __out, nor_out;
|
||||||
|
BUF_X4 buf1(.a=in.a, .y=_out, .vdd=supply.vdd,.vss=supply.vss);
|
||||||
|
BUF_X4 buf2(.a=_out, .y=__out, .vdd=supply.vdd,.vss=supply.vss);
|
||||||
|
|
||||||
|
NOR2_X1 aenor(.a=_out, .b=reset_B, .y = nor_out, .vdd=supply.vdd,.vss=supply.vss);
|
||||||
|
|
||||||
|
PULLUP_X4 pull_up(.a=nor_out, .y=out);
|
||||||
|
}
|
||||||
|
|
||||||
|
export
|
||||||
|
defproc line_end_pull_down (a1of1 in; bool? reset_B; power supply; bool! out)
|
||||||
|
{
|
||||||
|
bool _out, __out, nor_out;
|
||||||
|
BUF_X4 buf1(.a=in.a, .y=_out, .vdd=supply.vdd,.vss=supply.vss);
|
||||||
|
BUF_X4 buf2(.a=_out, .y=__out, .vdd=supply.vdd,.vss=supply.vss);
|
||||||
|
|
||||||
|
NOR2_X1 aenor(.a=_out, .b=reset_B, .y = nor_out, .vdd=supply.vdd,.vss=supply.vss);
|
||||||
|
|
||||||
|
PULLUP_X4 pull_down(.a=nor_out, .y=out);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Appends a hard-coded word "VAL" to an input.
|
* Appends a hard-coded word "VAL" to an input.
|
||||||
* Works by piping through all sigs, but adding
|
* Works by piping through all sigs, but adding
|
||||||
@ -692,9 +719,6 @@ namespace tmpl {
|
|||||||
* N is size of channel to pipe through.
|
* N is size of channel to pipe through.
|
||||||
* NVAL is size of word to be put on output.
|
* NVAL is size of word to be put on output.
|
||||||
* VAL is word to be put on output.
|
* VAL is word to be put on output.
|
||||||
* Output looks like
|
|
||||||
* 0..............N........N+NVAL-1
|
|
||||||
* --input_data----LSB....MSB
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export template<pint N, NVAL, VAL>
|
export template<pint N, NVAL, VAL>
|
||||||
|
Loading…
Reference in New Issue
Block a user