OpenCores
URL https://opencores.org/ocsvn/yifive/yifive/trunk

Subversion Repositories yifive

[/] [yifive/] [trunk/] [caravel_yifive/] [verilog/] [rtl/] [syntacore/] [scr1/] [src/] [core/] [scr1_clk_ctrl.sv] - Blame information for rev 11

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 11 dinesha
/// Copyright by Syntacore LLC © 2016-2020. See LICENSE for details
2
/// @file       
3
/// @brief      SCR1 clock control
4
///
5
 
6
`include "scr1_arch_description.svh"
7
 
8
`ifdef SCR1_CLKCTRL_EN
9
module scr1_clk_ctrl (
10
    input   logic   clk,                            // Clock control module clock
11
    input   logic   rst_n,                          // Clock control module reset
12
    input   logic   test_mode,                      // DFT Test Mode
13
    input   logic   test_rst_n,                     // DFT Test reset
14
 
15
    input   logic   pipe2clkctl_sleep_req_i,        // CLK disable request from pipe
16
    input   logic   pipe2clkctl_wake_req_i,         // CLK enable request from pipe
17
 
18
    output  logic   clkctl2pipe_clk_alw_on_o,       // Not gated pipe CLK
19
    output  logic   clkctl2pipe_clk_o,              // Gated pipe
20
    output  logic   clkctl2pipe_clk_en_o,           // CLK enabled flag
21
    output  logic   clkctl2pipe_clk_dbgc_o          // CLK for pipe debug subsystem
22
);
23
 
24
logic ctrl_rst_n;
25
 
26
assign clkctl2pipe_clk_alw_on_o = clk;
27
assign clkctl2pipe_clk_dbgc_o   = clk;
28
assign ctrl_rst_n   = (test_mode) ? test_rst_n : rst_n;
29
 
30
always_ff @(posedge clk, negedge ctrl_rst_n) begin
31
    if (~ctrl_rst_n) begin
32
        clkctl2pipe_clk_en_o <= 1'b1;
33
    end else begin
34
        if (clkctl2pipe_clk_en_o) begin
35
            if (pipe2clkctl_sleep_req_i & ~pipe2clkctl_wake_req_i) begin
36
                clkctl2pipe_clk_en_o <= 1'b0;
37
            end
38
        end else begin // ~clkctl2pipe_clk_en_o
39
            if (pipe2clkctl_wake_req_i) begin
40
                clkctl2pipe_clk_en_o <= 1'b1;
41
            end
42
        end // pipeline
43
    end
44
end
45
 
46
scr1_cg i_scr1_cg_pipe (
47
    .clk        (clk                 ),
48
    .clk_en     (clkctl2pipe_clk_en_o),
49
    .test_mode  (test_mode           ),
50
    .clk_out    (clkctl2pipe_clk_o   )
51
);
52
 
53
endmodule : scr1_clk_ctrl
54
 
55
`endif // SCR1_CLKCTRL_EN

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.