-
Notifications
You must be signed in to change notification settings - Fork 1
/
ram_tb.v
57 lines (43 loc) · 844 Bytes
/
ram_tb.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//`timescale 1 ns/1 ns
module RAM_TB;
reg clk = 0;
reg [31:0] address;
reg [31:0] dataIn;
wire [31:0] dataOut;
reg writeEnable;
RAM ram(.clk(clk), .address(address), .dataIn(dataIn), .dataOut(dataOut), .writeEnable(writeEnable));
initial begin
clk = 0;
#1
address = 0;
writeEnable = 0;
clk = 1;
#1
clk = 0;
if (dataOut != 32'h3e800093)
$error("Valor 0 errado %x", dataOut);
#1
address = 1;
clk = 1;
#1
clk = 0;
if (dataOut != 32'h7d008113)
$error("Valor 1 errado %x", dataOut);
#1
address = 2;
dataIn = 32'hDEADBEEF;
clk = 1;
#1
clk = 0;
if (dataOut != 32'hc1810193)
$error("Valor 2 errado %x", dataOut);
#1
clk = 1;
writeEnable = 1;
#1
clk = 0;
#1
if (dataOut != 32'hDEADBEEF)
$error("Valor 3 errado %x", dataOut);
end
endmodule