Bachelor Thesis Fpga Design of Uart Instruction Controller
Bachelor Thesis Fpga Design of Uart Instruction Controller
Bachelor Thesis Fpga Design of Uart Instruction Controller
本科毕业设计(论文)
Bachelor Thesis
FPGA DESIGN OF UART INSTRUCTION
CONTROLLER
By
17219003
Supervised By
Li Jincheng
北京交通大学毕业设计(论文) 附录
Acknowledgment
北京交通大学毕业设计(论文) 附录
Undertaking
北京交通大学毕业设计(论文) 附录
ABSTRACT
Today’s complex digital system communicates with outside world through its analog and
digital interfaces. Field Programmable Gate Arrays (FPGAs) are the main building blocks of
this digital system. The digital interfacing of FPGA’s has several serial communication
protocols such as UART (universal asynchronous receiver/transmitter), SPI (serial peripheral
interface) and I 2 C (inter-integrated circuit). In this article we will explore great detail about
UART communication protocol and understand how FPGAs communicate with computers
using this communication protocol. We will also be designing Verilog module code for UART
transmitter with testbench, Verilog module code for UART receiver with testbench, Verilog
module code for the UART instruction controller with testbench and the Verilog top module
code for the instruction controller combined with UART transmitter, UART receiver and the
UART instruction controller. We will be using Modelsim software the simulation of those
Verilog codes and later on we will be testing with Altera cyclone I FPGA to verify our works.
北京交通大学毕业设计(论文) 附录
CONTENTS
北京交通大学毕业设计(论文) 附录
INTRODUCTION
A universal asynchronous receiver/transmitter (UART) is a digital communication protocol
for two devices or more devices. Basically, it has two sides: the transmitter and the receiver.
Communication is done by sending and receiving data asynchronously between the
transmitter and receiver. Being asynchronous, the UART does not need a common clock
between the transmitter and receiver. Thus, connected devices can work independently.
Two devices connected by UART will have their own UART transmitter pin (TX) and
UART receiver pin (RX). During data transmission between devices connected by UART,
there is a certain data format conversion: parallel data format to serial data format and serial
data format back to parallel data format. The serial pin of the transmitter is generally called
transmitter (TX). The corresponding receiver pin is generally called receiver (RX). The
connection between the transmitter and receiver is established by physically wiring these two
pins. The UART communication can be established between different devices. We in this
article specifically focus on the one between the FPGA (Altera cyclone I) and PC.
The data format and the transmission speed of data in UART are configurable. UART first
receive the parallel data format from the data bus of the seder device and then it will convert
the parallel data format to the serial data format at the transmitter side (TX). After data being
converted to serial format, the data will be transmitted and the receiver side (RX) of the
UART will receive the serial format and convert it back to parallel data format. In this fashion
the data communication between the sender and the transmitter will be
北京交通大学毕业设计(论文) 附录
Asynchronous serial communication requires few transmission lines, high reliability and can
cover up to 30m transmission distance. It is widely used in data exchange between
microcomputer and peripheral devices. Generally, UART (Universal Asynchronous Receiver
Transmitter) is used to realize this function, such as national ins 8250, which is used as serial
interface chip in IBM PC. In practical application, only a few main functions of UART are
needed. Special interface chip will cause waste of resources and increase of cost. Especially in
the field of electronic design, SoC (system on chip) technology is becoming more and more
mature recently. Because the function of the whole system is to be realized in a single chip or
a few chips, designers can integrate function modules like UART into FPGA.
1.1.1 FPGA
What are FPGAs? Field programable gate array
FPGAs are components that can be thought of as a giant ocean of digital components (gates,
look-up-tables, flip-flops) that can be connected together by wires. The code that we write
makes real physical connections with wires to perform the function that we need. What makes
FPGAs and ASICs special is that they are very good at performing a large number of
北京交通大学毕业设计(论文) 附录
operations in parallel (at the same time). They are used in high-speed, high-performance tasks
such as image processing, telecommunications, digital signal processing, high-frequency
stock market trading, and many others.
What are ASICs?
ASIC stands for Application Specific Integrated Circuit. ASICs are similar in theory to
FPGAs, with the exception that they are fabricated as a custom circuit. This means that unlike
FPGAs they are not reprogrammable, so we had better get them right the first time. Since
ASICs are custom circuits, they are very fast and use less power than an FPGA. This can be
critical in power-sensitive applications such as cell phones, mp3 players, and other battery-
operated devices.
Both FPGAs and ASICs are designed with a Hardware Description Language (HDL). The two
most popular hardware description languages are VHDL and Verilog. Here in our project, we
will be using Verilog HDL coding.
1.1.3 History
Verilog HDL is a hardware modeling language developed by gateway design automation
company for its simulator products in 1983. At that time, it was just a special language. Due
to the wide use of their simulation and emulator products, Verilog HDL, as a convenient and
practical language, is gradually accepted by many designers. In an effort to increase the
popularity of language, Verilog HDL language was introduced into the public domain in
1900. Open Verilog International (Ovi) is an international organization that promotes the
development of Verilog. In 1962, Ovi decided to promote Verilog Ovi standard to become I e
standard. Verilog language became IEEE Std 1364-1895 in 1955. The complete standard is
described in detail in the hardware description language reference manual.
There are two types of data in Verilog HDL: wire network data type and register data type.
The wire net type represents the physical connection between components, while the register
type represents the abstract data storage element.
It can describe the hierarchical design, and can use the module instance structure to describe
any level.
The scale of the design can be arbitrary; the language does not impose any restrictions on the
scale (size) of the design.
· Verilog HDL is no longer the exclusive language of some companies, but the i e standard.
Both human and machine can read Verilog language, so it can be used as an interaction
language between EDA tools and designers.
The description ability of Verilog HDL can be further extended by using programming
language interface (PLI) mechanism. PL I is a collection of routines that allow external
functions to access information in Verilog modules and allow designers to interact with
simulators.
北京交通大学毕业设计(论文) 附录
The design can be described at multiple levels, from switch level, gate level, register transfer
level (RTL) to algorithm level, including process and queue level.
The ability to use built-in switch level primitives to fully model the design at the switch level.
The same language can be used to generate simulation incentives and specify validation
constraints for tests, such as the specification of input values.
Verilog HDL can monitor the execution of simulation verification, that is, the designed values
can be monitored and displayed during the execution of simulation verification. These values
can also be used to compare with expected values and print report messages in case of
mismatches.
In the behavior level description, Verilog HDL can not only describe the design on the RT L
level, but also can
It can describe the design in architecture level description and algorithm level behavior.
It can use gate and module instantiation statements to describe the structure at the structure
level. build
Modeling capability, that is, in a design, each module can be modeled at different design
levels.
· Verilog HDL also has built-in logic functions such as & (bitwise AND) and | (bitwise OR).
High level programming language structure, such as conditional statement, situation statement
and loop statement, can be used in the language.
· concurrency and timing can be modeled explicitly.
Provide strong ability to read and write documents.
Language is non deterministic in certain situations, that is, models can produce different
effects on different simulators
For example, the order of events on the event queue is not defined in the standard.
1.1.5
1.1.6
1.1.7
1.1.8
1.1.3
Module Representation
北京交通大学毕业设计(论文) 附录
1.2
1.2.1
in
1.3
1.4
1.5
1.6
北京交通大学毕业设计(论文) 附录