Skip to content
Discussion options

You must be logged in to vote

AFAIK Yosys only makes a read synchronous if the port's address comes straight from a register. Because ram0/1/2 are each read at two addresses (r_addr[5:2] and r_addr_p_1), Yosys merges the two read ports into one whose address is a mux between them, so the port stays asynchronous, which produces LUT RAM. ram3 is never read at r_addr_p_1, so only it survives.

To fix this pick the address per RAM before the register, so each RAM has one registered read address:

reg [ADDRESS_BITS-3:0] r_raddr0, r_raddr1, r_raddr2, r_raddr3;
always_ff @(posedge clock) begin
    r_raddr0 <= addr[ADDRESS_BITS-1:2] + (addr[1:0] >= 2'd1);
    r_raddr1 <= addr[ADDRESS_BITS-1:2] + (addr[1:0] >= 2'd2);
    r_raddr2 …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sisuji
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants