-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHX8357_cont_tb.sv
100 lines (75 loc) · 1.34 KB
/
HX8357_cont_tb.sv
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
`timescale 10ns/1ns
// delay #4 = 25 MHz (#1 clk #1 ~clk)
// delay #20 = 5 MHz (#10 sclk #10 ~sclk)
module HX8357_cont_tb ();
// variables
logic clk, nres;
// display outputs to test
wire CSx;
wire RESx;
wire DCx;
wire WRx;
wire RDx;
wire [15:0] Data;
// control logic outputs
wire supply_data;
wire transmission_cmpl;
// variables controlled by testbench
logic [15:0] data_in;
logic cmd;
logic data;
// instantiate Display controller
HX8357_cont disp_cont(
// generic inputs
.clk (clk),
.nres (nres),
//Control
.data_in (data_in),
.cmd (cmd),
.data(data),
// Control outputs
.transmission_cmpl(transmission_cmpl),
//Display OUT
.CSx (CSx),
.RESx (RESx),
.DCx (DCx),
.WRx (WRx),
.RDx (RDx),
.DATAx (Data)
);
// start testbench
initial begin
// assign initial values
clk = 0;
nres = 1;
data_in = 16'hFFFF;
cmd = 0;
data = 0;
#10;
// reset controller
nres = 0;
#50;
nres = 1;
#10;
// write command
cmd = 1;
data_in = 16'h0080;
wait(transmission_cmpl);
cmd = 0;
data = 1;
data_in = 16'h1234;
#5;
wait(transmission_cmpl);
data_in = 16'h5678;
#5;
wait(transmission_cmpl);
data = 0;
#50;
$stop;
end
// clock generate
always
begin
#2 clk = ~clk;
end
endmodule // HX8357_controller_tb