-
Notifications
You must be signed in to change notification settings - Fork 32
/
tmds_encoder_dvi_tb.v
60 lines (49 loc) · 1.08 KB
/
tmds_encoder_dvi_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
`timescale 1ns / 1ps
`default_nettype none
// Project F: Display DVI TMDS Encoder Test Bench
// (C)2019 Will Green, Open source hardware released under the MIT License
// Learn more at https://projectf.io
module tmds_encode_dvi_tb();
reg rst;
reg clk;
reg [7:0] data;
reg [1:0] ctrl;
reg de;
wire [9:0] tmds;
reg [8:0] cycle;
// encoded TMDS data $display(...) is within tmds_encoder_dvi.v
initial begin
$display("\t 1s B O");
clk = 1;
rst = 1;
de = 0;
ctrl = 2'b00;
#10
rst = 0;
#10
de = 1;
end
tmds_encoder_dvi tmds_test (
.i_clk(clk),
.i_rst(rst),
.i_data(data),
.i_ctrl(ctrl),
.i_de(de),
.o_tmds(tmds)
);
always @ (posedge clk or posedge rst)
begin
if (rst)
begin
cycle <= 0;
data <= 0;
end
else
begin
cycle <= cycle + 1;
data <= cycle[7:0];
end
end
always
#5 clk = ~clk;
endmodule