Nexys 2 FPGA CALCULATOR

Team Members: Nicholas Bilcheck, Sam Greenberg, and Hang Ha

Project Title: Nexys2 Calculator

Project Objectives:

The goal of this project is to develop a broader understanding of Verilog and the Nexys2 board to develop a functional and useful product.  The product for this project will be a calculator whose functionality is limited only by time constraints. In order to develop a calculator, knowledge on components that can be used with the Nexys2 board to make a more practical device will need to be obtained.  These additional components include but are not limited to a keypad for inputs and a LCD display for outputs. In order to power the LCD display, knowledge on how to use an arduino to supply 5 V will also be required. In addition, further knowledge of Verilog will be required to input values from separate components, use those inputs to perform calculations, and then output those results to various screens.  This knowledge will likely be obtained initially from instruction sets and other guides made by the developers of the Nexys2 board, the keypad, and the LCD. Using these guides will allow for an understanding of how integration between the modules and physical components will work. Furthermore, our goal for this project is to implement and master the modules necessary for storing and managing our data on the calculator and implementing the add, subtract, multiply and divide modules.  A significantly challenging task for this project will be displaying the values on the LCD in our calculator. In addition, attempting to take further advantage of the LCD to display operators and previous entries will be later goals that will hopefully be achieved. A successful final project will have lead our group to obtain and understand the knowledge necessary to develop a calculator for the Nexys2 board involving all the functionality previously discussed, while adding further functionality as the project progresses and always being open to improving the final project. 

Hang is in charge of the inputs. This includes the keypad and buttons on the Nexys2 board. Hang will need to implement modules to correctly receive input from the user and interpreting that information as a 4-bit number. She will then have to convert that into its decoded meanings – numbers and operations. In addition, she will have to figure out how the keypad works in terms of how to wire the keypad to the board and how to supply and read voltages to understand the outputs from the device. When she has finished that she will be assisting Nicholas with his section of the project.  Along the way, she will work on integrating the various project components together.

Sam is in charge of the computational aspect of the project. He will have to implement the different computational algorithms which include addition, subtraction, multiplication and division. Implementing these modules may be as simple as just using the operators or may involve writing individual modules to perform the operation.  At later stages of the project Sam will also need to implement these operations, possibly with possibly negative numbers and order of operations. Sam will then need to pass the stored values to Nicholas for his phase of the project.

Nicholas will be using the information sent to him from Sam’s phase of the project to display on the LCD display the information stored in the calculator. This will include the previous number, the operation, and the result. Nicholas may eventually, if time permits, need to learn how to display “scrolling” information to allow the user to read text longer than the LCD display will allow.

There are three big portions in the block diagram: The keypadToHex decoder, the processor, and the output. 

The keypadToHex decoder: this block will receive an input from a 4×4 keypad, and figure out which button was pressed using the keypadScan module.  The keypadScan module will be made up of a multiplexer and an FSM . There is also a debouncer inside this block so that inputs from the keypad function properly. The output will be a hexadecimal value that indicates which value is pressed of the inputs whether it is a decimal value, a clear function, or an operator. This block is of difficult complexity and Hang works on this module.

A delay module is used to delay the key-pressed signal so the keypad scanner and the computational module can work together.

The computing module: this block receives the hexadecimal input from the keypadToHex module. The code involves a case/if statement to navigate through different arithmetic modules and produce the result of the equation as the output. This task is very difficult and Sam works on this module.

The result from the computational module is connected to a binary to decimal converter, which divide the result into hundreds digit, tens digit, and one digits so that it can be easily displayed on either 7 segment display or LCD.

The hexToAscii module converts hex value to corresponse string value.

The storeEq module store the equation string until the equal button is pressed. At that point, the result of the equation is assigned to the equation string.  

The LCD module: this block receives inputs from the memory block to display equations and results on the LCD display. This task is very difficult as well. Hang and Nick work on this module. 

How the module will be tested: The methods of testing will mostly involve having the Nexys2 board run the module. For the keypadToHex decoder, there will be the 7-segment-display on the board show the value of the button pressed. For the arithmetic module simulations will be run as well as physically using the Nexys2 board.  For the LCD display, the only method of testing that will be used is attempting to display and change outputs on the LCD display properly.