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

Subversion Repositories eco32

[/] [eco32/] [trunk/] [fpga/] [mc/] [boards/] [xsa-xst-3/] [src/] [clk_rst/] [clk_rst.v] - Diff between revs 288 and 290

Show entire file | Details | Blame | View Log

Rev 288 Rev 290
Line 1... Line 1...
//
//
// clk_rst.v -- clock and reset generator
// clk_rst.v -- clock and reset generator
//
//
 
 
 
 
module clk_rst(clk_in, reset_inout_n,
`timescale 1ns/10ps
 
`default_nettype none
 
 
 
 
 
module clk_rst(clk_in, rst_inout_n,
               sdram_clk, sdram_fb,
               sdram_clk, sdram_fb,
               clk, clk_ok, reset);
               clk, clk_ok, rst);
    input clk_in;
    input clk_in;
    inout reset_inout_n;
    inout rst_inout_n;
    output sdram_clk;
    output sdram_clk;
    input sdram_fb;
    input sdram_fb;
    output clk;
    output clk;
    output clk_ok;
    output clk_ok;
    output reset;
    output rst;
 
 
  wire clk_in_buf;
  wire clk_in_buf;
  wire int_clk;
  wire int_clk;
  wire int_locked;
  wire int_locked;
  wire ext_rst_n;
  wire ext_rst_n;
  wire ext_fb;
  wire ext_fb;
  wire ext_locked;
  wire ext_locked;
 
 
  reg reset_p_n;
  reg rst_p_n;
  reg reset_s_n;
  reg rst_s_n;
  reg [23:0] reset_counter;
  reg [23:0] rst_counter;
  wire reset_counting;
  wire rst_counting;
 
 
  //------------------------------------------------------------
  //------------------------------------------------------------
 
 
  IBUFG clk_in_buffer(
  IBUFG clk_in_buffer(
    .I(clk_in),
    .I(clk_in),
Line 77... Line 81...
 
 
  assign clk_ok = int_locked & ext_locked;
  assign clk_ok = int_locked & ext_locked;
 
 
  //------------------------------------------------------------
  //------------------------------------------------------------
 
 
  assign reset_counting = (reset_counter == 24'hFFFFFF) ? 0 : 1;
  assign rst_counting = (rst_counter == 24'hFFFFFF) ? 0 : 1;
  assign reset_inout_n = (reset_counter[23] == 0) ? 1'b0 : 1'bz;
  assign rst_inout_n = (rst_counter[23] == 0) ? 1'b0 : 1'bz;
 
 
  always @(posedge clk_in_buf) begin
  always @(posedge clk_in_buf) begin
    reset_p_n <= reset_inout_n;
    rst_p_n <= rst_inout_n;
    reset_s_n <= reset_p_n;
    rst_s_n <= rst_p_n;
    if (reset_counting == 1) begin
    if (rst_counting) begin
      reset_counter <= reset_counter + 1;
      rst_counter <= rst_counter + 1;
    end else begin
    end else begin
      if (~reset_s_n | ~clk_ok) begin
      if (~rst_s_n | ~clk_ok) begin
        reset_counter <= 24'h000000;
        rst_counter <= 24'h000000;
      end
      end
    end
    end
  end
  end
 
 
  assign reset = reset_counting;
  assign rst = rst_counting;
 
 
endmodule
endmodule
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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