-
Notifications
You must be signed in to change notification settings - Fork 0
/
UART_RX.v
107 lines (98 loc) · 2.7 KB
/
UART_RX.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
module UART_RX #(
parameter DATA_WIDTH = 8
)(
input wire CLK, // RX Clock input signal
input wire RST,
input wire RX_IN,
input wire [5:0] Prescale,
input wire PAR_EN,
input wire PAR_TYP,
output wire Data_Valid,
output wire par_err,
output wire stp_err,
output wire [DATA_WIDTH-1:0] P_DATA
);
wire [2:0] bit_cnt;
wire bit_done;
wire stp_chk_en;
wire strt_chk_en;
wire par_chk_en;
wire deser_en;
wire data_samp_en;
wire edge_count_enable;
wire bit_count_enable;
wire sampling_done;
RX_FSM U1_FSM (
.CLK(CLK),
.RST(RST),
.RX_IN(RX_IN),
.PAR_EN(PAR_EN),
.bit_cnt(bit_cnt),
.bit_done(bit_done),
.strt_glitch(strt_glitch),
.par_err(par_err),
.stp_err(stp_err),
.stp_chk_en(stp_chk_en),
.strt_chk_en(strt_chk_en),
.par_chk_en(par_chk_en),
.deser_en(deser_en),
.data_samp_en(data_samp_en),
.edge_count_enable(edge_count_enable),
.bit_count_enable(bit_count_enable),
.Data_Valid(Data_Valid)
);
wire [4:0] edge_cnt;
RX_EDGE_BIT_COUNTER U0_EB_COUNTER (
.CLK(CLK),
.RST(RST),
.edge_count_enable(edge_count_enable),
.bit_count_enable(bit_count_enable),
.Prescale(Prescale),
.bit_cnt(bit_cnt),
.edge_cnt(edge_cnt),
.bit_done(bit_done)
);
wire sampled_bit;
RX_DATA_SAMPLING U0_DATA_SAMP (
.CLK(CLK),
.RST(RST),
.RX_IN(RX_IN),
.Prescale(Prescale),
.data_samp_en(data_samp_en),
.edge_cnt(edge_cnt),
.sampling_done(sampling_done),
.sampled_bit(sampled_bit)
);
RX_DESERIALIZER U0_DESER (
.CLK(CLK),
.RST(RST),
.sampled_bit(sampled_bit),
.deser_en(deser_en),
.P_DATA(P_DATA)
);
RX_START_CHECK U0_STRT_CKH (
.CLK(CLK),
.RST(RST),
.strt_chk_en(strt_chk_en),
.sampled_bit(sampled_bit),
.strt_glitch(strt_glitch)
);
RX_PARITY_CHECK U0_PAR_CHK (
.CLK(CLK),
.RST(RST),
.PAR_TYP(PAR_TYP),
.par_chk_en(par_chk_en),
.sampled_bit(sampled_bit),
.sampling_done(sampling_done),
.P_DATA(P_DATA),
.par_err(par_err)
);
RX_STOP_CHECK U0_STP_CHK (
.CLK(CLK),
.RST(RST),
.stp_chk_en(stp_chk_en),
.sampled_bit(sampled_bit),
.sampling_done(sampling_done),
.stp_err(stp_err)
);
endmodule