forked from testaco/DCP6
/
test_fir128x16x18.v
117 lines (110 loc) · 2.96 KB
/
test_fir128x16x18.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
`timescale 1ns / 1ps
//
// test_fir128x16x18.v - Test FIR Filter Peripheral
//
// (C) Copyright 2008-2012 John B. Stephensen
//
// This Verilog source file and all its derivatives are licensed only for
// personal non-profit educational use in the Amateur Radio Service and
// the license is not transferrable. The information is provided as-is for
// experimental purposes and the author does not warranty its freedom
// from defects or its suitability for any specific application.
//
module test_fir128x16x18;
// Inputs
reg [2:0] ioaddr;
reg iocs;
reg [15:0] din;
reg iowr;
reg iord;
reg clk;
reg rst;
// Outputs
wire [15:0] dout;
// Instantiate the Unit Under Test (UUT)
dfir128x16x18 uut (
.ioaddr(ioaddr),
.iocs(iocs),
.din(din),
.iowr(iowr),
.iord(iord),
.dout(dout),
.clk(clk),
.rst(rst)
);
initial begin
// Initialize Inputs
ioaddr = 0;
iocs = 0;
din = 0;
iowr = 0;
iord = 0;
clk = 0;
rst = 0;
// Wait 100 ns for global reset to finish
#100;
// Reset
#5 clk = 0; rst = 1;
#5 clk = 1;
#5 clk = 0; rst = 0;
#5 clk = 1;
// Load Coefficients
#5 clk = 0; iocs = 1; iowr = 1; ioaddr = 5; din = 0;
#5 clk = 1;
#5 clk = 0; iocs = 1; iowr = 1; ioaddr = 4; din = 2048;
#5 clk = 1;
#5 clk = 0; iocs = 1; iowr = 1; ioaddr = 4; din = 4096;
#5 clk = 1;
#5 clk = 0; iocs = 1; iowr = 1; ioaddr = 4; din = 8192;
#5 clk = 1;
#5 clk = 0; iocs = 1; iowr = 1; ioaddr = 4; din = 16384;
#5 clk = 1;
#5 clk = 0; iocs = 1; iowr = 1; ioaddr = 4; din = 8192;
#5 clk = 1;
#5 clk = 0; iocs = 1; iowr = 1; ioaddr = 4; din = 4096;
#5 clk = 1;
#5 clk = 0; iocs = 1; iowr = 1; ioaddr = 4; din = 2048;
#5 clk = 1;
#5 clk = 0; iocs = 0; iowr = 0; ioaddr = 0; din = 0;
#5 clk = 1;
// Test
#5 clk = 0; iocs = 1; iowr = 1; ioaddr = 0; din = 16384; // data
#5 clk = 1;
#5 clk = 0; iocs = 1; iowr = 1; ioaddr = 2; din = 16'h0700; // start
#5 clk = 1;
repeat (7)
begin
#5 clk = 0; iocs = 0; iowr = 0; ioaddr = 0; din = 0;
#5 clk = 1;
end
#5 clk = 0; iocs = 1; iord = 1; ioaddr = 2; // read status
#5 clk = 1;
#5 clk = 0; iocs = 0; iord = 0; ioaddr = 0;
#5 clk = 1;
#5 clk = 0; iocs = 1; iord = 1; ioaddr = 0; // read result
#5 clk = 1;
#5 clk = 0; iocs = 0; iord = 0; ioaddr = 0;
#5 clk = 1;
repeat (7)
begin
#5 clk = 0; iocs = 1; iowr = 1; ioaddr = 0; din = 0; // data
#5 clk = 1;
#5 clk = 0; iocs = 1; iowr = 1; ioaddr = 2; din = 16'h0700; // start
#5 clk = 1;
repeat (7)
begin
#5 clk = 0; iocs = 0; iowr = 0; ioaddr = 0; din = 0;
#5 clk = 1;
end
#5 clk = 0; iocs = 1; iord = 1; ioaddr = 2; // read status
#5 clk = 1;
#5 clk = 0; iocs = 0; iord = 0; ioaddr = 0;
#5 clk = 1;
#5 clk = 0; iocs = 1; iord = 1; ioaddr = 0; // read result
#5 clk = 1;
#5 clk = 0; iocs = 0; iord = 0; ioaddr = 0;
#5 clk = 1;
end
#5 clk = 0;
end
endmodule