-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRAM_tb.v
78 lines (63 loc) · 1.29 KB
/
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 18:18:32 01/09/2022
// Design Name: RAM
// Module Name: C:/Users/Nefel/Desktop/University/project1/RAM_tb.v
// Project Name: project1
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: RAM
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module RAM_tb;
// Inputs
reg clk = 0;
reg we;
reg [9:0] addr;
reg [31:0] din;
// Outputs
wire [31:0] dout;
// Instantiate the Unit Under Test (UUT)
RAM uut (
.clk(clk),
.we(we),
.addr(addr),
.din(din),
.dout(dout)
);
always #1 clk = ~clk;
initial begin
//Write value '31' to addr 4
we = 1;
addr = 10'b0000000100;
din = 32'b00000000000000000000000000011111;
#10;
//Write value '16' to addr 1
we = 1;
addr = 10'b0000000001;
din = 32'b00000000000000000000000000010000;
#10;
//Read addr 4
we = 0;
addr = 10'b0000000100;
#10;
//Read addr 3
addr = 10'b0000000011;
#10;
//Read addr 1
addr = 10'b0000000001;
#10;
//Simulation time: 50ns
end
endmodule