2020-09-12 06:14:59 +00:00
|
|
|
/*
|
|
|
|
Copyright 2020 Blue Liang, liangkangnan@163.com
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// 将输入打DP拍后输出
|
|
|
|
module gen_ticks_sync #(
|
|
|
|
parameter DP = 2,
|
|
|
|
parameter DW = 32)(
|
|
|
|
|
2020-10-23 13:26:18 +00:00
|
|
|
input wire rst_n,
|
2020-09-12 06:14:59 +00:00
|
|
|
input wire clk,
|
|
|
|
|
|
|
|
input wire[DW-1:0] din,
|
|
|
|
output wire[DW-1:0] dout
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
wire[DW-1:0] sync_dat[DP-1:0];
|
|
|
|
|
|
|
|
genvar i;
|
|
|
|
|
|
|
|
generate
|
2020-10-26 09:01:04 +00:00
|
|
|
for (i = 0; i < DP; i = i + 1) begin: ticks_sync
|
|
|
|
if (i == 0) begin: dp_is_0
|
2020-10-23 13:26:18 +00:00
|
|
|
gen_rst_0_dff #(DW) rst_0_dff(clk, rst_n, din, sync_dat[0]);
|
2020-10-26 09:01:04 +00:00
|
|
|
end else begin: dp_is_not_0
|
2020-10-23 13:26:18 +00:00
|
|
|
gen_rst_0_dff #(DW) rst_0_dff(clk, rst_n, sync_dat[i-1], sync_dat[i]);
|
2020-09-12 06:14:59 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
endgenerate
|
|
|
|
|
|
|
|
assign dout = sync_dat[DP-1];
|
|
|
|
|
|
|
|
endmodule
|