CE212 Chapter1
CE212 Chapter1
CE 212
Salah Safi
Winter 2024-2025
German Jordanian University
COURSE STRUCTURE:
• Lectures
• Text books:
• Grading:
■ Midterm 30%
■ Final 40%
COURSE CONTENT
● Gate‐Level Minimization
● Combinational Logic
● Email: Salahaldeen.Safi@gju.edu.jo
Digital Systems
CE 212 Chapter 1
Salah Safi
Winter 2024-2025
German Jordanian University
Chapter 1: Digital
Systems and Binary
Numbers
1.1 DIGITAL SYSTEMS
● Digital systems have such a prominent role in everyday life that we refer to the present
technological period as the digital age.
● Digital systems are used in communication, business transactions, traffic control, spacecraft
guidance, medical treatment, weather monitoring, the Internet, and many other commercial,
industrial, and scientific enterprises.
● One characteristic of digital systems is their ability to represent and manipulate discrete
elements of information.
● Any set that is restricted to a finite number of elements contains discrete information.
■ The 10 decimal digits.
■ The 26 letters of the alphabet
● Early digital computers were used for numeric computations. In this case, the discrete
elements were the digits. From this application, the term digital computer emerged.
Digital Systems
● Discrete elements of information are represented in a digital system by physical quantities
called signals.
● Electrical signals such as voltages and currents are the most common.
● Electronic devices called transistors predominate in the circuitry that implements these
signals.
● The signals in most present‐day electronic digital systems use just two discrete values and are
therefore said to be binary.
● A binary digit, called a bit, has two values: 0 and 1. Discrete elements of information are
represented with groups of bits called binary codes.
● The decimal digits 0 through 9 are represented in a digital system with a code of four bits (e.g.,
the number 7 is represented by 0111).
Digital Systems
● The general‐purpose digital computer is the best‐known example of a digital system.
● (7,392)10 =
● The decimal number system is said to be of base, or radix, 10 because it uses 10 digits and the
coefficients are multiplied by powers of 10.
● Binary system:
● The binary system is a different number system. The coefficients of the binary number system
have only two possible values: 0 and 1.
● For example:
■ (11010)2 = = (26)10
Numbering Systems
● There are many different number systems. In general, a number expressed in a base‐r (or radix)
system has coefficients multiplied by powers of r:
● Example:
● If the number includes a radix point, it is necessary to separate the number into an integer part
and a fraction part, since each part must be converted differently.
● The conversion of a decimal integer to a number in base r is done by dividing the number and all
successive quotients by r and accumulating the remainders. This procedure is best illustrated
by example.
Number-Base Conversion
Number-Base Conversion
Number-Base Conversion
Number-Base Conversion
● The conversion of a decimal fraction to binary is accomplished by a method similar to that used
for integers.
■ However, multiplication is used instead of division,
■ and integers instead of remainders are accumulated.
Number-Base Conversion
● To convert a decimal fraction to a number expressed in base r, a similar procedure is used.
■ However, multiplication is by r instead of 2,
■ and the coefficients found from the integers may range in value from 0 to r - 1 instead of 0
and 1.
1.4 OCTAL AND HEXADECIMAL NUMBERS
● Since 23 = 8 : Each octal digit corresponds to three binary digits
● and 24 = 16 : Each hexadecimal digit corresponds to four binary digits.
OCTAL AND HEXADECIMAL NUMBERS
OCTAL AND HEXADECIMAL NUMBERS
Arithmetic operations
● Arithmetic operations with numbers in base r follow the same rules as for decimal numbers.
1.5 COMPLEMENTS OF NUMBERS
● Complements are used in digital computers to simplify the subtraction operation and for
logical manipulation.
● Simplifying operations leads to simpler, less expensive circuits to implement the operations.
● There are two types of complements for each base‐r system: the radix complement and the
diminished radix complement.
■ It follows that the 9’s complement of a decimal number is obtained by subtracting each
digit from 9. Here are some numerical examples:
Diminished Radix Complement
● For binary numbers, r = 2 and r - 1 = 1, So the 1’s complement of N is (2n - 1) - N.
■ Again, 2n is represented by a binary number that consists of a 1 followed by n 0’s.
■ 2n - 1 is a binary number represented by n 1’s.
■ For example, if n = 4, we have 24 = (10000)2 and 24 - 1 = (1111)2.
■ Thus, the 1’s complement of a binary number is obtained by subtracting each digit from 1
■ However, when subtracting binary digits from 1, we can have either 1 - 0 = 1 or 1 - 1 = 0,
which causes the bit to change from 0 to 1 or from 1 to 0, respectively.
■ Therefore, the 1’s complement of a binary number is formed by changing 1’s to 0’s and 0’s
to 1’s. The following are some numerical examples:
● The(r - 1)’s complement of octal or hexadecimal numbers is obtained by subtracting each digit
from 7 or F (decimal 15), respectively.
Radix Complement
● The r’s complement of an n‐digit number N in base r is defined as rn - N for N != 0 and as 0 for N
= 0.
● Comparing with the(r - 1)’s complement, we note that the r’s complement is obtained by adding 1
to the (r - 1)’s complement, since rn - N = [(rn - 1) - N] + 1.
● Thus,
■ The 2’s complement of binary 101100 is 010011 + 1 = 010100 and is obtained by adding 1 to
the 1’s‐complement value.
Radix Complement
● Since 10 is a number represented by a 1 followed by n 0’s, 10 n - N, which is the 10’s complement
of N, can be formed also by leaving all least significant 0’s unchanged, subtracting the first
nonzero least significant digit from 10, and subtracting all higher significant digits from 9. Thus:
● The 2’s complement can be formed by leaving all least significant 0’s and the first 1 unchanged
and replacing 1’s with 0’s and 0’s with 1’s in all other higher significant digits.
Subtraction with Complements
Subtraction with Complements
Subtraction with Complements
Subtraction with Complements
1.6 SIGNED BINARY NUMBERS
● It is customary to represent the sign with a bit placed in the leftmost position of the number.
● The convention is to make the sign bit 0 for positive and 1 for negative.
● Both signed and unsigned binary numbers consist of a string of bits when represented in a
computer.
■ If the binary number is signed, then the leftmost bit represents the sign and the rest of
the bits represent the number.
■ If the binary number is assumed to be unsigned, then the leftmost bit is the most
significant bit of the number.
SIGNED BINARY NUMBERS
● Examples:
■ unsigned binary: 0000 1001 → 9
■ unsigned binary: 1000 1001 → 137 (128 + 0 + 0 + 0 + 8 + 0 + 0 + 1)
■ signed binary: 0000 1001 → +9
■ signed binary: 1000 1001 → -9
● The representation of the signed numbers in the last example is referred to as the
signed‐magnitude convention.
● Since positive numbers always start with 0 (plus) in the leftmost position, the complement will
always start with a 1, indicating a negative number. The signed‐complement system can use
either the 1’s or the 2’s complement, but the 2’s complement is the most common.
● So, there are three different ways to represent -9 with eight bits:
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 of the larger magnitude.
● For example,(+25) + (-37) = -(37 - 25) = -12 is done by subtracting the smaller magnitude, 25,
from the larger magnitude, 37, and appending the sign of 37 to the result.
● This is a process that requires a comparison of the signs and magnitudes and then performing
either addition or subtraction.
● 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.
Arithmetic Subtraction
● Subtraction of two signed binary numbers when negative numbers are in 2’s‐complement form
is simple and can be stated as follows:
■ Take the 2’s complement of the subtrahend (including the sign bit) and add it to the
minuend (including the sign bit).
● To see this, consider the subtraction (-6) - (-13) = +7. In binary with eight bits, this operation is
written as (11111010 - 11110011) . The subtraction is changed to addition by taking the 2’s
complement of the subtrahend (-13), giving (+13). In binary, this is 11111010 + 00001101 =
100000111. Removing the end carry, we obtain the correct answer: 00000111 ( + 7) .
● It is worth noting that binary numbers in the signed‐complement system are added and
subtracted by the same basic addition and subtraction rules as unsigned numbers. Therefore,
computers need only one common hardware circuit to handle both types of arithmetic.
● This consideration has resulted in the signed‐complement system being used in virtually all
arithmetic units of computer systems. The user or programmer must interpret the results of
such addition or subtraction differently, depending on whether it is assumed that the numbers
are signed or unsigned.
1.7 BINARY CODES
● An n‐bit binary code is a group of n bits that assumes up to 2n distinct combinations of 1’s and
0’s, with each combination representing one element of the set that is being coded.
■ A set of four elements can be coded with two bits, with each element assigned one of the
following bit combinations: 00, 01, 10, 11.
■ A set of eight elements requires a three‐bit code and a set of 16 elements requires a
four‐bit code.
■ The bit combination of an n‐bit code is determined from the count in binary from
0 to 2n - 1. Each element must be assigned a unique binary bit combination, and no two
elements can have the same value; otherwise, the code assignment will be ambiguous.
● Although the minimum number of bits required to code 2n distinct quantities is n, there is no
maximum number of bits that may be used for a binary code. For example, the 10 decimal
digits can be coded with 10 bits, and each decimal digit can be assigned a bit combination of
nine 0’s and a 1. In this particular binary code, the digit 6 is assigned the bit combination
0001000000.
Binary-Coded Decimal Code
● Since the computer can accept only binary values, we must represent the decimal digits by
means of a code that contains 1’s and 0’s.
Binary-Coded Decimal Code
● Decimal 396 is represented in BCD with 12 bits as 0011 1001 0110
● The binary combinations 1010 through 1111 are not used and have no meaning in BCD.
● Examples:
■ Consider decimal 185 and its corresponding value in BCD and binary:
(185)10 = (0001 1000 0101)BCD = (10111001)2
● It is important to realize that BCD numbers are decimal numbers and not binary numbers,
although they use bits in their representation. The only difference between a decimal number
and BCD is that decimals are written with the symbols 0, 1, 2, … , 9 and BCD numbers use the
binary code 0000, 0001, 0010, … , 1001.
Other Decimal Codes
Gray Code
● The output data of many physical systems are quantities that are continuous.
● These data must be converted into digital form before they are applied to a digital system.
● It is sometimes convenient to use the Gray code shown in Table 1.6 to represent digital data
that have been converted from analog data.
● The advantage of the Gray code over the straight binary number sequence is that only one bit in
the code group changes in going from one number to the next.
Gray Code
Gray Code
● A typical application of the Gray code is the representation of analog data by a continuous
change in the angular position of a shaft. The shaft is partitioned into segments, and each
segment is assigned a number. If adjacent segments are made to correspond with the
Gray‐code sequence, ambiguity is eliminated between the angle of the shaft and the value
encoded by the sensor.
ASCII Character Code
● The standard binary code for the alphanumeric characters is the American Standard Code for
Information Interchange (ASCII),
● which uses seven bits to code 128 characters, as shown in Table 1.7. The seven bits of the code
are designated by b1 through b7, with b7 the most significant bit.
Error‐Detecting Code
● To detect errors in data communication and processing, an eighth bit is sometimes added to the
ASCII character to indicate its parity.
● A parity bit is an extra bit included with a message to make the total number of 1’s either even
or odd. Consider the following two characters and their even and odd parity:
● In each case, we insert an extra bit in the leftmost position of the code to produce an even
number of 1’s in the character for even parity or an odd number of 1’s in the character for odd
parity. In general, one or the other parity is adopted, with even parity being more common .
1.8 BINARY STORAGE AND REGISTERS
● A binary cell is a device that possesses two stable states and is capable of storing one bit (0 or
1) of information.
● A register with n cells can store any discrete quantity of information that contains n bits.
● The state of a register is an n‐tuple of 1’s and 0’s, with each bit designating the state of one cell
in the register.
● The content of a register is a function of the interpretation given to the information stored in it.
Consider, for example, a 16‐bit register with the following binary content:
11000011,11001001
■ Decimal unsigned: 50,121
■ For the ASCII code with an even parity: CI
■ …
BINARY STORAGE AND REGISTERS
● In digital systems, a 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.
● The transfer may be direct, from one register to another, or may pass through data‐processing
circuits to perform an operation.
BINARY STORAGE AND REGISTERS
1.9 BINARY LOGIC
● Binary logic deals with variables that take on two discrete values and with operations that
assume logical meaning.
● The two values the variables assume may be called by different names (true and false, yes and
no, etc.), but for our purpose, it is convenient to think in terms of bits and assign the values 1
and 0.
● 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.
● Electrical signals such as voltages or currents exist as analog signals having values over a
given continuous range, say, 0 to 3 V, but in a digital system these voltages are interpreted to
be either of two recognizable values, 0 or 1.
● Voltage‐operated logic circuits respond to two separate voltage levels that represent a binary
variable equal to logic 1 or logic 0. For example, a particular digital system may define logic 0 as
a signal equal to 0 V and logic 1 as a signal equal to 3 V.
● In practice, each voltage level has an acceptable range. The input terminals of digital circuits
accept binary signals within the allowable range and respond at the output terminals with
binary signals that fall within the specified range.
● The intermediate region between the allowed regions is crossed only during a state transition.
Logic Gates
Logic Gates
L
Logic Gates