Fixed simlib.v model for $mem

This commit is contained in:
Clifford Wolf 2014-07-17 16:48:36 +02:00
parent 5867f6bcdc
commit f1ca93a0a3
1 changed files with 15 additions and 15 deletions

View File

@ -1346,13 +1346,13 @@ generate
always @(WR_ADDR or WR_DATA or WR_EN) begin
run_update = 0;
for (n = 0; n < WIDTH; n = n+1) begin
if (WR_EN[i][n]) begin
if (WR_EN[i*WIDTH + n]) begin
found_collision = 0;
for (k = i+1; k < WR_PORTS; k = k+1)
if (WR_EN[k][n] && WR_ADDR[ i*ABITS +: ABITS ] == WR_ADDR[ k*ABITS +: ABITS ])
if (WR_EN[k*WIDTH + n] && WR_ADDR[i*ABITS +: ABITS] == WR_ADDR[k*ABITS +: ABITS])
found_collision = 1;
if (!found_collision) begin
data[ WR_ADDR[ i*ABITS +: ABITS ] - OFFSET ][n] <= WR_DATA[ i*WIDTH +: WIDTH ][n];
data[WR_ADDR[i*ABITS +: ABITS] - OFFSET][n] <= WR_DATA[i*WIDTH + n];
run_update = 1;
end
end
@ -1367,13 +1367,13 @@ generate
always @(posedge WR_CLK[i]) begin
run_update = 0;
for (n = 0; n < WIDTH; n = n+1) begin
if (WR_EN[i][n]) begin
if (WR_EN[i*WIDTH + n]) begin
found_collision = 0;
for (k = i+1; k < WR_PORTS; k = k+1)
if (WR_EN[k][n] && WR_ADDR[ i*ABITS +: ABITS ] == WR_ADDR[ k*ABITS +: ABITS ])
if (WR_EN[k*WIDTH + n] && WR_ADDR[i*ABITS +: ABITS] == WR_ADDR[k*ABITS +: ABITS])
found_collision = 1;
if (!found_collision) begin
data[ WR_ADDR[ i*ABITS +: ABITS ] - OFFSET ][n] <= WR_DATA[ i*WIDTH +: WIDTH ][n];
data[WR_ADDR[i*ABITS +: ABITS] - OFFSET][n] <= WR_DATA[i*WIDTH + n];
run_update = 1;
end
end
@ -1387,13 +1387,13 @@ generate
always @(negedge WR_CLK[i]) begin
run_update = 0;
for (n = 0; n < WIDTH; n = n+1) begin
if (WR_EN[i][n]) begin
if (WR_EN[i*WIDTH + n]) begin
found_collision = 0;
for (k = i+1; k < WR_PORTS; k = k+1)
if (WR_EN[k][n] && WR_ADDR[ i*ABITS +: ABITS ] == WR_ADDR[ k*ABITS +: ABITS ])
if (WR_EN[k*WIDTH + n] && WR_ADDR[i*ABITS +: ABITS] == WR_ADDR[k*ABITS +: ABITS])
found_collision = 1;
if (!found_collision) begin
data[ WR_ADDR[ i*ABITS +: ABITS ] - OFFSET ][n] <= WR_DATA[ i*WIDTH +: WIDTH ][n];
data[WR_ADDR[i*ABITS +: ABITS] - OFFSET][n] <= WR_DATA[i*WIDTH + n];
run_update = 1;
end
end