2012年11月30日 星期五

BCD ADDER/SUBSTRATOR


Boolean Algebra: Chapter 6


源自於 http://lizarum.com/assignments/boolean_algebra/chapter6.html
Circuits 2011-2012
SACC

Boolean Algebra: Chapter 6

// INTRODUCTION



BCD binary numbers represent Decimal digits 0 to 9. A 4-bit BCD code is used to represent the ten numbers 0 to 9. Since the 4-bit Code allows 16 possibilities, the first 10 4-bit combinations are considered to be valid BCD combinations. The latter six combinations are invalid and do not occur.



You can produce a one-bit sum and one bit carry using 2 boolean functions:
Sum=AB +AB
Carry=AB
Together these functions produce a half-adder, which adds two bits together, but cannot add in a carry from a previous operation.

A full-adder adds 3 1-bit inputs (2-bits and a carry from a previous addition) and produces two outputs (sum and the carry):
Sum=(A BCin) +(ACin)+(AB Cin)+(ABCin)
Cout=(AB)+ACin)+BCin)


// LAB



  1. Design a circuit to add 2 2-bit numbers using a 7483 4-bit adder. Use 2 switches on the designer to input 1 value and 2 other switches to input the other value.

    • The 7483 adds 2 4-bit values. What must be done with the unused inputs?
    • What should be done with the carry input?
    • How many outputs from the adder must be connected to the LEDs to see all the possible outputs?



  2. Design a circuit to display the decimal equivalent of a 4-bit BCD value. Use a 7447 BCD, and a seven-segment common anode display.


  3. Design a circuit to subtract values. Take the number you want to subtract, invert it, add 1 to it, then add this value to the number you want to subtract from.


  4. For sums between 10 and 18, you must subtract 10 and produce a carry. Subtract 10 from 10102 and add 2s complement >01102

    For sums >9 you need to add 2's complement of 1010 to the uncorrected result(S3,S2,S1,S0).

    Correction is also needed when a carry out (C3 is generated (16,17,18)

    A decoder is needed to detect when carry out (Cn to the next stage is needed.

    K-Map for Cn
    S'1S;0
    S'3S;200011110
    000132
    014576
    11
    1089

    Cn=C'3+S'3S'2+S'3S'1

    To implement a 4-bit BDC adder you need 2 4-bit full adders. One to add 2 4-bit BCD numbers and the other full adder to add the 2's complement of 1010 to the result if Cn=1

    You also need 2 AND gates and one OR gate to generate Cn
    adders.png

  5. BDCD Subtraction

    Design a 9's Complement Generator for a BCD Digit 9's complement
    The 9's complement of a decimal number is found by subtracting each digit in the number from 9
    Decimal Digit9's complement
    09
    18
    27
    ||
    90

    the 9's complement of 28=99-28=71
    the 9's complement of 562=999-562=437

    Subtraction of a smaller decimal number from a larger one can be done by adding the 9's complement of the smaller number to the larger number and then adding the carry to the result (end around carry). When subtracting a larger number from a smaller one there is no carry and the result in the 9's complement form is negative:
    nines.png
    86-99=-13

    Rules
    • Add 9's complement of B to A
    • If result>9, correct by adding 0110
    • If most significant carry is produced (i.e.=1), then the result is positive and the end around carry must be added
    • If the most significant carry is 0 (no carry) then the result is negative and you get the 9's complement of the result

    rules.png
    rules2.png

    nines_compl.png
    But, unfortunately subtractors are not widely available. Fortunately, you can generate the 9's complement b adding 1010 to the inverted number:
    BCD DigitDIGITDIGIT+1010
    000011111001
    000111101000
    001011010111
    001111000110
    010010110101
    010110100100
    011010010011
    011110000010
    100001110001
    100101100000

    Ignore the carry out

    generator.png


Source: Passafine, John and Michael Douglas, Digital Logic Design

沒有留言:

張貼留言