register rw compiling:
This commit is contained in:
parent
b59a57c324
commit
be3cc7a2d7
@ -418,7 +418,6 @@ defproc registerA_w_array(avMx1of2<NcA + NcW + 1> in; Mx1of2<NcW> data[M];
|
|||||||
// Input valid tree
|
// Input valid tree
|
||||||
// Note that I may need to check the validity of other downstream stuff,
|
// Note that I may need to check the validity of other downstream stuff,
|
||||||
// to be ultra careful about delays.
|
// to be ultra careful about delays.
|
||||||
// e.g. TODO add validity checking on the selector signals.
|
|
||||||
vtree<NcA + NcW + 1> input_valid(.in = in.d, .out = in.v,
|
vtree<NcA + NcW + 1> input_valid(.in = in.d, .out = in.v,
|
||||||
.supply = supply);
|
.supply = supply);
|
||||||
|
|
||||||
@ -473,6 +472,155 @@ TIELO_X1 tielow_writebit_f[M];
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of registers made out of A-cells
|
||||||
|
* params:
|
||||||
|
* NcW: number of bits in Words to be stored in buffers
|
||||||
|
* NcA: number of bits in Address
|
||||||
|
* M: number of registers. M = 2^Nc_addr would be a natural choice.
|
||||||
|
* Input packets should be
|
||||||
|
* [-addr-][-word-][r/w]
|
||||||
|
*/
|
||||||
|
export template<pint NcA, NcW, M>
|
||||||
|
defproc registerA_wr_array(avMx1of2<NcA + NcW + 1> in; Mx1of2<NcW> data[M]; avMx1of2<NcA+NcW> out;
|
||||||
|
bool? reset_B; power supply) {
|
||||||
|
|
||||||
|
// BIG TODO
|
||||||
|
// I HAVE NOT BOTHERED WITH ANY SIGNAL BUFFERING IN HERE YET
|
||||||
|
|
||||||
|
// Input valid tree
|
||||||
|
// Note that I may need to check the validity of other downstream stuff,
|
||||||
|
// to be ultra careful about delays.
|
||||||
|
vtree<NcA + NcW + 1> input_valid(.in = in.d, .out = in.v,
|
||||||
|
.supply = supply);
|
||||||
|
|
||||||
|
|
||||||
|
// Address decoder
|
||||||
|
decoder_dualrail<NcA, M> decoder(.supply = supply);
|
||||||
|
(i:NcA:
|
||||||
|
decoder.in.d[i] = in.d.d[i];
|
||||||
|
)
|
||||||
|
|
||||||
|
// OrTree over acks from all registers
|
||||||
|
ortree<M> ack_ortree(.supply = supply);
|
||||||
|
|
||||||
|
bool _write_ack;
|
||||||
|
// C element handling in ack
|
||||||
|
A_2C_B_X1 in_ack_Cel(.c1 = ack_ortree.out, .c2 = input_valid.out, .y = _write_ack,
|
||||||
|
.vss = supply.vss, .vdd = supply.vdd);
|
||||||
|
|
||||||
|
// Bit to join the acks either from read or write
|
||||||
|
bool _read_ack;
|
||||||
|
_read_ack = out.a;
|
||||||
|
OR2_X1 ack_rw_or(.a = _read_ack, .b = _write_ack, .y = in.a,
|
||||||
|
.vdd = supply.vdd, .vss = supply.vss);
|
||||||
|
|
||||||
|
// Write bit selector
|
||||||
|
bool _w = in.d.d[NcA+NcW].t;
|
||||||
|
A_2C_B_X1 write_selectors[M];
|
||||||
|
(i:M:
|
||||||
|
write_selectors[i].c1 = _w;
|
||||||
|
write_selectors[i].c2 = decoder.out[i];
|
||||||
|
write_selectors[i].vdd = supply.vdd;
|
||||||
|
write_selectors[i].vss = supply.vss;
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
// Registers
|
||||||
|
registerA<NcW> registers[M];
|
||||||
|
TIELO_X1 tielow_writebit_f[M];
|
||||||
|
(i:M:
|
||||||
|
// Connect each register to word inputs.
|
||||||
|
(j:NcW:
|
||||||
|
registers[i].in.d.d[j] = in.d.d[j + NcA];
|
||||||
|
)
|
||||||
|
|
||||||
|
// Connect the (selected) write bit
|
||||||
|
registers[i].in.d.d[NcW].t = write_selectors[i].y;
|
||||||
|
tielow_writebit_f[i].vdd = supply.vdd;
|
||||||
|
tielow_writebit_f[i].vss = supply.vss;
|
||||||
|
registers[i].in.d.d[NcW].f = tielow_writebit_f[i].y;
|
||||||
|
|
||||||
|
// Connect to ack ortree
|
||||||
|
registers[i].in.a = ack_ortree.in[i];
|
||||||
|
|
||||||
|
// Connect outputs
|
||||||
|
data[i] = registers[i].out;
|
||||||
|
|
||||||
|
registers[i].supply = supply;
|
||||||
|
registers[i].reset_B = reset_B;
|
||||||
|
)
|
||||||
|
|
||||||
|
// Read bit selector
|
||||||
|
bool _r = in.d.d[NcA+NcW].f;
|
||||||
|
A_2C_B_X1 read_selectors[M];
|
||||||
|
(i:M:
|
||||||
|
read_selectors[i].c1 = _r;
|
||||||
|
read_selectors[i].c2 = decoder.out[i];
|
||||||
|
read_selectors[i].vdd = supply.vdd;
|
||||||
|
read_selectors[i].vss = supply.vss;
|
||||||
|
)
|
||||||
|
|
||||||
|
// OrTrees for each output word bit on read
|
||||||
|
ortree<M> out_ortrees_t[NcW];
|
||||||
|
ortree<M> out_ortrees_f[NcW];
|
||||||
|
(i:M:
|
||||||
|
out_ortrees_t[i].out = out.d.d[i+NcA].t;
|
||||||
|
out_ortrees_f[i].out = out.d.d[i+NcA].f;
|
||||||
|
|
||||||
|
out_ortrees_t[i].supply = supply;
|
||||||
|
out_ortrees_f[i].supply = supply;
|
||||||
|
)
|
||||||
|
|
||||||
|
// ANDs over each reg's data
|
||||||
|
// and whether it is selected for read.
|
||||||
|
AND2_X1 and_reads_t[NcW * M];
|
||||||
|
AND2_X1 and_reads_f[NcW * M];
|
||||||
|
pint index;
|
||||||
|
(i:NcW:
|
||||||
|
(j:M:
|
||||||
|
index = i * j*NcW;
|
||||||
|
|
||||||
|
and_reads_t[index].a = data[j].d[i].t;
|
||||||
|
and_reads_t[index].b = read_selectors[j].y;
|
||||||
|
and_reads_f[index].a = data[j].d[i].f;
|
||||||
|
and_reads_f[index].b = read_selectors[j].y;
|
||||||
|
|
||||||
|
and_reads_t[index].y = out_ortrees_t[i].in[j];
|
||||||
|
and_reads_f[index].y = out_ortrees_f[i].in[j];
|
||||||
|
|
||||||
|
and_reads_t[index].vss = supply.vss;
|
||||||
|
and_reads_t[index].vdd = supply.vdd;
|
||||||
|
and_reads_f[index].vss = supply.vss;
|
||||||
|
and_reads_f[index].vdd = supply.vdd;
|
||||||
|
)
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
// C elements passing address to out on read.
|
||||||
|
A_2C_B_X1 addr_read_t[NcA];
|
||||||
|
A_2C_B_X1 addr_read_f[NcA];
|
||||||
|
(i:NcA:
|
||||||
|
addr_read_t[i].c1 = in.d.d[i].t;
|
||||||
|
addr_read_f[i].c1 = in.d.d[i].f;
|
||||||
|
|
||||||
|
addr_read_t[i].c2 = _r;
|
||||||
|
addr_read_f[i].c2 = _r;
|
||||||
|
|
||||||
|
addr_read_t[i].y = out.d.d[i].t;
|
||||||
|
addr_read_f[i].y = out.d.d[i].f;
|
||||||
|
|
||||||
|
addr_read_t[i].vdd = supply.vdd;
|
||||||
|
addr_read_t[i].vss = supply.vss;
|
||||||
|
addr_read_f[i].vdd = supply.vdd;
|
||||||
|
addr_read_f[i].vss = supply.vss;
|
||||||
|
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user