-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathcaliptra_prim_flop_2sync.sv
61 lines (54 loc) · 1.38 KB
/
caliptra_prim_flop_2sync.sv
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
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
//
// Generic double-synchronizer flop
// This may need to be moved to caliptra_prim_generic if libraries have a specific cell
// for synchronization
module caliptra_prim_flop_2sync #(
parameter int Width = 16,
parameter logic [Width-1:0] ResetValue = '0,
parameter bit EnablePrimCdcRand = 1
) (
input clk_i,
input rst_ni,
input [Width-1:0] d_i,
output logic [Width-1:0] q_o
);
logic [Width-1:0] d_o;
logic [Width-1:0] intq;
`ifdef CALIPTRA_SIMULATION
caliptra_prim_cdc_rand_delay #(
.DataWidth(Width),
.Enable(EnablePrimCdcRand)
) u_caliptra_prim_cdc_rand_delay (
.clk_i,
.rst_ni,
.src_data_i(d_i),
.prev_data_i(intq),
.dst_data_o(d_o)
);
`else // !`ifdef CALIPTRA_SIMULATION
logic unused_sig;
assign unused_sig = EnablePrimCdcRand;
always_comb d_o = d_i;
`endif // !`ifdef CALIPTRA_SIMULATION
caliptra_prim_flop #(
.Width(Width),
.ResetValue(ResetValue)
) u_sync_1 (
.clk_i,
.rst_ni,
.d_i(d_o),
.q_o(intq)
);
caliptra_prim_flop #(
.Width(Width),
.ResetValue(ResetValue)
) u_sync_2 (
.clk_i,
.rst_ni,
.d_i(intq),
.q_o
);
endmodule : caliptra_prim_flop_2sync