Project Done By: Apurva Patel Vrajesh Patel Swapna Kalakonda.

Slides:



Advertisements
Similar presentations
Multiplication and Division
Advertisements

MOV Instruction MOV destination, source ; copy source to dest. MOV A,#55H ;load value 55H into reg. A MOV R0,A ;copy contents of A into R0 ;(now A=R0=55H)
Full Adder Display. Topics A 1 bit adder with LED display Ripple Adder Signed/Unsigned Subtraction Hardware Implementation of 4-bit adder.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3:
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3: IT Students.
Multi-Base Calculator CSE378 Final Project By Matthew Lehn & Yanqing Zhu December 17, 2001 Professor Haskell.
The FC16 Forth Core Lab 7 Module F4.1. Lab 7 Hex OpcodeNameFunction 0000NOP No operation 0001DUP Duplicate T and push data stack. N
COE 308: Computer Architecture (T041) Dr. Marwan Abu-Amara Integer & Floating-Point Arithmetic (Appendix A, Computer Architecture: A Quantitative Approach,
The Laws of Exponents.
1 Lecture 2: Number Systems Binary numbers Base conversion Arithmetic Number systems  Sign and magnitude  Ones-complement  Twos-complement Binary-coded.
ALGEBRA 1 Operations with Integers
1 Arithmetic and Logical Operations - Part II. Unsigned Numbers Addition in unsigned numbers is the same regardless of the base. Given a pair of bit sequences.
Number Systems Part 2 Numerical Overflow Right and Left Shifts Storage Methods Subtraction Ranges.
Solving Equations. A quadratic equation is an equation equivalent to one of the form Where a, b, and c are real numbers and a  0 To solve a quadratic.
Addition, Subtraction, Multiplication, and Division of Integers
ECE 2110: Introduction to Digital Systems Signed Addition/Subtraction.
Operations on Bits Arithmetic Operations Logic Operations
Microprocessors Monday, Apr. 13 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3:
Exponents base exponent means 3 factors of 5 or 5 x 5 x 5.
Copyright © Cengage Learning. All rights reserved. 7 Rational Functions.
Addition Multiplication Subtraction Division. 1.If the signs are the same, add the numbers and keep the same sign = = If the.
Definitions Add & Subtract Multiply & Divide ExponentsMixed.
Integer Operations Computer Organization and Assembly Language: Module 5.
Cornell Notes – Topic: Laws of Exponents
BELL RINGER Four 4’s Order of Operations Use what you know about the order of operations to insert the correct symbol in each blank to make the statement.
Quick Guide to Adding, Subtracting, Multiplying, and Dividing Decimals
The Laws of Exponents.
Interesting Integers – Part Dos
Properties of Exponents
Data Representation.
Integer Rules Memorize the Rules.
Exponents exponent power base.
The Laws of Exponents.
The Laws of Exponents.
Instructor: David Ferry
1.6The Laws of Exponents.
Lesson 5-1 Properties of Exponents
The Laws of Exponents.
The Laws of Exponents.
The Laws of Exponents.
The Laws of Exponents.
The Laws of Exponents.
Adding, Subtracting, Multiplying, and Dividing Integers
The Laws of Exponents.
The Laws of Exponents.
ECEG-3202 Computer Architecture and Organization
The Laws of Exponents.
The Laws of Exponents.
The Laws of Exponents.
Number Systems Rayat Shikshan Sanstha’s
The Laws of Exponents.
Number Systems Rayat Shikshan Sanstha’s
The Laws of Exponents.
The Laws of Exponents.
The Laws of Exponents.
The Laws of Exponents.
The Laws of Exponents.
The Laws of Exponents.
The Laws of Exponents.
The Laws of Exponents.
The Laws of Exponents.
The Laws of Exponents.
The Laws of Exponents.
The Laws of Exponents.
The Laws of Exponents.
The Laws of Exponents.
The Laws of Exponents.
The Laws of Exponents.
The Laws of Exponents.
Presentation transcript:

Project Done By: Apurva Patel Vrajesh Patel Swapna Kalakonda

The purpose of this project is to build a coded Hex Calculator that does the following operations: - Multiply -Square of a number - Addions of signed and Unsigned Numbers - Subtractions of signed and Unsigned Numbers - Division - Signed Division

case 1: - Multiplying two negative numbers--> will give the answer in positve so we will take the abs of the two numbers and then multiply: the abs function (Absolute Value Function): -This function will take the 2s’ complement of the number if the number is negative (signed) case 2: If a positive number is multiplied by a negative number then for sure the ans is going to be negative. For the ans to be negative we will take the abs of that negative number and then do a normal multiply and to show that the ans is negative will turn on the LED showing the negative sign. case 3: when both are positive then we will do the regular multiply

Sigmul.Whp : SM* (A B -- +(A*B)) OVER OVER /2Dup A B A B XOR 80 AND /n = ((A xor B) and 80h) -- To check wheather only /one of them is negative DUP /A B n n >R /A B n ?ABS /call to the routine ?ABS to take the absolute /values of negative numbers either A or B or /both * /call to the normal unsigned multiplication routine /for multiplying / C = |A|*|B| R> /C n IF /if n = 1 the answer is negative indicated by /pushing 80h into 80 LD! / LED register THEN ;

This routine multiplies the input number by itself. The following is the whyp file for square. : SQUARE (A -- A*A ) DUP / A A * ; /call to unsigned multiplication routine for multiplying A*A

How to do Unsigned Division to get 16-bit Quotient and a 8-bit remainder. * In order to get a 16-bit quotient we need to carry out the normal division two times. * Each time we will get a 8-bit quotient. * This routine will not give us an overflow unless a number is divided by 00h.

unsigndiv.whp : MU/MOD (NL NH D -- R Q) /THIS ROUTINE DIVIDES /16-BIT NUMERATOR WITH /8-BIT DENOMINATOR TO /GIVE 8-BIT QIUOTIENT AND /8-BIT REMAINDER -ROT /D NL NH DIV DIV DIV DIV ROT_DROP_SWAP ; /R Q : UM/MOD (NL NH D -- R QL QH) >R 00 /NL NH 00 D D MU/MOD /R QH D R> /R QH D SWAP /R D QH >R /R D QH MU/MOD /R2 QL QH R> ; /R2 QL QH

This takes in a 16-bit signed numerator and an 8-bit Denominator Therefore, the sign numbers can be broken down into the following categories: h to 7FFFh --> Positive numbers h to FFFFh --> Negative numbers The following are the cases for signed division: Divident DivisorQuotient Remainder Negative Negative Positive Negative Negative Positive Negative Negative Positive Negative Negative Positive Positive Positive Positive Positive

Signdiv.whp : DIVIDE* (NL NH D -- R QL QH) OVER OVER AND /NL NH D NH D 80 AND IF /NH QLQH>0 AND R<0 ABS -ROT DABS /|D| |NL| |NH| ROT UM/MOD /R QL QH WAITBTN3 /R QL QH DROP DROP 0= /R IF /IF R = 0 NO NEED TO SHOW NEGATIVE SIGN 00 LD! /ELSE LIGHT UP THE SIG LED ELSE 80 LD! /SHOWS REMAINDER IS NEGATIVE THEN ELSE /EITHER NUMERATOR OR DENOMINTOR 0 0< IF /D 0 --> QLQH 0 ABS /NL NH |D| UM/MOD /R QL QH 0= >R SWAP 0= /CHECKS WHEATHER QUOTIENT IS ZERO OR NOT >R SWAP R> R> AND

IF /IF QUOTIENT IS ZERO NO NEED TO SHOW THE /NEGATIVE SIGN 00 LD! ELSE 80 LD! THEN WAITBTN3 00 LD! /R QL QH DROP DROP /R ELSE -ROT /D NL NH 0< /CHECKS WHEATHER NUMERATOR < 0 IF /D>0 AND NLNH R<0 AND QLQH<0 DABS /D |NLNH| ROT UM/MOD /R QL QH 0= >R SWAP 0= /CHECKS WHEATHER QUOTIENT IS ZERO OR NOT >R SWAP R> R> AND Cont...

IF /IF QUOTIENT IS ZERO NO NEED TO SHOW THE /NEGATIVE SIGN 00 LD! ELSE 80 LD! THEN WAITBTN3 /R QL QH DROP DROP /R 0= IF /CHECKS WHEATHER QUOTIENT IS ZERO OR NOT 00 LD! ELSE 80 LD! THEN ELSE /D>0 NLNH>0 --> R>0 QLQH>0 ROT /NL NH D UM/MOD /R QL QH WAITBTN3 /R QL QH DROP DROP /R THEN THEN ; Cont...

Case 1: Subtracting when both the numbers are negative: subcase 1: if B>A then get a positive answer else get a negative answer Case 2: When one of A or B is a negative number subcase 1: if A ‘+ve’ and B ‘-ve’ then ans = A + B else if A ‘-ve’ and B is ‘+ve’ then ans = -(A+B) Case 3: when both are positive ans = A-B and the ans is postive or neg depending on the magnitude of A and B

: S- (A B -- A-B) 0< /checks wheather B<0 IF /B<0 SWAP /B A 0< /checks wheather A<0 IF /A<0 and B<0 - 0< / C = B-A IF /checks wheather C<0 ABS ELSE 80 LD! THEN ELSE /B 0 SWAP ABS + /C = A-(-B) 0< /if C<0 It is a overflow IF FF LD! /Indicates a overflow THEN ELSE SWAP 0< IF /B>0 and A<0 ABS + /C = -A-B 0< /If C is negative indicates a overflow /else answer is negative and 2'scomplement /of C Signsub.whp

IF FF LD! ELSE 80 LD! THEN ELSE /A>0 and B>0 SWAP - /C = A - B 0< IF /if B>A then answer is negative and 2'scomplement of ABS /of C 80 LD! THEN THEN ; Cont...

Changes Made to The W8Y controller Changed from Mux2g to mux 3g Output Y2 of ALU4 N2 ALU4 Input from 16x8 Dpram

Whyp Words Added to W8Y controller * mpp : Carries out the multiplication of the numbers in the data stack when called 8 times * divide: carries out the division of the numbers in the data stack when called 8 times to leave a 8-bit quotient and 8-bit remainder * ABS: takes the absoloute value of the number in T-Reg * DABS: Takes the 2s complement of a 16-bit number and leaves the higher 8-bit in T-Reg and the lower 8-bits in N-Reg

User’s Guide 1. First enter the code for the operation to be carried out. Project 1 operations: hex code operation 01hsigned subtraction 02hunsigned multiplication 03h Square 04hsigned multiplication Project 2 operations: hex codeoperations 01hunsigned division 02h signed division If the entered hex code is different from the above codes all the LEDs will Light up indicating a NULL operation. 2. Enter the required hex values

Cont … user guide * For division enter the lower 8-bits of numerator first and followed by higher 8-bits followed by the denominator * Press BTN3 to enter the values through the switches. * Negative numbers will be indicated by turning on the most significant LED by pushing 80h in the LD-reg * Overflow is indicated by lighting up all the LEDs

?

MERRY CHRISTMAS AND A HAPPY NEW YEAR TO ALL