Wchapter 1
Wchapter 1
Wchapter 1
… a5a4a3a2a1.a−1a−2a−3… aj
Decimal point Power
+ 105 a5 + 104 a4 + 103 a3 + 102 a2 + 101 a1 + 100 a0 + 10−1 a−1 + 10−2 a−2 + 10−3 a−3 +
Example:
(110101)2 = 32 + 16 + 4 + 1 = (53)10
Special Powers of 2
Example1.3
Convert (0.6875)10 to binary.
The process is continued until the fraction becomes 0 or until the number of digits has
sufficient accuracy.
Number-Base Conversions
Example1.3
(10 110 001 101 011 . 111 100 000 110) 2 = (26153.7406)8
2 6 1 5 3 7 4 0 6
Conversion from binary to hexadecimal is similar, except that the binary number is
divided into groups of four digits:
Example:
Example 1.6
Using 10's complement, subtract 3250 – 72532
Table 3 lists all possible four-bit signed binary numbers in the three representations.
Signed Binary Numbers
Signed Binary Numbers
■ Arithmetic Addition
The addition of two numbers in the signed-magnitude system follows the rules of
ordinary arithmetic. If the signs are the same, we add the two magnitudes and give
the sum the common sign. If the signs are different, we subtract the smaller
magnitude from the larger and give the difference the sign if the larger magnitude.
The addition of two signed binary numbers with negative numbers represented in
signed-2's-complement form is obtained from the addition of the two numbers,
including their sign bits.
A carry out of the sign-bit position is discarded.
Example:
Binary Codes
■ BCD Code A number with k decimal digits will
require 4k bits in BCD. Decimal 396
is represented in BCD with 12bits as
0011 1001 0110, with each group of
4 bits representing one decimal digit.
A decimal number in BCD is the
same as its equivalent binary
number only when the number is
between 0 and 9. A BCD number
greater than 10 looks different from
its equivalent binary number, even
though both contain 1's and 0's.
Moreover, the binary combinations
1010 through 1111 are not used and
have no meaning in BCD.
Signed Binary Numbers
■ Arithmetic Subtraction
In 2’s-complement form:
1. Take the 2’s complement of the subtrahend (including the sign bit) and add it to
the minuend (including sign bit).
2. A carry out of sign-bit position is discarded.
( A) − ( + B ) = ( A) + ( − B )
( A) − ( − B ) = ( A) + ( + B )
Example:
(11111010 + 00001101)
00000111 (+ 7)
Binary Codes
Example:
Consider decimal 185 and its corresponding value in BCD and binary:
■ BCD Addition
Binary Codes
Example:
Consider the addition of 184 + 576 = 760 in BCD:
■ Decimal Arithmetic
Binary Codes
■ Other Decimal Codes
Binary Codes
■ Gray Code
Binary Codes
■ ASCII Character Code
Binary Codes
■ ASCII Character Code
ASCII Character Codes
• American Standard Code for Information
Interchange (Refer to Table 1.7)
• A popular code used to represent information sent
as character-based data.
• It uses 7-bits to represent:
– 94 Graphic printing characters.
– 34 Non-printing characters
• Some non-printing characters are used for text
format (e.g. BS = Backspace, CR = carriage return)
• Other non-printing characters are used for record
marking and flow control (e.g. STX and ETX start
and end text areas).
ASCII Properties
• A binary cell
– two stable state
– store one bit of information
– examples: flip-flop circuits, ferrite cores, capacitor
• A register
– a group of binary cells
– AX in x86 CPU
• Register Transfer
– a transfer of the information stored in one register to another
– one of the major operations in digital system
– an example
Transfer of information
• The other major component of a digital system
– circuit elements to manipulate individual bits of information
Binary Logic
■ Definition of Binary Logic
Binary logic consists of binary variables and a set of logical operations. The variables
are designated by letters of the alphabet, such as A, B, C, x, y, z, etc, with each
variable having two and only two distinct possible values: 1 and 0, There are three
basic logical operations: AND, OR, and NOT.
Binary Logic
■ The truth tables for AND, OR, and NOT are given in Table 1.8.
Binary Logic
■ Logic gates
Example of binary signals
Binary Logic
■ Logic gates
Graphic Symbols and Input-Output Signals for Logic gates:
Fig. 1.5
Input-Output signals
for gates
Binary Logic
■ Logic gates
Graphic Symbols and Input-Output Signals for Logic gates:
OUTPUT INPUT
5.0
HIGH HIGH
4.0
3.0
Threshold
2.0 Region
1.0
LOW LOW
0.0
Volts
Signal Examples Over Time
Time
Continuous in
value & time
Analog
Digital Discrete in
value &
Asynchronous continuous in
time
Discrete in
Synchronous
value & time
A Digital Computer Example
Memory
Control
CPU unit Datapath
Inputs: Keyboard,
Outputs: CRT,
mouse, modem,
LCD, modem,
microphone Input/Output speakers
Synchronous or
Asynchronous?
Binary Codes for Decimal Digits
▪ There are over 8,000 ways that you can chose 10 elements from the
16 binary numbers of 4 bits. A few are useful:
• Information Types
– Numeric
» Must represent range of data needed
» Represent data such that simple, straightforward computation for
common arithmetic operations
» Tight relation to binary numbers
– Non-numeric
» Greater flexibility since arithmetic operations not applied.
» Not tied to binary numbers
Number of Elements Represented
G2
G1
111 G0
101 010 011
Carry in (Z) of 1: Z 1 1 1 1
X 0 0 1 1
+Y +0 +1 +0 +1
CS 01 10 10 11
Multiple Bit Binary Addition