So it turns out that despite having a better looking RTL the memory is
still using an exorbitant amount of FPGA area. I made another memory
that's simpler (not writable) but is 7 times larger (56bit word size)
and it takes 1/8th the FPGA logic.
1 | module sysmem (
|
2 | A,
|
3 | WR,
|
4 | D,
|
5 | READY
|
6 | );
|
7 |
|
8 | //input ports
|
9 | input [7:0] A;
|
10 | input WR;
|
11 |
|
12 | //output ports
|
13 | inout [7:0] D;
|
14 | output READY;
|
15 |
|
16 | //registers/wires
|
17 | reg [7:0] Dout;
|
18 | reg [7:0] memdat [0:127];
|
19 | reg READY;
|
20 | reg [7:0] membuf;
|
21 |
|
22 | initial begin
|
23 | $readmemh("sysinit.txt", memdat);
|
24 | end
|
25 |
|
26 | assign D = (WR) ? Dout : 8'bz;
|
27 |
|
28 | always @ (*)
|
29 | begin
|
30 |
|
31 | membuf = memdat[A];
|
32 | begin: rdyset
|
33 | if (membuf == D)
|
34 | READY = 1'b1;
|
35 | else
|
36 | READY = 1'b0;
|
37 | end
|
38 | end
|
39 | always @ (A)
|
40 | begin
|
41 | begin: memread
|
42 | Dout = memdat[A];
|
43 | end
|
44 | end
|
45 | always @ (posedge WR)
|
46 | begin
|
47 | begin: memwrite
|
48 | memdat[A] = D;
|
49 | end
|
50 | end
|
51 | endmodule
|
I shrank the memory size so it would compile faster. Also for some
reason this is compiling into a dual port memory. Not sure why. A
screenshot of the RTL is attached.
If you know how to make the memory take less area I'd like to hear it.