1 //////////////////////////////////////////////////////////////////////
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 //// Inferrable Distributed RAM for FIFOs ////
20 //// Known problems (limits): ////
24 //// Nothing so far. ////
27 //// - gorban@opencores.org ////
28 //// - Jacob Gorban ////
30 //// Created: 2002/07/22 ////
31 //// Last Updated: 2002/07/22 ////
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: not supported by cvs2svn $
65 // Revision 1.1 2002/07/22 23:02:23 gorban
67 // * Possible loss of sync and bad reception of stop bit on slow baud rates fixed.
68 // Problem reported by Kenny.Tung.
69 // * Bad (or lack of ) loopback handling fixed. Reported by Cherry Withers.
72 // * Made FIFO's as general inferrable memory where possible.
73 // So on FPGA they should be inferred as RAM (Distributed RAM on Xilinx).
74 // This saves about 1/3 of the Slice count and reduces P&R and synthesis times.
76 // * Added optional baudrate output (baud_o).
77 // This is identical to BAUDOUT* signal on 16550 chip.
78 // It outputs 16xbit_clock_rate - the divided clock.
79 // It's disabled by default. Define UART_HAS_BAUDRATE_OUTPUT to use.
82 //Following is the Verilog code for a dual-port RAM with asynchronous read.
84 (clk, we, a, dpra, di, dpo);
86 parameter addr_width = 4;
87 parameter data_width = 8;
92 input [addr_width-1:0] a;
93 input [addr_width-1:0] dpra;
94 input [data_width-1:0] di;
95 //output [data_width-1:0] spo;
96 output [data_width-1:0] dpo;
97 reg [data_width-1:0] ram [depth-1:0];
99 wire [data_width-1:0] dpo;
100 wire [data_width-1:0] di;
101 wire [addr_width-1:0] a;
102 wire [addr_width-1:0] dpra;
104 always @(posedge clk) begin
108 // assign spo = ram[a];
109 assign dpo = ram[dpra];