Proper way to make LUT ROMs #4430
-
I want to make a LUT ROM to drive an LED matrix. So far I've written something like this: wire [0:63] b2_inner;
always @* begin
casex (line)
5'b00000: b2_inner = 64'h00000001f8000730;
5'b00001: b2_inner = 64'h00000000fe001fc0;
5'b00010: b2_inner = 64'h000000007fc0ff80;
5'b00011: b2_inner = 64'h000000001ffffe00;
5'b00100: b2_inner = 64'h0000000007fff800;
5'b00101: b2_inner = 64'h0000000001ffe000;
5'b0011x: b2_inner = 64'h0000000000000000;
5'b01xxx: b2_inner = 64'h0000000000000000;
5'b1xxxx: b2_inner = 64'h0000000000000000;
endcase
b2 = b2_inner[column];
end where
Basically, I want to have a combinatorial circuit (without latches) that gives me an output signal depending on the input coordinates. Is there a proper way to do this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The warning is just complaining that it's a syntax error to declare a signal as
And it even explicitly notes that your code does not model any latch:
So at least in that regard everything seems to be working as intended. There is the In general if you are targeting a specific memory style the supported patterns for how to write them are here in the documentation. |
Beta Was this translation helpful? Give feedback.
The warning is just complaining that it's a syntax error to declare a signal as
wire
and then assign it in analways
block. You have to use thereg
keyword in that case. Other than that the code does get interpreted as a combinatorial circuit and doesn't infer any latches, e.g. if I just put it in its own module and runsynth_ice40
on that, the final stat shows it's converted into only LUTs:And it even explicitly notes that your code does not model any latch: