preview

Fpga As A Calculator That Receives Two Four Bit Binary Numbers

Decent Essays

Maryann Dalal
Final Project
Prof. Ken Arnold

FPGA as a calculator 12/2/2015

Introduction: This project is designed to make the FPGA as a Calculator that receives two four bit binary numbers and do four different operations on those two numbers. The four operations are addition, subtraction, division, and XOR (bit wise operation). The project is designed with top model and sub modules. Moreover, when the user enters the two inputs in binary the result will display in decimal except for the last operation which is the bit wise (XOR) that should be displayed in binary. The only challenge part that I wasn’t able to fix is I have very long code because I saved the result from add, subtract, and multiplication in a register and had to do check from 0-225 cases and that’s how I can display the binary numbers on the FPGA board.

Modules:

1-Top Level Module: includes all the inputs, outputs and variables that needed in the program along with six sub modules. Moreover, I used the top module to instantiate the sub modules and defined the two input numbers and the four operations. Furthermore, most of the code work is done in the top level and here’s is the code source:
`timescale 1ns / 1ps

module Final_Project(input M_CLOCK, output IO_SSEG_COL, output reg [4:0]F_LED, output reg [7:0]IO_LED, output [7:0]IO_SSEG, output [3:0]IO_SSEGD, input [7:0] IO_DSW, input [3:0]IO_PB); assign IO_SSEG_COL = 1 'b1;

parameter

Get Access