1 //////////////////////////////////////////////////////////////////////
3 //// uart_sync_flops.v ////
6 //// This file is part of the "UART 16550 compatible" project ////
7 //// http://www.opencores.org/cores/uart16550/ ////
9 //// Documentation related to this project: ////
10 //// - http://www.opencores.org/cores/uart16550/ ////
12 //// Projects compatibility: ////
14 //// RS232 Protocol ////
15 //// 16550D uart (mostly supported) ////
17 //// Overview (main Features): ////
18 //// UART core receiver logic ////
20 //// Known problems (limits): ////
24 //// Thourough testing. ////
27 //// - Andrej Erzen (andreje@flextronics.si) ////
28 //// - Tadej Markovic (tadejm@flextronics.si) ////
30 //// Created: 2004/05/20 ////
31 //// Last Updated: 2004/05/20 ////
32 //// (See log for the revision history) ////
35 //////////////////////////////////////////////////////////////////////
37 //// Copyright (C) 2000, 2001 Authors ////
39 //// This source file may be used and distributed without ////
40 //// restriction provided that this copyright statement is not ////
41 //// removed from the file and that any derivative work contains ////
42 //// the original copyright notice and the associated disclaimer. ////
44 //// This source file is free software; you can redistribute it ////
45 //// and/or modify it under the terms of the GNU Lesser General ////
46 //// Public License as published by the Free Software Foundation; ////
47 //// either version 2.1 of the License, or (at your option) any ////
48 //// later version. ////
50 //// This source is distributed in the hope that it will be ////
51 //// useful, but WITHOUT ANY WARRANTY; without even the implied ////
52 //// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
53 //// PURPOSE. See the GNU Lesser General Public License for more ////
56 //// You should have received a copy of the GNU Lesser General ////
57 //// Public License along with this source; if not, download it ////
58 //// from http://www.opencores.org/lgpl.shtml ////
60 //////////////////////////////////////////////////////////////////////
62 // CVS Revision History
64 // $Log: uart_sync_flops.v,v $
65 // Revision 1.1 2004/05/21 11:43:25 tadejm
66 // Added to synchronize RX input to Wishbone clock.
71 `include "timescale.v"
74 module uart_sync_flops
87 parameter init_value = 1'b0;
89 input rst_i; // reset input
90 input clk_i; // clock input
91 input stage1_rst_i; // synchronous reset for stage 1 FF
92 input stage1_clk_en_i; // synchronous clock enable for stage 1 FF
93 input [width-1:0] async_dat_i; // asynchronous data input
94 output [width-1:0] sync_dat_o; // synchronous data output
98 // Interal signal declarations
101 reg [width-1:0] sync_dat_o;
102 reg [width-1:0] flop_0;
106 always @ (posedge clk_i or posedge rst_i)
109 flop_0 <= #Tp {width{init_value}};
111 flop_0 <= #Tp async_dat_i;
115 always @ (posedge clk_i or posedge rst_i)
118 sync_dat_o <= #Tp {width{init_value}};
119 else if (stage1_rst_i)
120 sync_dat_o <= #Tp {width{init_value}};
121 else if (stage1_clk_en_i)
122 sync_dat_o <= #Tp flop_0;