-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathram_tb.v
87 lines (70 loc) · 1.6 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
78
79
80
81
82
83
84
85
86
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 15:31:34 04/28/2020
// Design Name: ram
// Module Name: /home/eng/w/wps100020/EE4304/project/verilog/multicycle/multicycle/ram_tb.v
// Project Name: multicycle
// 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 [11:0] address;
reg read_not_write;
reg clk;
// Bidirs
wire [15:0] data;
// Instantiate the Unit Under Test (UUT)
ram uut (
.address(address),
.data(data),
.read_not_write(read_not_write),
.clk(clk)
);
integer c ;
reg [15:0] driver ;
assign data =( read_not_write ? 16'bz : driver );
initial begin
// Initialize Inputs
address = 0;
read_not_write = 0;
clk = 0;
// Wait 100 ns for global reset to finish
#100;
read_not_write = 1 ;
// Add stimulus here
for ( c = 0 ; c <= 12 ; c = c+1 ) begin
clk <= c ;
address <= 12'd2048 ;
#100 ;
end
// Now perform a write
for ( c = 0 ; c <= 1 ; c = c+1 ) begin
clk <= c ;
address <= 12'd2048 ;
driver <= 16'hff03 ;
read_not_write = 0 ;
#100 ;
end
// Now perform a read
for ( c = 0 ; c <= 1 ; c = c+1 ) begin
clk <= c ;
address <= 12'd2048 ;
read_not_write = 1 ;
#100 ;
end
end
endmodule