Skip to content

SUHANI102003/UART-FIFO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

53 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ UART Protocol with FIFO Buffers

Verilog UART FIFO

πŸ“ Overview

A Verilog-based UART (Universal Asynchronous Receiver/Transmitter) design integrated with FIFO buffers to enable efficient and reliable serial communication between devices.


πŸ“– What is UART?

UART (Universal Asynchronous Receiver/Transmitter) is a hardware protocol for serial communication, transmitting and receiving data one bit at a time.
It is asynchronous, meaning the transmitter and receiver do not share a clock, but agree on a baud rate to interpret data correctly.

βœ… Key Points:

  • πŸ”„ Converts parallel data to serial and vice versa.
  • 🟒 Uses start and stop bits for synchronization.
  • ↔️ Supports full-duplex communication.
  • πŸ’» Commonly used in microcontrollers, FPGAs, PCs, and peripherals.

❓ Why and Where is UART Used?

  • Why: ⚑ Simple, cost-effective, and reliable for short distances.
  • Where: πŸ”— Communication between microcontrollers, FPGA boards, PCs, sensors, GPS modules, Bluetooth devices, ADCs, etc.

⏱ Working with 16Γ— Oversampling

  • πŸ” Receiver samples the incoming data 16 times per bit period.
  • 🎯 Detects the middle of each bit, reducing timing errors.
  • πŸ“Š Example: For 9600 bps, the sampling clock runs at 9600 Γ— 16 = 153600 Hz.
  • Process: Start bit detection β†’ sample data bits at 16Γ— rate β†’ stop bit verification.

✨ Features

πŸ”Ή UART Features

  • πŸ“‘ Asynchronous serial communication.
  • ↔️ Full-duplex support.
  • βš™οΈ Configurable data frame of 5–8 data bits, parity, 1–2 stop bits (Here, 8 data bits, no parity, 1 stop bit)
  • πŸ›  Simple hardware implementation.
  • βœ… Reliable for short distances.
  • πŸ“ Configurable baud rate.
  • ⚠️ Supports error detection.
  • 🌍 Widely supported in embedded systems.

πŸ”Έ FIFO Features

  • πŸ“₯ First-In-First-Out data handling.
  • ⏳ Temporary data storage between producer and consumer.
  • πŸ”„ Smooth operation in full-duplex systems.
  • πŸ“ Configurable depth and width.
  • 🚦 Status signals: full, almost full, empty, almost empty.
  • πŸ›‘ Reduces data loss during bursts.
  • ⚑ Hardware-friendly design for FPGA/ASIC systems.

🧰 Working

The serial transmission starts with a 'start bit' (0), followed by data bits (1 byte), and ends with a 'stop bit'.

πŸ“Œ Transmission of a single byte:

Since the transfer is asynchronous, the receiver and transmitter must agree on baud rate, stop bits, and parity bit.

πŸ“Š Using 16Γ— oversampling, the middle of the data bit is estimated for accuracy:


πŸ— Design Details

⚑ Configuration Table

Parameter Value
Data Bits 8
Stop Bits 1
Parity None
Oversampling 16Γ—
Baud Rate 9600

πŸ“Œ Block Diagram

diagram

πŸ“€ Transmitter ASMD Chart

tx

πŸ“₯ Receiver ASMD Chart

rx


πŸ“‚ Directory Structure

β”œβ”€β”€ uart.v # Top-level UART module
β”œβ”€β”€ uart_tx.v # UART transmitter
β”œβ”€β”€ uart_rx.v # UART receiver
β”œβ”€β”€ fifo.v # FIFO buffer module
β”œβ”€β”€ uart_tb.v # UART testbench
β”œβ”€β”€ fifo_tb.v # FIFO testbench
└── README.md # Project documentation

βš™οΈ Module Details

  • uart.v β†’ Integrates UART transmitter, receiver, and FIFO.
  • uart_tx.v β†’ Handles serial data transmission.
  • uart_rx.v β†’ Handles serial data reception.
  • fifo.v β†’ Manages data buffering between TX and RX.
  • uart_tb.v & fifo_tb.v β†’ Testbenches for simulation and verification.

πŸ’» Simulation

πŸ“Œ Requirements

  • Simulator: ModelSim, Vivado Simulator, or any Verilog-compatible tool.
  • FPGA Tool: Quartus, Vivado, or any synthesis tool for FPGA deployment.

▢️ Simulation Steps

  1. Compile all Verilog modules and testbenches.
  2. Load testbenches into the simulator.
  3. Run simulation and verify waveforms for correct data transfer.

πŸ“ Schematic

πŸ–Ό RTL Schematic

πŸ–Ό Synthesis Schematic


πŸ“Š Results

πŸ”Ή UART Top


πŸ”Ή UART Transmitter


πŸ”Ή UART Receiver


πŸ† Tools Used



πŸ“œ License

πŸ“Œ This project is licensed under the MIT License.


🀝 Contribution

Contributions are welcome! πŸŽ‰

If you’d like to improve this project (bug fixes, feature enhancements, documentation, etc.), follow these steps:

  1. 🍴 Fork the repository.
  2. 🌱 Create a new branch:
    git checkout -b feature-name
    git commit -m "Add new feature or fix bug"
    git push origin feature-name

About

This repo contains the design and testbench of UART - FIFO Protocol in Verilog

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors