In this project, we implemented a simple UART protocol on the AX309 Xilinx Spartan-6 FPGA. The goal was to send a sequence of numbers to the FPGA using this UART protocol. Upon reception, the FPGA employs a Bubble Sort algorithm to sort the numbers, returning the sorted array to the connected PC. The development environment used for programming the FPGA was Xilinx ISE.
-
Bubble Sort Algorithm (
bubblesort.vhdl
):- VHDL implementation of the Bubble Sort algorithm designed for sorting an array of numbers.
- Input:
- Clock signal (
clk
) - Reset signal (
reset
) - Input array (
in_array
)
- Clock signal (
- Output:
- Sorted array (
sorted_array
)
- Sorted array (
- The sorting process is triggered by the rising edge of the clock signal.
-
UART Implementation (
uart.vhdl
):- VHDL code implementing a UART module with generic parameters for divisor configuration.
- Input:
- Clock signal (
clk
) - Reset signal (
reset
) - Transmit data (
txdata
) - Write signal (
wr
) - Read signal (
rd
)
- Clock signal (
- Output:
- Received data (
rxdata
) - Flags for transmission availability (
tx_avail
), transmission busy (tx_busy
), received data availability (rx_avail
), received data full (rx_full
), and reception error (rx_error
).
- Received data (
- The UART module is designed to handle both transmitting and receiving data.
-
UART Receiver (
uart_rx.vhdl
):- VHDL code for the UART receiver, which includes synchronization logic and error checking.
- Input:
- Clock signal (
clk
) - Reset signal (
reset
) - Input data (
rxd
) - Clear signal (
clear
)
- Clock signal (
- Output:
- Received data (
dout
) - Flags for data availability (
avail
) and error (error
).
- Received data (
-
UART Transmitter (
uart_tx.vhdl
):- VHDL code for the UART transmitter, which handles data transmission with start and stop bits.
- Input:
- Clock signal (
clk
) - Reset signal (
reset
) - Transmit data (
din
) - Write signal (
wr
)
- Clock signal (
- Output:
- Transmission busy flag (
busy
) - Transmit data line (
txd
).
- Transmission busy flag (
- Program the FPGA using Xilinx ISE with the provided VHDL files.
- Connect the FPGA to a PC through the UART interface.
- Send a sequence of numbers from the PC to the FPGA using the implemented UART protocol.
- Receive the sorted array back from the FPGA.