MSU ECE 4743 - Computer Aided Digital System

Unformatted text preview:

Slide Number 1Multiplication and Division made easyBinary to BCDBinary to BCDConversion optionsBCD MultiplicationWhy Use a Comparator? Shift-Add-3 No Adders!No Shifters!No Recursion Full 8-bit conversionLab AssignmentDepartment of Electrical and Compute EngineeringMississippi State UniversitySherif Abdelwahed Shift-add-3 AlgorithmSeptember 5, 2007Computer Aided Digital Systems Design - EE 4743/6743Multiplication and Division made easy To multiply by 2, shift left To divide by 2, shift right Don’t need to use shifter though! B = A / 2A3A2A1A0B3B2B1B0‘0’Binary to BCD Seven-segment display on the Spartan 3 board Currently is set up to display hexadecimal 0-9, A-F Lab 2 is set up to display input switches in hexadecimal on seven-segment display Exercise is to build circuit to change to decimal Input is 8 switches -> 28= 256  Three segments neededBinary to BCD Easy to change from four-bit binary to BCD Anything above 9 is added to the next positionDecimal Digit Binary Representation0 00001 00012 00103 00114 01005 0101601107 01118 10009 1001Conversion options Given 4-bit number : 1100¾ Equivalent to decimal 12 Options: ¾ Subtract 10 from number to get 2 Then add one to the ten digit¾ Add 6, then check the remainderOriginal number: 1100 12Add 6 0110 6Final number 0001 0010 12BCD Multiplication If we want to multiply by 2, we can keep the number in BCD by thinking ahead If starting number is 5 or larger, then we will end up with a number that must be converted¾ 4 * 2 = 8 (1 BCD character)¾ 5 * 2 = 10 (2 BCD characters)¾ 6 * 2 = 12 (2 BCD characters) Add 3 if number is >4, then shift left for the multiply Like adding 6, but with no carryOriginal number 0111 7Add 3 1010 10Shift left 0001 0100 14Why Use a Comparator?  Use a recursive program to compute numbers without a comparator For every bit, we will check & shift once¾ 4-bit number require 4 shifts¾ 4 shifts mean our final answer is “multiplied” by 16¾ Use 4 bits to the left to “divide” by 16¾ Ones must be checked for >4 Add 3 if so Called “Shift-Add-3” formula Doesn’t necessarily need to be recursive…Shift-Add-3  Note for the largest 4-bit number, only one Add-3 is ever needed Can shorten procedure by doing a 3-bit shift to startOperation Tens Ones BinaryStart0000 00001111Shift (1)00000001 1110Shift (2)00000011 1100Shift (3)00000111 1000Add-300001010 1000Shift (4) 0001 01010000Decimal 15No Adders! Always adding by a constant (3) Instead of using an Adder, we can use a look-up table Only 4-bits input and output (since our value will always be in BCD) Verilog will want to make an adder out of S <= A + 3;A3 A2 A1 A0 S3 S2 S1 S00000 00000001 00010010 00100011 00110100 01000101 10000110 10010111 10101000 10111001 11001010 XXXX1011 XXXX1100 XXXX1101 XXXX1110 XXXX1111 XXXXNo Shifters! Use multiply-by-2 trick Instead of shifting, we can just connect our output one place to the left B = A * 2A3A2A1A0B4B3B2B1B0‘0’No Recursion A3A2A1A0S3S2S1S0Add-3Onesbcd(0)bcd(1)bcd(2)bcd(3)bcd(4)bcd(5)bcd(6)bcd(7)Tensbin(0)bin(1)bin(2)bin(3)‘0’‘0’‘0’‘0’Full 8-bit conversionA3A2A1A0S3S2S1S0Add-3A3A2A1A0S3S2S1S0Add-3Onesbcd(0)bcd(1)bcd(2)bcd(3)bcd(4)bcd(5)bcd(6)bcd(7)bcd(8)TensA3A2A1A0S3S2S1S0Add-3A3A2A1A0S3S2S1S0Add-3 bcd(9)bcd(10)bcd(11)HundredsA3A2A1A0S3S2S1S0Add-3A3A2A1A0S3S2S1S0Add-3A3A2A1A0S3S2S1S0Add-3bin(0)bin(1)bin(2)bin(3)bin(4)bin(5)bin(6)bin(7)‘0’‘0’‘0’‘0’Lab Assignment First task is to build the Add-3 circuit¾ All combinational¾ Just implement truth table¾ Four equations: S3, S2, S1, S0 Put the Add-3 module in the top-level schematic¾ Use previous circuit diagram For B grade: use all schematic For A grade: use Verilog for Add-3 circuit Use simulator to check Add-3


View Full Document

MSU ECE 4743 - Computer Aided Digital System

Download Computer Aided Digital System
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Computer Aided Digital System and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Computer Aided Digital System 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?