-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathv_ram.v
More file actions
29 lines (28 loc) · 674 Bytes
/
v_ram.v
File metadata and controls
29 lines (28 loc) · 674 Bytes
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
module v_ram (clka, clkb, ena, enb, wea, addra, addrb, dia, doa, dob);
input clka, clkb;
input wea;
input ena, enb;
input [1:0] addra, addrb;
input [15:0] dia; // 16 bit data
output [15:0] doa, dob; // 16 bit data
reg [15:0] RAM [3:0]; // 16 bits wide-4 element ram
reg [15:0] doa, dob;
always @(posedge clka)
begin
if (ena)
begin
if (wea)
begin
RAM[addra]<=dia;
end
doa <= RAM[addra];
end
end
always @(posedge clkb)
begin
if (enb)
begin
dob <= RAM[addrb];
end
end
endmodule