-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMEMSTAGE_tb.v
84 lines (68 loc) · 1.5 KB
/
MEMSTAGE_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
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 18:24:26 01/09/2022
// Design Name: MEMSTAGE
// Module Name: C:/Users/Nefel/Desktop/University/project1/MEMSTAGE_tb.v
// Project Name: project1
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: MEMSTAGE
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module MEMSTAGE_tb;
// Inputs
reg clk = 0;
reg Mem_WrEn;
reg [31:0] ALU_MEM_Addr;
reg [31:0] MEM_DataIn;
// Outputs
wire [31:0] MEM_DataOut;
// Instantiate the Unit Under Test (UUT)
MEMSTAGE uut (
.clk(clk),
.Mem_WrEn(Mem_WrEn),
.ALU_MEM_Addr(ALU_MEM_Addr),
.MEM_DataIn(MEM_DataIn),
.MEM_DataOut(MEM_DataOut)
);
always #1 clk = ~clk;
initial begin
//Write value '31' to addr 4
Mem_WrEn = 1;
ALU_MEM_Addr = 4;
//addr = 0000000001
MEM_DataIn = 31;
#10;
//Write value '16' to addr 1
Mem_WrEn = 1;
ALU_MEM_Addr = 1;
//addr = 0000000000
MEM_DataIn = 16;
#10;
//Read addr 4
Mem_WrEn = 0;
ALU_MEM_Addr = 4;
//addr = 0000000001
#10;
//Read addr 1
ALU_MEM_Addr = 1;
//addr = 0000000000
#10;
//Read addr 4035 -> 1008
ALU_MEM_Addr = 32'b00000000000000000000111111000011;
//addr = 1111110000
#10;
//Simulation time: 50ns
end
endmodule