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

📄 uart_sync_flops.v

📁 uart协议、实现、验证
💻 V
字号:
//////////////////////////////////////////////////////////////////////////                                                              ////////  uart_sync_flops.v                                             ////////                                                              ////////                                                              ////////  This file is part of the "UART 16550 compatible" project    ////////  http://www.opencores.org/cores/uart16550/                   ////////                                                              ////////  Documentation related to this project:                      ////////  - http://www.opencores.org/cores/uart16550/                 ////////                                                              ////////  Projects compatibility:                                     ////////  - WISHBONE                                                  ////////  RS232 Protocol                                              ////////  16550D uart (mostly supported)                              ////////                                                              ////////  Overview (main Features):                                   ////////  UART core receiver logic                                    ////////                                                              ////////  Known problems (limits):                                    ////////  None known                                                  ////////                                                              ////////  To Do:                                                      ////////  Thourough testing.                                          ////////                                                              ////////  Author(s):                                                  ////////      - Andrej Erzen (andreje@flextronics.si)                 ////////      - Tadej Markovic (tadejm@flextronics.si)                ////////                                                              ////////  Created:        2004/05/20                                  ////////  Last Updated:   2004/05/20                                  ////////                  (See log for the revision history)          ////////                                                              ////////                                                              //////////////////////////////////////////////////////////////////////////////                                                              //////// Copyright (C) 2000, 2001 Authors                             ////////                                                              //////// This source file may be used and distributed without         //////// restriction provided that this copyright statement is not    //////// removed from the file and that any derivative work contains  //////// the original copyright notice and the associated disclaimer. ////////                                                              //////// This source file is free software; you can redistribute it   //////// and/or modify it under the terms of the GNU Lesser General   //////// Public License as published by the Free Software Foundation; //////// either version 2.1 of the License, or (at your option) any   //////// later version.                                               ////////                                                              //////// This source is distributed in the hope that it will be       //////// useful, but WITHOUT ANY WARRANTY; without even the implied   //////// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //////// PURPOSE.  See the GNU Lesser General Public License for more //////// details.                                                     ////////                                                              //////// You should have received a copy of the GNU Lesser General    //////// Public License along with this source; if not, download it   //////// from http://www.opencores.org/lgpl.shtml                     ////////                                                              ////////////////////////////////////////////////////////////////////////////// CVS Revision History//// $Log: uart_sync_flops.v,v $// Revision 1.1  2004/05/21 11:43:25  tadejm// Added to synchronize RX input to Wishbone clock.////`include "timescale.v"module uart_sync_flops(  // internal signals  rst_i,  clk_i,  stage1_rst_i,  stage1_clk_en_i,  async_dat_i,  sync_dat_o);parameter Tp            = 1;parameter width         = 1;parameter init_value    = 1'b0;input                           rst_i;                  // reset inputinput                           clk_i;                  // clock inputinput                           stage1_rst_i;           // synchronous reset for stage 1 FFinput                           stage1_clk_en_i;        // synchronous clock enable for stage 1 FFinput   [width-1:0]             async_dat_i;            // asynchronous data inputoutput  [width-1:0]             sync_dat_o;             // synchronous data output//// Interal signal declarations//reg     [width-1:0]             sync_dat_o;reg     [width-1:0]             flop_0;// first stagealways @ (posedge clk_i or posedge rst_i)begin    if (rst_i)        flop_0 <= #Tp {width{init_value}};    else        flop_0 <= #Tp async_dat_i;    end// second stagealways @ (posedge clk_i or posedge rst_i)begin    if (rst_i)        sync_dat_o <= #Tp {width{init_value}};    else if (stage1_rst_i)        sync_dat_o <= #Tp {width{init_value}};    else if (stage1_clk_en_i)        sync_dat_o <= #Tp flop_0;       endendmodule

⌨️ 快捷键说明

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