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
The Vedic multiplier is depends on the “UrdhvaTiryagbhyam” sutra (algorithm). These Sutras have been traditionally used for the multiplication of two numbers in the decimal number system. In this work, we apply the same ideas to the binary number system to make the proposed algorithm compatible with the digital hardware. It is a general multiplication formula applicable to all cases of multiplication. It literally means “Vertically and Crosswise”. It is based on a novel concept through which the generation of all partial products can be done with the concurrent addition of these partial products. The algorithm can be generalized for n x n bit number. Since the partial products and their sums are calculated in parallel, the multiplier is independent of the clock frequency of the processor. Due to its regular structure, it can be easily layout in microprocessors and designers can easily circumvent these problems to avoid catastrophic device failures. The processing power of multiplier can easily be increased by increasing the input and output data bus widths since it has a quite a regular structure. Due to its regular structure, it can be easily layout in a silicon chip. The Multiplier based on this sutra has the advantage that as the number of bits increases, gate delay and area increases very slowly as compared to other conventional
List the inputs, any processes/calculations, and outputs. Use the same valid variable names you used in Step 1.
So, I went back to the book and looked in chapter two for a while then I went on to chapter three and found on pg. 91 -97 about the if and else statements to create a module. After I played with it for a while and kept getting error messages. I finally realized when I typed if I would type the condition which needed to be int(number) % 2 == 0 : because int is for integer that way the program would know it would be a whole number. The “%” is used in this program because it means remainder or module and I used it for the module part. The double == signs just bean equal I found this on pg. 92. Next on pg. 93 it shows to indent and type your sequence of statements and mine is print(“This si even”). I did this to so when the user types in any even number it will tell they user that it is an even number. Next, when I typed else I hit enter and indented again to type my sequence of statements, which is print(“this is odd”). This is so when the user types in an odd number the program will tell them that it is odd. From our notes I saw how to include the random library which is to type random = random.randint (0, 20000). The first time I entered this I spelled it wrong and immediately received an error message. I went back and changed the spelling and it ran
The objective of this lab is to be able to understand how the CPU functions work, as well as understanding machine and assembly language.
2) The header is the starting point and the body is a list of statements that belong to the module.
learnt some coding at GCSE that helped me in this but I wanted to learn how to use python to
This subtest asks Jackie to solve written math problems requiring addition, subtraction, multiplication, and division using whole numbers, fractions, and decimals. This subtest measures untimed, written
39 5.3 Configuration .................................................................................................. 40 5.4 Structure ......................................................................................................... 40 5.5 Processes (controls) ....................................................................................... 43 5.6 Balanced scorecard ......................................................................................... 45 5.7 Relationships .................................................................................................. 46 5.8 Gantt Chart ..................................................................................................... 47 5.9 Stakeholder Management................................................................................ 49 5.10 Monitoring Success ....................................................................................... 51 6.0 Critique of strategy............................................................................................. 52 6.1 Financial.......................................................................................................... 52 6.2 People ............................................................................................................. 52 6.3 Legal Issues .................................................................................................... 52 7.0
To be able to use binary and hexadecimal numbers, we must switch the calculator mode to scientific mode. Click View on the toolbar and then choose Programmer.
// check if there is a multilplication command, if there is then multiply all the
static String ac[] = new String[16], md[] = new String[16], mq[] = new String[16], md1[] = new String[16],
cout<< “ This is a Calculator containing the following functions : Addition, Subtraction, Multiplication, Division, Percentage, Power ”;
In engineering studies, working with numbers is one of the most substantial concepts. Numbers are not used only in civil or architecture engineering as most of people think. Numbers are important in all engineering disciplines. For example, agriculture engineers work in numbers in there calculation to design systems that produce food, feed, fiber and other products with high quality. Also, in computer engineering field, computer engineers must know how to deal with numbers because computer language based on numbers. For this reason, this section will describe the mechanisms of using numbers in a proper way.