forked from projf/display_controller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
serializer_10to1_tb.v
102 lines (81 loc) · 2.17 KB
/
serializer_10to1_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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
`timescale 1ns / 1ps
`default_nettype none
// Project F: Display Serializer Test Bench
// (C)2019 Will Green, Open source hardware released under the MIT License
// Learn more at https://projectf.io
module serializer_10to1_tb();
reg rst;
reg clk;
reg clk_5x;
reg clk_lock; // clocks locked?
wire rst_oserdes;
reg [9:0] tmds_data_1;
reg [9:0] tmds_data_2;
reg [9:0] tmds_data_3;
wire tmds_data_1_serial;
wire tmds_data_2_serial;
wire tmds_data_3_serial;
initial begin
$display($time, " << Starting Simulation >>");
clk = 0;
clk_5x = 0;
rst = 0;
clk_lock = 0;
#1.5
rst = 1; // assert reset async
#18.5
rst = 0;
#20
clk_lock = 1;
tmds_data_1 = 10'b0110100110;
tmds_data_2 = 10'b1001011001;
tmds_data_3 = 10'b1100000010;
#100
tmds_data_1 = 10'b1111111111;
tmds_data_2 = 10'b1010101010;
tmds_data_3 = 10'b0000000000;
#2
clk_lock = 0; // simulate loss of clock lock
#23
clk_lock = 1;
#125
tmds_data_1 = 10'b0110100110;
tmds_data_2 = 10'b1001011001;
tmds_data_3 = 10'b1100000010;
#101.25
rst = 1; // assert reset async
#11.5
rst = 0; // de-assert reset async
end
// common async reset for serdes
async_reset async_reset_instance (
.i_clk(clk),
.i_rst(rst | ~clk_lock),
.o_rst(rst_oserdes)
);
serializer_10to1 serialize_data_1 (
.i_clk(clk),
.i_clk_hs(clk_5x),
.i_rst_oserdes(rst_oserdes),
.i_data(tmds_data_1),
.o_data(tmds_data_1_serial)
);
serializer_10to1 serialize_data_2 (
.i_clk(clk),
.i_clk_hs(clk_5x),
.i_rst_oserdes(rst_oserdes),
.i_data(tmds_data_2),
.o_data(tmds_data_2_serial)
);
serializer_10to1 serialize_data_3 (
.i_clk(clk),
.i_clk_hs(clk_5x),
.i_rst_oserdes(rst_oserdes),
.i_data(tmds_data_3),
.o_data(tmds_data_3_serial)
);
always
#5 clk = ~clk;
always
#1 clk_5x = ~clk_5x;
endmodule