summaryrefslogtreecommitdiff
path: root/rtl/uncore/clkgen.sv
blob: 0c7ff7138d0a9127525a1428b925a66f02c316e9 (plain)
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
//
// Copyright (c) 2026, Apollo Telephone Laboratories.
// Provided under the BSD-3 clause.
//

//
// Uncore clock generator
//
// @refclk_i:       Reference clock input from on-board VCO
// @reset_ni:       Active-low reset input
// @clk_en_i:       Active-high clock enable input
// @dclk_o:         Derieved clock output
// @gclk_o:         Gated global clock output
// @pll_locked_o:   PLL locked indicator output
//
module clkgen (
    input wire refclk_i,
    input wire reset_ni,
    input wire clk_en_i,

    output logic dclk_o,
    output logic gclk_o,
    output logic pll_locked_o
);
    logic clk_en;
    logic dclk;

    // TODO: Handle real silicon
`ifdef _SIM
    assign dclk = refclk_i;
    assign pll_locked_o = 1;
`endif

    // ICG cell
    always_latch begin
        if (!dclk) begin
            clk_en = clk_en_i;
        end
    end

    assign gclk_o = dclk & clk_en;
    assign dclk_o = dclk;
endmodule