UART Spec SV
UART Spec SV
UART Spec SV
Specification
**SystemVerilog version**
Author: Jacob Gorban
[email protected]
redesign :hiroshi
Rev. 0.7
September 23, 2019
This page has been intentionally left blank
OpenCores UART16550 core specifications 9/23/2019
Revision History
Contents
Introduction ……………………………………………… 1
IO ports ……………………………………………… 2
Clocks ……………………………………………… 3
Registers ……………………………………………… 4
Operation ……………………………………………… 13
Architecture ……………………………………………… 15
1
Introduction
The UART (Universal Asynchronous Receiver/Transmitter) core provides serial
communication capabilities, which allow communication with modem or other external
devices, like another computer using a serial cable and RS232 protocol. This core is
designed to be maximally compatible with the industry standard National
Semiconductors’ 16550A device.
Features:
2
IO ports
2.1 WISHBONE interface signals
Port Width Direction Description
CLK 1 Input Block’s clock input
WB_RST_I 1 Input Asynchronous Reset
WB_ADDR_I 5 or 3 Input Used for register selection
WB_SEL_I 4 Input Select signal
WB_DAT_I 32 or 8 Input Data input
WB_DAT_O 32 or 8 Output Data output
WB_WE_I 1 Input Write or read cycle selection
WB_STB_I 1 Input Specifies transfer cycle
WB_CYC_I 1 Input A bus cycle is in progress
WB_ACK_O 1 Output Acknowledge of a transfer
3
Clocks
Clocks table:
4
Registers
4.1 Registers list
Name Address Width Access Description
Receiver Buffer 0 8 R Receiver FIFO output
Transmitter Holding 0 8 W Transmit FIFO input
Register (THR)
Interrupt Enable 1 8 RW Enable/Mask interrupts
generated by the UART
Interrupt Identification 2 8 R Get interrupt information
FIFO Control 2 8 W Control FIFO options
Line Control Register 3 8 RW Control connection
Modem Control 4 8 W Controls modem
Line Status 5 8 R Status information
Modem Status 6 8 R Modem Status
In addition, there are 2 Clock Divisor registers that together form one 16-bit.
The registers can be accessed when the 7th (DLAB) bit of the Line Control Register is set
to ‘1’. At this time the above registers at addresses 0-1 can’t be accessed.
When using 32-bit data bus interface, additional read-only registers are available for
debug purposes:
Type Control
Bit 3
Bit 2
Bit 1
Note that the receiver always checks the first stop bit only.
3 RW Parity Enable
‘0’ – No parity
‘1’ – Parity bit is generated on each outgoing character and
is checked on each incoming one.
4 RW Even Parity select
‘0’ – Odd number of ‘1’ is transmitted and checked in each
word (data and parity combined). In other words, if the data has an
even number of ‘1’ in it, then the parity bit is ‘1’.
7-5 W Ignored
Reset Value: 0
Exsample :
64.1 = 20 / (16*19200) * 10exp6 - 1
baud_reg = 64
TThhee ddiivviissoorr llaattcchheess ccaann bbee aacccceesssseedd bbyy sseettttiinngg tthhee 77ttthhh bbiitt ooff LLC CR R ttoo ‘‘11’’.. YYoouu sshhoouulldd
rreessttoorree tthhiiss bbiitt ttoo ‘‘00’’ aafftteerr sseettttiinngg tthhee ddiivviissoorr llaattcchheess iinn oorrddeerr ttoo rreessttoorree aacccceessss ttoo tthhee ootthheerr
rreeggiisstteerrss tthhaatt ooccccuuppyy tthhee ssaam mee aaddddrreesssseess.. TThhee 22 bbyytteess ffoorrm m oonnee 1166--bbiitt rreeggiisstteerr,, w
whhiicchh iiss
iinntteerrnnaallllyy aacccceesssseedd aass aa ssiinnggllee nnuum mbbeerr.. Y Yoouu sshhoouulldd tthheerreeffoorree sseett aallll 22 bbyytteess ooff tthhee rreeggiisstteerr
ttoo eennssuurree nnoorrm mal operation. The register iiss sseett ttoo tthhee ddeeffaauulltt vvaalluuee ooff 00 oonn rreesseett,, w
a l o p e r a t i o n . T h e r e g i s t er whhiicchh
ddiissaabblleess aallll sseerriiaall II//O
O operations in order to ensure explicit setup of the register in tthhee
o p e r a t i o n s i n o r d er t o e n s u r e ex p l i ci t s et u p o f t h e r e g i s t er i n
ssooffttwwaarree.. TThhee vvaalluuee sseett sshhoouulldd bbee eeqquuaall ttoo ((ssyysstteem m cclloocckk ssppeeeedd)) // ((1166 xx ddeessiirreedd bbaauudd rraattee))..
TThhee iinntteerrnnaall ccoouunntteerr ssttaarrttss ttoo w work when the LSB ooff D
o r k w h en t h e L S B DLL iiss w wrriitttteenn,, ssoo wwhheenn sseettttiinngg tthhee
ddiivviissoorr,, w wrriittee tthhee MMSSB B ffiirrsstt aanndd tthhee LLSSB B llaasstt..
44..1100 D
Deebbuugg 11
TThhiiss rreeggiisstteerr iiss oonnllyy aavvaaiillaabbllee w
whheenn tthhee ccoorree hhaass 3322--bbiitt ddaattaa bbuuss aanndd 55--bbiitt aaddddrreessss bbuuss..
IItt iiss rreeaadd oonnllyy aanndd iiss pprroovviiddeedd ffoorr ddeebbuuggggiinngg ppuurrppoosseess ooff cchhiipp tteessttiinngg aass iitt iiss nnoott ppaarrtt ooff
tthhee oorriiggiinnaall UUA AR RTT1166555500 ddeevviiccee ssppeecciiffiiccaattiioonnss.. R
Reeaaddiinngg ffrroom m tthhee ddooeess nnoott iinnfflluueennccee
ccoorree’’ss bbaahhaavviioouurr..
BBiitt ## A
Acccceessss DDeessccrriippttiioonn
77--00 R
R LLiinnee SSttaattuuss R Reeggiisstteerr vvaalluuee..
1111--88 R
R IInntteerrrruupptt EEnnaabbllee R Reeggiisstteerr vvaalluuee ((bbiittss 33--00))..
1155--1122 R
R IInntteerrrruupptt IIddeennttiiffiieerr R Reeggiisstteerr vvaalluuee ((bbiittss 33--00))..
2233--1166 R
R LLiinnee C Control Registeerr vvaalluuee..
o n t ro l R e g i s t
3311--2244 R
R MMooddeem m SSttaattuuss R Reeggiisstteerr vvaalluuee..
44..1111 D
Deebbuugg 22
TThhiiss rreeggiisstteerr iiss oonnllyy aavvaaiillaabbllee w
whheenn tthhee ccoorree hhaass 3322--bbiitt ddaattaa bbuuss aanndd 55--bbiitt aaddddrreessss bbuuss..
IItt iiss rreeaadd oonnllyy aanndd iiss pprroovviiddeedd ffoorr ddeebbuuggggiinngg ppuurrppoosseess ooff cchhiipp tteessttiinngg aass iitt iiss nnoott ppaarrtt ooff
tthhee oorriiggiinnaall UUA AR RTT1166555500 ddeevviiccee ssppeecciiffiiccaattiioonnss.. R
Reeaaddiinngg ffrroom m tthhee ddooeess nnoott iinnfflluueennccee
ccoorree’’ss bbaahhaavviioouurr..
BBiitt ## A
Acccceessss DDeessccrriippttiioonn
22--00 R
R TTrraannssmmiitttteerr FFSSM M ssttaattee
77--33 R
R NNumber of charaacctteerrss iinn TTrraannssm
u m b e r o f c h a r miitttteerr FFIIFFO O ((ttff__ccoouunntt))
1111--88 R
R RReecceeiivveerr FFSSM M ssttaattee
1166--1122 R
R NNumber of chaarraacctteerrss iinn R
u m b e r o f c h Reecceeiivveerr FFIIFFO O ((rrff__ccoouunntt))
1188--1177 R
R MMooddeem mC Coonnttrrooll R Reeggiisstteerr vvaalluuee ((bbiittss 44--00))
2233--1199 R
R FFIIFFOOC Coonnttrrooll R Reeggiisstteerr vvaalluuee ((bbiittss 77--66))
3311--2244 R
R RReesseerrvveedd.. R Reettuurrnneedd vvaalluuee iiss 00..
5
Operation
This UART core is very similar in operation to the standard 16550 UART chip with the
main exception being that only the FIFO mode is supported. The scratch register is
removed, as it serves no purpose.
This core can operate in 8-bit data bus mode or in 32-bit bus mode, which is now the
default mode.
The 32-bit mode is fully WISHBONE compatible and it uses the WISHBONE [SEL_I]
signal to properly receive and return 8-bit data on 32-bit data bus. The 8-bit version might
have problems in various WISHBONE implementations because a 32-bit master reading
from 8-bit bus can expect data on different bytes of the 4-byte word, depending on the
register address.
Also, in 32-bit data bus mode, the [ADR_I] is 5 and not 3 bits wide.
In addition, in the 32-bit data bus mode a debug interface is present in the system. This
interface has 2 32-bit registers that can be read to provide non-intrusive look into the
core’s registers and other internal values of importance.
The selection between 32- and 8-bits data bus modes is performed by defining
DATA_BUS_WIDTH_8 in uart_defines.v, uart_top.v or on the compiler/synthesizer tool
command line.
5.1 Initialization
Upon reset the core performs the following tasks:
• Set the Line Control Register to the desired line control parameters. Set bit 7 to ‘1’
to allow access to the Divisor Latches.
6
Architecture
The core implements the WISNBONE SoC bus interface for communication with the
system. IItt hhaass aann 88--bbiitt ddaattaa bbuuss ffoorr ccoom
mppaattiibbiilliittyy rreeaassoonn. The core requires one interrupt.
It requires 2 pads in the chip (serial in and serial out) and, optionally, another six modem
control signals, which can otherwise be implemented using general purpose I/Os on the
chip.
wishbone
Txd
System clock(clk_i)
Divisor Baud
Latch Generator
Registers Logic
Line
Status
Register
WISHBONE
Signals
Line
Receiver
Contrrol
Logic
Register
Receiver SRX_I
Receiver
Shift
FIFO
Register
FIFO
Contrrol
Register Transmitter
WISHBONE
Logic
bus
Interface
Trasmitter STX_O
Trasmitter
Shift
FIFO
Register
Interrupt
ID
Register INT_O
Interrupt
Logic
Interrupt
Enable
Register
RTS_O
Modem CTS_I
Sattus
Register DTR_O
DSR_I
Modem
Signals
Logic
DCD_I
Modem
control
register RI_I