Need help with verilog-uart?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

175 Stars 68 Forks MIT License 46 Commits 4 Opened issues


Verilog UART

Services available


Need anything else?

Contributors list

# 109,458
46 commits

Verilog UART Readme

Build Status

For more information and updates:

GitHub repository:


This is a basic UART to AXI Stream IP core, written in Verilog with cocotb testbenches.


The main code for the core exists in the rtl subdirectory. The uartrx.v and uarttx.v files are the actual implementation, uart.v simply instantiates both modules and makes a couple of internal connections.

The UART transmitter and receiver both use a single transmit or receive pin. The modules take one parameter, DATA_WIDTH, that specifies the width of both the data bus and the length of the actual data words communicated. The default value is 8 for an 8 bit interface. The prescale input determines the data rate - it should be set to Fclk / (baud * 8). This is an input instead of a parameter so it can be changed at run time, though it is not buffered internally so care should be used to avoid corrupt data. The main interface to the user design is an AXI4-Stream interface that consists of the tdata, tvalid, and tready signals. tready flows in the opposite direction. tdata is considered valid when tvalid is high. The destination will accept data only when tready is high. Data is transferred from the source to the destination only when both tvalid and tready are high, otherwise the bus is stalled.

Both interfaces also present a 'busy' signal that is high when an operation is taking place. The receiver also presents overrun error and frame error strobe outputs. If the data word currently in the tdata output register is not read before another word is received, then a single cycle pulse will be emitted from overrunerror and the word is discarded. If the receiver does not get a stop bit of the right level, then a single pulse will be emitted from the frameerror output and the received word will be discarded.

Source Files

rtl/uart.v     : Wrapper for complete UART
rtl/uart_rx.v  : UART receiver implementation
rtl/uart_tx.v  : UART transmitter implementation

AXI Stream Interface Example

two byte transfer with sink pause after each byte

          __    __    __    __    __    __    __    __    __
clk    __/  \__/  \__/  \__/  \__/  \__/  \__/  \__/  \__/  \__
                _____ _________________
tvalid ________/                       \_______________________
       ______________             _____             ___________
tready               \___________/     \___________/


Running the included testbenches requires cocotb, cocotbext-axi, and Icarus Verilog. The testbenches can be run with pytest directly (requires cocotb-test), pytest via tox, or via cocotb makefiles.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.