0% found this document useful (0 votes)
14 views55 pages

Digital Logic - Unit 1 Part2

Uploaded by

praveenadass02
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views55 pages

Digital Logic - Unit 1 Part2

Uploaded by

praveenadass02
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 55

SUMMARY

▪ DIGITAL COMPUTERS
▪ NUMBER SYSTEMS
▪ DECIMAL ,BINARY ,OCTAL,HEXADECIMAL
▪ MUTUAL CONVERSIONS
▪ WEIGHTED STRUCTURE OF BINARY SYSTEM
▪ COMPLEMENTS – 1’S AND 2’S ,9’S AND 10’S,7’s and 8’s,15’s and
16’s
▪ SIGNED NUMBERS
▪ ADDITION AND SUBTRACTION WITH SIGNED NUMBERS
TO BE DISCUSSED
▪ BCD NUMBERS
▪ BCD ADDITION
▪ BCD SUBTRACTION
▪ GRAY CODE
▪ BINARY TO GRAY CODE CONVERSION
▪ GRAY TO BINARY CODE CONVERSION
▪ WEIGHTED CODE – 8421
▪ NON-WEIGHTED CODE – ASCII AND EBCDIC
BCD NUMBERS
▪ Binary number system is the most natural system for a computer.

▪ People are accustomed to decimal system.

▪ Binary-coded Decimal or BCD is a way of representing a decimal


number as a string of bits suitable for use in electronic systems.

▪ Rather than converting the whole number into binary, BCD splits the
number up into its digits and converts each digit to 4-bit binary.
BCD NUMBERS
BCD NUMBERS
▪ EX:
▪ 3 4 5 - Decimal
▪ 0011 0100 0101 - BCD

NOTE:
▪ A number with k decimal digits will require 4k bits in BCD.
▪ Each group of 4 bits represents one decimal digit.

▪ (185)10 =
▪ (0001 1000 0101)BCD = (10111001)2
BCD NUMBERS
BCD NUMBERS
NOTE:
▪ BCD numbers are decimal numbers and not binary numbers, although they
use bits in their representation.
▪ the binary combinations 1010 through 1111 are not used and have no
meaning in BCD
▪ decimal number are written with the symbols 0, 1, 2, 3 …9 and BCD numbers
use the binary code 0000, 0001, 0010, …, 1001.

▪ Decimal 10 – Equivalent BCD – Equivalent Binary


▪ 0001 0000 1010
▪ Decimal 15 – Equivalent BCD – Equivalent Binary
▪ 0001 0101 1111
BCD ADDITION
▪ CASES FOR ADDITION
▪ CASE 1 :
If sum of two BCD number is equal to 9, correct BCD sum

▪ CASE 2:
If the sum of the addition is greater than 9, invalid BCD sum
BCD ADDITION
▪ SOLUTION FOR CASE 2:
▪ ADD 6 (0110) to the BCD sum

▪ Answer is carry 1 and 0010


▪ 12 -> 0001 0010
BCD ADDITION
▪ CASE 3:
 If the sum of the BCD is greater than or equal to 16 THEN
 Sum produces a carry & Binary sum requires correction
 Solution:
 add 6(0110) to the sum

▪ Answer : 0001 0111


BCD ADDITION
▪ Example:
BCD ADDITION
▪ For signed numbers:
▪ Consider the addition of (+375) + (-240) = +135

▪ Step 1 : take the first number(a)


▪ Step 2 : take the 10’s complement of second number (b)
▪ Step 3 : write the BCD equivalent of both (a) and (b)
▪ Step 4 : Don’t forget to add the sign four bits ( 0 for +ve and 9 for –ve)
▪ Step 5 :Do the addition in BCD
▪ Step 6 : add 6(0110) for all invalid BCD sum
BCD SUBTRACTION
▪ unsigned or in the signed

▪ Take the 10’s complement of the subtrahend(b) and add it to the


minuend(a).

▪ Check if the sum is valid BCD number

▪ If not add 0110(6) to the sum and add the carry if any to next digit

▪ Apply the rule of 10’s complement to give the final result.


BCD SUBTRACTION
▪ Ex : Find the solution for 68 - 61 (or) Subtract 61 from 68.
▪ Solution:
○ 10’s complement of subtrahend(b) ie. 61 = 99 - 61
____
38+
1
____
39
Add it to the minuend(a) ie 68
68 + 39 = 107 with 1 as carry
Answer in decimal form is +7.
BCD SUBTRACTION
NOTE:

CASE :1 In 10’s complement if the end around carry(EAC) is 1 then the


result is positive
● EAC(End around carry) should be discarded

CASE 2: if EAC is 0(no carry) then the result is negative.

● Check your answer by again taking 10’s complement.


BCD SUBTRACTION
BCD form → 68 +39
Carry 1111
0110 1000 → 68
0011 1001 → 39
_______________
1010 10001
0110 0110
_______________
EAC 1 0000 0111

Answer : 0000 0111


BCD SUBTRACTION
CASE 2: If end round carry is 0
Subtract 623.85 from 336.25

336.25 - FOR BCD take 10’s complement


623.85 999.99 -
_________ 623.85
- 287.60 ________
_______ 376.14 +
1
_________
376.15
BCD SUBTRACTION
336.25 +
377.14 → 10’s complement of 623.85
________________________________________________________

0011 0011 0110 . 0010 0101


0011 0111 0111 . 0001 0100
_____________________________
SUMMARY OF BCD
○ Use 4 bits to represent BCD numbers
○ 1010,1011,1100,1101,1110,1111 are invalid BCD numbers
○ During BCD addition if you find the above invalid numbers as sum or sum
with carry (like 10001 ,10100 ...) then add 0110(6) to the sum
○ For unsigned numbers don’t discard the end around carry(EAC)
○ For signed numbers and subtraction discard the end around carry(EAC)
○ Signed numbers can be changed to unsigned numbers by taking 10’s
complement of the second number
BINARY CODES
BINARY CODES
▪ BCD or 8421 code and 2421 code are called as weighted codes

▪ Each code has 6 invalid combinations and should be discarded

▪ 2421 and the excess‐3 codes are examples of self‐complementing codes

▪ Self complementing code : the 9’s complement of a decimal number is


obtained directly by changing 1’s to 0’s and 0’s to 1’s (i.e., by complementing
each bit in the pattern).
395 is represented in the excess‐3 code as 0110 1100 1000
9’s complement of 395 → 604 is represented as 1001 0011 0111
BINARY CODES
● excess‐3 code has been used in some older computers because of its
self‐ complementing property.

● Excess‐3 is an unweighted code in which each coded combination is


obtained from the corresponding binary value plus 3.

● the BCD code is not self‐complementing.


Gray Code
● Continuous or analog information is converted into digital form by
means of an analog‐to‐digital converter.
● Gray Code is useful to represent digital data that are converted from
analog data
● Main advantage over binary system is that
○ one bit in the code group changes in going from one number to
the next
● Going from 7 to 8
● In binary from 0111 to 1000 → all four bit changes
● In Gray code 0100 to 1100 → only one bit changes
Gray Code
● used in applications in which the normal sequence of binary numbers
generated by the hardware may produce an error or ambiguity during
the transition from one number to the next.

● Used to reduce the errors as only bit changes


Gray Code
Gray Code
● Conversion from Binary to Gray code

Rules :
■ MSB of Gray code is same as MSB of Binary
■ Coding from left to right
■ Add each adjacent pair of bits to get the next bit of Gray code
■ Omit the carry if it occurs
● Ex:
(1011)2 → (1110)G
(101101)2 → (111011)G
Gray Code
● Conversion from Gray to Binary code

Rules :
■ MSB of Gray code is same as MSB of Binary
■ Coding from left to right
■ Add the binary digit generated to the adjacent Gray bit to get
the next bit
■ Omit the carry if it occurs
● Ex:
(1110)G → (1011)2
(111011)G → (101101)2
Homework
● Try these
Write (25)10 in binary and Gray code
Write (37)10 in BCD and Excess 3 code
ASCII
● Its a non-weighted code

● Computers should handle characters,symbols,alphabets other than


numbers

● An alphanumeric character set is a set of elements that includes the


10 decimal digits, the 26 letters of the alphabet, and a number of
special characters.

● Set contains 36 to 64 elements - only capital letters


○ Binary code of six bits required
● Set contains 64 to 128 - both uppercase and lowercase
○ Binary code of seven bits required
ASCII
● ASCII - the American Standard Code for Information Interchange

● standard binary code for the alphanumeric characters -ASCII

● It uses 7 bits to represent 128 characters

● There are 34 control characters

● three types of control characters


○ format effector
○ information separators, and
○ communication‐control characters
ASCII
ASCII
ASCII
● Format effector
○ characters that control the layout of printing

○ include the familiar word processor and typewriter controls

○ backspace (BS)
○ horizontal tabulation (HT),
○ and carriage return (CR).
ASCII
● Information separators

○ used to separate the data into divisions such as paragraphs and


pages

○ include characters such as record separator (RS) and file


separator (FS)
ASCII
● communication‐control characters

○ useful during the transmission of text between remote devices


○ used to distinguish from other messages in the same
communication channel
○ STX (start of text) and ETX (end of text)
■ used to frame a text message transmitted through a
communication channel
ASCII
● NOTE:

○ ASCII is a seven‐bit code


○ most computers manipulate an eight‐bit quantity as a single unit
called a byte
○ ASCII characters most often are stored one per byte
○ extra bit used for other purposes, depending on the application.
Examples:
○ most significant bit set to 0 - For printer
○ most significant bit set to 1 - Greek alphabet or italic type font.
EBCDIC
● Its a non-weighted code
● Extended Binary Coded Decimal Interchange Code (EBCDIC)
● an 8-bit binary code for numeric and alphanumeric characters
● It was developed and used by IBM
EBCDIC
EBCDIC
BINARY STORAGE AND REGISTERS
○ In digital computers - need a physical existence for storing
individual bits
○ A binary cell is a device that possesses two stable states and is
capable of storing one bit (0 or 1) of information
○ input to the cell receives signals that set it to one of the two
states
○ output of the cell is a physical quantity that distinguishes
between the two states
○ Information is 0 - unstable state and 1 for stable state
REGISTERS
○ Registers -group of binary cells
○ A register with n cells contains n bits
○ a 16‐bit register has the binary content: 1100001111001001
○ the register can store any binary number from 0 to 216 - 1.
○ register stores alphanumeric characters of an eight ‐bit code -
Contents of register is meaningless in BCD(1100 invalid BCD)
REGISTERS
○ Conclusion
■ a register can store discrete elements of information
○ the same bit configuration may be interpreted differently for
different types of data depending on the application.
REGISTERS
Register Transfer
○ register transfer operation is a basic operation that consists of a
transfer of binary information from one set of registers into
another set of registers
○ transfer may be direct, from one register to another,
○ Or may pass through data‐processing circuits to perform an
operation
○ The device most commonly used for holding data is a
register
Transfer of information among registers
Example of binary information processing
BINARY LOGIC
○ Consists of binary variables and set of logical operations
○ Variables are A,B,C,x,y,z,etc.
○ Each variable have only two distinct values 0 or 1
○ Logical operations are the following three
○ AND,OR,NOT
○ Each operation produces a result z(binary result)
BINARY LOGIC
○ AND
○ operation is represented by a dot or by the absence of an
operator
○ x . y = z or xy = z
○ Read as x AND y is equal to z
○ z = 1 if and only if x=1 and y =1; otherwise 0
BINARY LOGIC
○ OR
○ operation is represented by a plus sign
○ x +y=z
○ Read as “x OR y is equal to z”
○ z = 1 if and only if x=1 or if y =1 or if both x=1 and y =1;
○ If x =0 and y =0 then z =0
BINARY LOGIC
○ NOT
○ operation is represented by a prime or overbar
○ x’ = z
○ Read as “not x is equal to z”
○ z = 1 if x= 0 ;z=0 if x =1;
○ NOT is also referred to as complement operation
NOTE:
binary logic should not be confused with binary arithmetic.
BINARY LOGIC
NOTE:
binary logic should not be confused with binary arithmetic.
Binary arithmetic
1 + 1 = 10
read “one plus one is equal to 2”
Binary logic
1+1=1
read “one OR one is equal to one”
BINARY LOGIC
A truth table is a table of all possible combinations of the variables,
showing the relation between the values that the variables may take
and the result of the operation.
Logic Gates
○ Logic gates are electronic circuits that operate on one or more
input signals to produce an output signal.
○ Any desired information for computing can be operated on by
passing binary signals through various combinations of logic
gates, with each signal representing a particular binary variable.
Logic Gates
Logic Gates
○ The gates are blocks of hardware that produce the equivalent of
logic‐1 or logic‐0 output signals if input logic requirements are
satisfied
Logic Gates
○ AND and OR gates may have more than two inputs

You might also like