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

Subversion Repositories eco32

[/] [eco32/] [trunk/] [fpga/] [mc-sim/] [src/] [clk_rst/] [clk_rst.v] - Blame information for rev 323

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 301 hellwig
//
2
// clk_rst.v -- clock and reset generator
3
//
4
 
5
 
6
`timescale 1ns/10ps
7
`default_nettype none
8
 
9
 
10
module clk_rst(clk_in, rst_in_n,
11
               clk, rst);
12
    input clk_in;
13
    input rst_in_n;
14
    output clk;
15
    output rst;
16
 
17
  reg rst_p_n;
18
  reg rst_s_n;
19
  reg [3:0] cnt;
20
 
21
  assign clk = clk_in;
22
 
23
  always @(posedge clk) begin
24
    rst_p_n <= rst_in_n;
25
    rst_s_n <= rst_p_n;
26
    if (rst_s_n == 0) begin
27
      cnt <= 4'h0;
28
    end else begin
29
      if (cnt != 4'hF) begin
30
        cnt <= cnt + 1;
31
      end
32
    end
33
  end
34
 
35
  assign rst = (cnt == 4'hF) ? 0 : 1;
36
 
37
endmodule

powered by: WebSVN 2.1.0

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