- if (vraminuse) begin
- if ((posx == 0) || ((posx > 2) && (vxpos[2:0] == 3'b101)))
- tileno <= bgmap1[bgmapaddr];
- else if ((posx == 1) || ((posx > 2) && (vxpos[2:0] == 3'b110)))
- tilelowtmp <= tiledata[{tileaddr, 1'b0}];
- else if ((posx == 2) || ((posx > 2) && (vxpos[2:0] == 3'b111))) begin
- tilehigh <= tiledata[{tileaddr, 1'b1}];
- tilelow <= tilelowtmp;
- end
- end else begin
- if (decode_tiledata) begin
- tilelowtmp <= tiledata[addr[12:0]];
- if (wr)
- tiledata[addr[12:0]] <= data;
- end else if (decode_bgmap1) begin
- tileno <= bgmap1[addr[12:0]];
- if (wr)
- bgmap1[addr[12:0]] <= data;
- end
+ if ((vraminuse && ((posx == 1) || ((posx > 2) && (vxpos[2:0] == 3'b110)))) || decode_bgmap1) begin
+ tileno <= bgmap1[bgmapaddr_in];
+ if (wr && decode_bgmap1)
+ bgmap1[bgmapaddr_in] <= data;
+ end
+
+ always @(negedge clk)
+ if ((vraminuse && ((posx == 2) || ((posx > 2) && (vxpos[2:0] == 3'b111)))) || decode_tiledata) begin
+ tilehigh <= tiledatahigh[tileaddr_in];
+ tilelow <= tiledatalow[tileaddr_in];
+ if (wr && addr[0] && decode_tiledata)
+ tiledatahigh[tileaddr_in] <= data;
+ if (wr && ~addr[0] && decode_tiledata)
+ tiledatalow[tileaddr_in] <= data;