# Integer_Matrix_Solver_UART_SERIAL_VHDL

34

1

Posted

## Introduction: Integer_Matrix_Solver_UART_SERIAL_VHDL

This instructable tutorial show you how to make a 2 by 2 matrix solver by implement UART Serial terminal module as well as a matrix solver module. The user will be able to enter a 2 by 2 matrix and then the implemented design will spit out the solution to the linear system.

To use this code, you will need:

- A Digilent Basys 3 FPGA Board

- Computer with the Xilinx Vivado Software (Webpack Edition will work). For this module, we used the 2017.2 version.

- A Micro USB Cord (Data transfer capable)

Authors: Drew Miller, EE Major, Cal Poly SLO, Sukhdeep Singh, EE Major, Cal Poly SLO Class: Digital Design

- EE/CPE 133 Instructor: Joseph Callenes

Sources:

## Step 1: Step 1: How It Works

Inputs: The user inputs a linear system into the computer terminal and then a UART Module converts them to a array for the matrix solver module to manipulate. The UART module interfaces with the user and allows them to enter the appropriate matrix as well as guide them to properly input data. The system also has a reset/enable switch mapped to the leftmost switch of the Basys3 board.

Outputs:The results from the matrix solver are passed through the UART module interface and then displayed on the computer terminal with the solutions listed on the screen. The matrix solver outputs unsigned standard logic vectors to the UART module which converts them to more user friendly outputs for the user to appreciate. The current matrix solver is only able to have numbers up to 15 entered and the output result must be a clean integer or the matrix solver program is unable to output the correct solution.

Top Level "Serial Control" Module: The user inputs their desired linear system into this module through the UART_TX and UART_RX modules and it converts the inputs from the computer terminal to an array of standard logic vectors that are processed by the matrix solver module. The matrix solver module then returns an array of standard logic vectors that are then displayed on the screen by the UART serial interface. Transmitting and receiving data through the UART modules is accomplished through the use of a very lengthy FSM in this module.

UART_TX Module: The user inputs an 8 bit standard logic vector and a send signal in order to send data via the USB interface. While it is sending data, the TX_Active signal is high. After it has send the data, the TX_Done signal pulses.

UART_RX Module: The user receives 8 bits of data at a time from the USB interface. A pulse from RX_DV is an indication that data has been received and that the RX_Byte vector logic can be read.

Matrix Solver Module: The matrix solver receives an imputed array from the UART module that represents the matrix. The matrix solver then converts each number in the linear system into integers to make it easier to operate on them. Inside the matrix solver module there are several sub modules. The first sub module is the inverse_matrix_1 which takes the matrix and then gives the inverse of the matrix given. The next sub module is the multiplier which multiplies the total_matrix by the inverse matrix using standard matrix operations. FInally, the master module maps them together to output one single answer.

## Step 2: Step 2: Programming the Basys 3 Board

Once you have acquired the source code from below upload it to the basys 3 board to use the interface.

https://reference.digilentinc.com/basys3/refmanual

## Step 3: Step 3: How to Use It

Use a serial interface at 9600 baud in order to communicate with the Basys3 UART. I used screen on linux with the following command:

screen /dev/ttyUSB1 9600

In order to do this on linux, I had to add my user to the group "dialout". On Windows, putty should work, and on MacOSX, it should be a similar process to linux.

Flipping the leftmost switch to the on position starts the matrix solver. Switching it to off resets the matrix solver.

## Recommendations

• ### 3D CAM and CNC Class

339 Enrolled

• ### Microcontroller Contest

We have a be nice policy.
Please be positive and constructive.