项目作者: matt-alencar

项目描述 :
Basic UART TX/RX module for FPGA
高级语言: Verilog
项目地址: git://github.com/matt-alencar/fpga-uart-tx-rx.git
创建时间: 2018-10-18T04:39:40Z
项目社区:https://github.com/matt-alencar/fpga-uart-tx-rx

开源协议:MIT License

下载


Basic UART TX/RX module for FPGA

A simple UART TX/RX module implemented using Verilog HDL for FPGA

How it works

The UART TX/RX module is internally projected to work with any baud rate of user choice.
That has to be done through module instantiation parameters:

  1. TICKS_PER_BIT : Number of clock ticks for a bit time (ticks per bit = system clock / baud rate)
  2. TICKS_PER_BIT_SIZE : Number of bits to hold TICKS_PER_BIT value, usually obtained using $bits(TICKS_PER_BIT);

Note that the baud rate can’t be ajusted on-the-fly, it just can be done in compilation / synthesis time.

Those modules is simple designed, no complexity such as parity bit or two stop bits is implemented.

UART TX module

UART TX Module

Module inputs:

  1. i_clk : System clock
  2. i_start : Start pulse
  3. [7:0] i_data : Data to be send

Module outputs:

  1. o_done : Done pulse output
  2. o_busy : Busy signal output
  3. o_dout : Data out (TX) output

Module Waveform:

UART TX Waveform

UART RX module

UART RX Module

Module inputs:

  1. i_clk : System clock
  2. i_enable : RX enable signal
  3. i_din : Data in (RX)

Module outputs:

  1. [7:0] o_rxdata : Data received
  2. o_recvdata : Data received pulse
  3. o_busy : Busy signal output

Module Waveform:

UART RX Waveform

Prerequisites

Any Verilog compiler tool and a logic waveform analyzer, for instance: GTK Wave.

A FPGA (optional).

Compile and test

  1. Compile the source code using Icarus Verilog:
  1. iverilog -o uart_tb.out uart_tb.v
  1. Executing the compiled file (run the tests):
  1. vvp uart_tb.out
  1. Opeing the waveform analyzer:
  1. gtkwave uart_tb.vcd

Explaining the testbench

The testbench script perform a series of stimulus on UART RX/TX modules, and those can be analyzed to check if the module behaviour is working as expected.

The module was tested successfully on Altera Cyclone II and works fine using a such low resources from FPGA.

Versioning

  1. 17/10/2018 - Initial work (V1.0)

Authors

  • Matheus Alencar Nascimento - Initial work

License

This project is licensed under the MIT License - see the [LICENSE] file for details

Acknowledgments