design uart using vhdl

18
 © ALSE - Sept 2001  VHDL - Practical Example -  Designing a n UART  Bertrand CUZEAU Technical Manager - ALSE  ASIC / FPGA Design Expert  Doulos HDL Instructor (Verilog-VHDL)  [email protected] http://www.alse-fr.com : 33.(0)1 45 82 64 01  

Upload: lizhi0007

Post on 18-Oct-2015

70 views

Category:

Documents


2 download

TRANSCRIPT

ALSE - Sept 2001

VHDL - Practical Example - Designing an UART

Bertrand CUZEAU Technical Manager - ALSE ASIC / FPGA Design ExpertDoulos HDL Instructor (Verilog-VHDL)[email protected] http://www.alse-fr.com : 33.(0)1 45 82 64 01

Introduction

We will demonstrate, on a real-life example, how a sound HDL methodology can be used in conjunction with modern synthesis and simulation tools.

Note : the source code we provide here if for teaching purpose only.This code belongs to ALSE.If you want to use it in your projects please contact us.

Bertrand CUZEAU - [email protected]

UART Specification

We want to address the following needs :

Transmit / Receive with h/w handshake N81 Format , but plan for paritySpeed : 1200..115200 baud (Clock = 14.7456 MHz) No internal Fifo (usually not needed in an FPGA !) Limited frame timing checks

Bertrand CUZEAU - [email protected]

Methodology

We adopt the following constraints :

Standard & 100% portable VHDL Description : Synthesis Simulation Target FPGA (or CPLD) Complete functional Simulation with file I/O. Should work in vivo on an existing ALSE demo board.

Bertrand CUZEAU - [email protected]

RS 232 OutputUARTSTXSDout[7:0]LD_SDoutDin[7:0]LDTx*TXoutRS232 InputsI14TxBusyTxBusy(0=active)RawRxCLKRXBaud[2:0]TxBusy SDin[7:0]RxRDYRxErrRTSRXFLEX*DQRxBaud[2:0] CLKRSTSDout[7:0]SDout[7:0]LD_SDoutLD_SDout*CTSFLEXSDin[7:0]RxRDYRxErrI15I202Dout[7:0]RxRDYRxErrNoted on PCB = RTSFlexCCLK RSTI306RSTI320UART moduleNoted on PCB = CTSFlexApplicationRawRTSRTSRTSFLEX*DQI54I218CLKInversion neededCI307RSTCLK RSTCLK RSTExternal Baud Rate SelectionBaud[2]Baud[1] Baud[0]DIPSW[2] DIPSW[1]DIPSW[0]I319I318 I317 Bertrand CUZEAU - [email protected] Architecture

*

*

*

Baud Rate Generator

Embedded in UARTS. Divides by 8, 16, 28, 48, 96, 192, 384 or 768 and builds Top16. Generates two ticks by further dividing Top16 : Transmit : TopTx, fixed rate Receive :TopRx, mid-bit, resynchronized

Bertrand CUZEAU - [email protected]

-- ----------------------------Baud rate selection-- --------------------------process (RST, CLK) beginif RST='1' then Divisor Divisor Divisor Divisor Divisor Divisor Divisor Divisor Divisor Divisor