Skip to content

Repository files navigation

Vyges IP TemplateUse this templateLicense: Apache-2.0Build

UART Controller IP

A configurable UART controller with APB interface, FIFO support, and interrupt capabilities for embedded systems.

Overview

The UART Controller IP provides a complete serial communication solution with the following features:

  • APB Slave Interface: Standard APB3 protocol for register access
  • Configurable Baud Rate: 9600 to 921600 bps
  • FIFO Support: TX/RX FIFOs with configurable depth (4-64 entries)
  • Interrupt Support: TX empty and RX full interrupt generation
  • Error Detection: Parity, framing, and overrun error detection
  • Power Management: Clock gating and sleep mode support
  • ASIC Ready: Designed for SkyWater 130nm Open Source PDK

Pinout

NameFunctionDirectionDescription
PCLK_iclockinputAPB clock input (50 MHz)
PRESETn_iresetinputAPB reset input (active low)
PSEL_icontrolinputAPB select input
PENABLE_icontrolinputAPB enable input
PWRITE_icontrolinputAPB write input
PADDR_i[7:0]datainputAPB address input (8-bit)
PWDATA_i[31:0]datainputAPB write data input (32-bit)
PRDATA_o[31:0]dataoutputAPB read data output (32-bit)
PREADY_ostatusoutputAPB ready output
PSLVERR_ostatusoutputAPB slave error output
UART_TX_odataoutputUART transmit output
UART_RX_idatainputUART receive input
IRQ_TX_EMPTY_ointerruptoutputTransmit FIFO empty interrupt
IRQ_RX_FULL_ointerruptoutputReceive FIFO full interrupt

Register Map

AddressNameAccessDescription
0x00CTRLR/WControl Register
0x04STATRStatus Register
0x08TXDATAWTX Data Register
0x0CRXDATARRX Data Register
0x10BAUDR/WBaud Rate Configuration
0x14FIFOR/WFIFO Configuration
0x18INTR/WInterrupt Configuration

Control Register (CTRL)

  • Bit 0: Enable
  • Bit 1: TX Enable
  • Bit 2: RX Enable
  • Bit 3: Parity Enable
  • Bit 4: Parity Type (0=Even, 1=Odd)

Status Register (STAT)

  • Bit 0: TX Busy
  • Bit 1: RX Busy
  • Bit 2: TX FIFO Full
  • Bit 3: RX FIFO Empty
  • Bit 4: Parity Error
  • Bit 5: Frame Error
  • Bit 6: Overrun Error

Interrupt Register (INT)

  • Bit 0: TX Empty Interrupt Enable
  • Bit 1: RX Full Interrupt Enable
  • Bit 2: TX Empty Interrupt Pending
  • Bit 3: RX Full Interrupt Pending

Parameters

ParameterDefaultRangeDescription
CLOCK_FREQUENCY50MHz1-100MHzSystem clock frequency
BAUD_RATE1152009600-921600UART baud rate
FIFO_DEPTH164-64FIFO depth for TX/RX
DATA_WIDTH85-8UART data width
STOP_BITS11-2Number of stop bits
PARITY_ENABLEfalseboolEnable parity checking
PARITY_TYPE"even"enumParity type (even/odd/none)

Usage Example

// Instantiate UART controlleruart_controller#(
.CLOCK_FREQUENCY(50_000_000),
.BAUD_RATE(115_200),
.FIFO_DEPTH(16),
.DATA_WIDTH(8),
.STOP_BITS(1),
.PARITY_ENABLE(1'b0),
.PARITY_TYPE("even")
) uart_inst (
.pclk_i(pclk),
.presetn_i(presetn),
.psel_i(psel),
.penable_i(penable),
.pwrite_i(pwrite),
.paddr_i(paddr),
.pwdata_i(pwdata),
.prdata_o(prdata),
.pready_o(pready),
.pslverr_o(pslverr),
.uart_tx_o(uart_tx),
.uart_rx_i(uart_rx),
.irq_tx_empty_o(irq_tx_empty),
.irq_rx_full_o(irq_rx_full)
);

Testing

Simulation Framework

The project includes comprehensive simulation support with multiple testbench types and simulators:

SystemVerilog Testbench

cd sim
make verilator # SystemVerilog with Verilator
make icarus # SystemVerilog with Icarus Verilog

Cocotb Testbench

cd sim
make cocotb # Cocotb with default simulator (Icarus)
make cocotb-verilator # Cocotb with Verilator
make cocotb-icarus # Cocotb with Icarus Verilog

Run All Tests

cd sim
make test-all # Run all simulation types

Test Coverage

  • Functional Coverage: 95% minimum target
  • Code Coverage: 90% minimum target
  • Toggle Coverage: 100% for all data signals
  • FSM Coverage: 100% state and transition coverage

Physical Design

OpenLane Flow (Sky130B PDK)

The IP is designed for synthesis with OpenLane targeting SkyWater 130nm Open Source PDK:

# From flow/openlane/ directory
make sky130b # Run with Sky130B PDK (default)
make sky130a # Run with Sky130A PDK
make help# Show all options
make final # Collect final results

Physical Design Files

  • Configuration: flow/openlane/config_sky130b.json
  • Timing Constraints: flow/openlane/constraints_sky130b.sdc
  • Pin Order: flow/openlane/pin_order_sky130b.cfg
  • Floorplan: flow/openlane/floorplan_sky130b.tcl

ASIC Specifications

  • Technology: SkyWater 130nm Open Source PDK (SKY130)
  • Platform: sky130bhd (high-density standard cells)
  • Die Area: 1mm x 1mm (1000x1000 microns)
  • Core Utilization: 80%
  • Supply Voltage: 1.8V nominal
  • Metal Layers: 5 layers (li1, met1-met5)

Performance

  • Maximum Frequency: 50 MHz
  • Area: < 0.1mm² (target)
  • Power: < 5mW dynamic, < 1μW leakage at 50MHz, 1.8V
  • Latency: < 10 clock cycles for APB access
  • Throughput: Full baud rate support (9600-921600 bps)
  • Process Corners: TT, FF, SS, FS, SF

Project Structure

uart-controller/
├── rtl/ # RTL implementation
│ ├── uart_controller.sv # Main UART controller
│ ├── sync_fifo.sv # Synchronous FIFO
│ ├── uart_transmitter.sv # UART transmitter
│ └── uart_receiver.sv # UART receiver
├── tb/ # Testbenches
│ ├── tb_uart_controller.sv # SystemVerilog testbench
│ ├── verilator/ # Verilator-compatible testbench
│ └── cocotb/ # Python testbench
├── sim/ # Simulation framework
│ ├── Makefile # Main simulation makefile
│ ├── verilator/ # Verilator simulation files
│ └── cocotb/ # Cocotb simulation setup
├── flow/ # Physical design flow
│ └── openlane/ # OpenLane configuration
├── docs/ # Documentation
│ ├── overview.md # Technical overview
│ ├── architecture.md # Architecture documentation
│ └── UART_design_spec.md # Design specification
├── integration/ # Integration examples
└── vyges-metadata.json # Vyges catalog metadata

Documentation

License

Apache-2.0 License - see LICENSE file for details.

Important: The Apache-2.0 license applies to the hardware IP content (RTL, documentation, testbenches, etc.) that you create using this template. The template structure, build processes, tooling workflows, and AI context/processing engine are provided as-is for your use but are not themselves licensed under Apache-2.0.

For detailed licensing information, see LICENSE_SCOPE.md.

Author

Shivaram shivaram@vyges.com

Repository

https://github.com/vyges/uart-controller

Vyges IP Catalog

This IP is part of the Vyges IP catalog. For more information about Vyges IP development conventions and tools, visit:

About

A configurable UART controller IP with APB interface, FIFO support, and interrupt capabilities. Designed for SkyWater 130nm Open Source PDK with comprehensive verification and OpenLane integration.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages