-
Notifications
You must be signed in to change notification settings - Fork 1
/
vram.v
40 lines (35 loc) · 894 Bytes
/
vram.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
module VRAM(
input clk_p1,
input enable_p1,
input [16:0] address_p1,
input writeEnable_p1,
input [15:0] dataIn_p1,
output reg [15:0] dataOut_p1,
input clk_p2,
input [16:0] address_p2,
input writeEnable_p2,
input [15:0] dataIn_p2,
output reg [15:0] dataOut_p2
);
reg [15:0] VRAM[0:320*240-1] /* synthesis ram_init_file = "riscvlogo.mif" */;
//initial begin
// $readmemh("riscvlogo.mem", VRAM);
//end
always @(posedge clk_p1)
begin
if (enable_p1)
begin
if (writeEnable_p1)
VRAM[address_p1] <= dataIn_p1;
else
dataOut_p1 <= VRAM[address_p1];
end
end
always @(posedge clk_p2)
begin
if (writeEnable_p2)
VRAM[address_p2] <= dataIn_p2;
else
dataOut_p2 <= VRAM[address_p2];
end
endmodule