Forum Discussion
KTsan
New Contributor
7 years agoHow to implement a module for accessing single block of on-chip memory in systemverilog?
Let say I want to model a 8 x 1024 bits Ram. I can generate a Single Port Ram Module from IP Catalog. I can access the on-chip memory via a single instance of this "Single Port Ram" module. Howeve...
Tricky
Occasional Contributor
7 years agoYou need an arbiter. With multiple masters for a single ram, you need some logic to decide who gets to access the ram in any given cycle.
for example:
always @(posedge clk)
begin
if (we(0) ) begin
mem_we <= we[0];
mem_din <= din[0];
end
else begin
mem_we <= we[1];
mem_din <= din[1];
end
end
Here, channel 0 has priority over channel 1. With several masters, arbitration schemes can get more complicated - modes like round-robin or lowest port priority are pretty common.