-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTest_Decoder.v
More file actions
59 lines (46 loc) · 1.16 KB
/
Test_Decoder.v
File metadata and controls
59 lines (46 loc) · 1.16 KB
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
/*##########Script Information###############################
# Purpose: Decoder testbench For System Bus Design
# Updated: 07-08-2022
# Author : Rumesh
###########################################################*/
`timescale 1ns / 1ps
module Test_Decoder;
// Inputs
reg RST;
reg CLK;
reg [14:0] HADDR;
// Outputs
wire SEL_1;
wire SEL_2;
wire SEL_3;
wire [1:0] SELR;
// Instantiate the Unit Under Test (UUT)
Decoder uut (
.RST(RST),
.CLK(CLK),
.HADDR(HADDR),
.SEL_1(SEL_1),
.SEL_2(SEL_2),
.SEL_3(SEL_3),
.SELR(SELR)
);
always #15 CLK = ! CLK;
initial begin
#500 RST = 1; // Reset test
#50 RST = 0;
end
initial begin
// Initialize Inputs
RST = 0;
CLK = 0;
HADDR = 0;
// Wait 100 ns for global reset to finish
#100;
// Add stimulus here
#150 HADDR = 15'b000000000000000;RST = 0;
#150 HADDR = 15'b010000000000000;RST = 0; // Slave 1 select
#150 HADDR = 15'b100000000000000;RST = 0; // Slave 2 select
#150 HADDR = 15'b110000000000000;RST = 0; // Slave 3 select
#150 HADDR = 15'b000000000000000;RST = 0;
end
endmodule