⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pl4_lite_clk_gen.v

📁 spi接口的vhdl实现
💻 V
字号:
/******************************************************************************
* SPI-4.2 Clock Generator
*******************************************************************************
*
*  Copyright(C) 2004 by Xilinx, Inc. All rights reserved.
*  This text/file contains proprietary, confidential
*  information of Xilinx, Inc., is distributed under
*  license from Xilinx, Inc., and may be used, copied
*  and/or disclosed only pursuant to the terms of a valid
*  license agreement with Xilinx, Inc. Xilinx hereby
*  grants you a license to use this text/file solely for
*  design, simulation, implementation and creation of
*  design files limited to Xilinx devices or technologies.
*  Use with non-Xilinx devices or technologies is expressly
*  prohibited and immediately terminates your license unless
*  covered by a separate agreement.
*
*  Xilinx is providing this design, code, or information
*  "as-is" solely for use in developing programs and
*  solutions for Xilinx devices, with no obligation on the
*  part of Xilinx to provide support. By providing this design,
*  code, or information as one possible implementation of
*  this feature, application or standard, Xilinx is making no
*  representation that this implementation is free from any
*  claims of infringement. You are responsible for obtaining
*  any rights you may require for your implementation.
*  Xilinx expressly disclaims any warranty whatsoever with
*  respect to the adequacy of the implementation, including
*  but not limited to any warranties or representations that this
*  implementation is free from claims of infringement, implied
*  warranties of merchantability or fitness for a particular
*  purpose.
*
*  Xilinx products are not intended for use in life support
*  appliances, devices, or systems. Use in such applications is
*  expressly prohibited.
*
*  Any modifications that are made to the Source Code are
*  done at the user's sole risk and will be unsupported.
*  The Xilinx Support Hotline does not have access to source
*  code and therefore cannot answer specific questions related
*  to source HDL.
*
*  This copyright and support notice must be retained as part
*  of this text at all times. (c) Copyright 1995-2004 Xilinx, Inc.
*  All rights reserved.
*
*******************************************************************************
* Filename: pl4_lite_clk_gen.v
*
* Description: This module defines the core level clocks that are used in
* the demonstration testbench for the SPI-4.2 core
*
*******************************************************************************
* Structure: pl4_lite_clk_gen.v
*
*****************************************************************************/
`timescale 1ps/1ps

/*****************************************************************************
* Library Declarations
*****************************************************************************/
`include "../pl4_lite_testcase_pkg.v"

/*****************************************************************************
* Declare top-level module
*****************************************************************************/
module pl4_lite_clk_gen (
  Reset_n,
  TDClk,
  SysClk,
  RDClk2x,
  UserClk,
  TSClk
  );

input  Reset_n;
input  TDClk;

output SysClk;
output RDClk2x;
output UserClk;
output TSClk;

/****************************************************************************
* Definition of Ports
*****************************************************************************
* System Signals
*   Reset_n                    :  Input Reset (active low)
*   TDClk                      :  Input Clock from the core which is used
*                                 to create TSClk
*   SysClk                     :  Clock with period of TDClkPeriod which is
*                                 used in the control module and testcase
*                                 module
*   RDClk2x                    :  Clock with a period of half of RDClkPeriod
*                                 which is used in the control module and
*                                 testcase module
*   UserClk                    :  Clock with a period of UserClkPeriod
*                                 which is used for calendar programing and
*                                 in the Fifo Loopback module
*   TSClk                      :  Clock with a frequency of 1/4 TDClk
****************************************************************************/

/***************************************************************************
* Parameter Declarations
***************************************************************************/
parameter TDClkPeriod   = `TDCLK_PERIOD;
parameter RDClkPeriod   = `RDCLK_PERIOD;
parameter UserClkPeriod = `USERCLK_PERIOD;
/***************************************************************************
* Definition of Parameters:
*    TDClkPeriod                :  Period of TDClk
*    RDClkPeriod                :  Period of RDClk
*    UserClkPeriod              :  Period of UserClk
***************************************************************************/

/****************************************************************************
* Signal Declarations
****************************************************************************/
reg SysClk;
reg RDClk2x;
reg UserClk;
reg TSClk;
reg Div2;

/****************************************************************************
* Clock Creation
****************************************************************************/
  initial
    begin
      SysClk          = 1'b0;
      RDClk2x         = 1'b0;
      UserClk         = 1'b0;
      TSClk           = 1'b0;
      Div2            = 1'b0;
    end

  initial
    begin: Sysclk_gen
      forever #(TDClkPeriod/2) SysClk = !SysClk;
    end

  initial
    begin: RDClk2x_gen
      forever #(RDClkPeriod/4) RDClk2x = !RDClk2x;
    end

  initial
    begin: UserClk_gen
      forever #(UserClkPeriod/2) UserClk = !UserClk;
    end


  // TSClk generation: TSClk = TDClk / 4
  always @(posedge TDClk)
    begin: TDClkDiv2_gen
      Div2 = !Div2;
    end

  always @(posedge Div2)
    begin: TDClkDiv4_gen
      TSClk = !TSClk;
    end

endmodule

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -