-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathEncode.v
More file actions
158 lines (124 loc) · 3.2 KB
/
Encode.v
File metadata and controls
158 lines (124 loc) · 3.2 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
(*DONT_TOUCH="TRUE"*)
module Encode(
input clk_24M, //24Mhz时钟
input clk_3M,
input clk_6M,
input write_clk, //fifo写入脉冲
output fifo_write_full,
input rst, //复位
input decode_frame_over, //编码接收结束
input send_frame, //帧发送信号
input M_frame, //主帧信号
input S_frame, //从帧信号
input fifo_write_en, //fifo写使能
input[6:0] frame_length, //帧长度
input[15:0] data_in, //输入数据
output[5:0] fifo_write_count,
output[15:0] fifo_data_output, //fifo输出数据
output wire data_out, //编码后输出结果
output wire frame_over //帧发送结束
)/*synthesis preserve="true"*/ ;
wire[1:0] delimiter_format_o;
wire[1:0] multi_sel_o;
wire manchesite_en_o;
wire crc_en_o;
wire multi_en_o;
wire deserialize_en_o;
wire delimiter_en_o;
wire data_read_o;
wire data_send_o;
wire delimiter_send_o;
wire crc_send_o;
wire crc_ready_o;
wire data_o;
wire delimiter_o;
wire crc_o;
wire multi_o;
wire full;
wire empty;
wire[15:0] fifo_data_out;
wire fifo_read_en;
wire fifo_rst;
assign fifo_data_output=fifo_data_out;
(*DONT_TOUCH="TRUE"*)
EncodeCtrl encodectrl1(
.rst(rst),
.clk(clk_24M),
.clk_6M(clk_6M),
.clk_3M(clk_3M),
.send_frame(send_frame),
.data_length(frame_length),
.master_frame(M_frame),
.slave_frame(S_frame),
.decode_over(decode_frame_over),
.delimiter_format(delimiter_format_o),
.multi_sel(multi_sel_o),
.manchesite_en(manchesite_en_o),
.crc_en(crc_en_o),
.multi_en(multi_en_o),
.delimiter_en(delimiter_en_o),
.deserialize_en(deserialize_en_o),
.data_read(data_read_o),
.data_send(data_send_o),
.delimiter_send(delimiter_send_o),
.crc_send(crc_send_o),
.crc_ready(crc_ready_o),
.frame_over(frame_over)
);
(*DONT_TOUCH="TRUE"*)
Deserialize deserialize1(
.clk_1d5M(clk_3M),
.reset(deserialize_en_o),
.data_in(fifo_data_out),
.read(data_read_o),
.shift(data_send_o),
.dout(data_o)
);
(*DONT_TOUCH="TRUE"*)
fifo_generator_0 fifo1(
.rst(1'b0),
.wr_clk(write_clk),
.rd_clk(clk_3M),
.full(fifo_write_full),
.empty(empty),
.din(data_in),
.dout(fifo_data_out),
.wr_en(fifo_write_en),
.wr_data_count(fifo_write_count),
.rd_en(data_read_o)
);
(*DONT_TOUCH="TRUE"*)
delimiter d1(
.reset(delimiter_en_o),
.clk_3M(clk_6M),
.send_delimiter(delimiter_send_o),
.delimiter_format(delimiter_format_o),
.delimiter_out(delimiter_o)
);
(*DONT_TOUCH="TRUE"*)
CRC crc(
.clk_1d5M(clk_3M),
.data_in(data_o),
.rst(crc_en_o),
.ready(crc_ready_o),
.send(crc_send_o),
.crc_o(crc_o)
);
(*DONT_TOUCH="TRUE"*)
Multiplexer MUL(
.multi_en(multi_en_o),
.sel(multi_sel_o),
.delimiter_out(delimiter_o),
.crc_out(crc_o),
.data_out(data_o),
.multi_out(multi_o)
);
(* DONT_TOUCH= "true" *)
manchesite m1(
.clk_3M(clk_3M),
.clk_6M(clk_6M),
.data_in(multi_o),
.rst(manchesite_en_o),
.data_out(data_out)
);
endmodule