Uploaded by 최은혁

ECE논리회로설계 2024 1 logic-unit01

advertisement
Logic Circuits Design (ECE2014)
Introduction
Number Systems and Conversion
전자컴퓨터공학부
이승찬
What is a Digital System?
▪ Data is represented by 0 and 1. (Need A/D, D/A converter)
▪ Switching circuits:
❖ Switching circuit has one or more inputs and one or more outputs which
take on discrete values. ➔ It is natural to use binary numbers :)
❖ In combinational circuits, output values of circuit only depend on the
present values of inputs, not past.
❖ In sequential circuits, output values of circuit depend on both past and
present input values. For this reason, sequential circuits are said to have
“memory”, because they must remember past sequence of inputs.
2
Contents: Overall Course
1. Introduction: Number Systems and Conversion
2. Boolean Algebra
3. Boolean Algebra (Continued)
4. Applications of Boolean Algebra Minterm and Maxterm
Expansions
5. Karnaugh Maps
6. Quine-McCluskey Method
7. Multi-Level Gate Circuits NAND and NOR Gates
8. Combinational Circuit Design and Simulation Using Gates
9. Multiplexers, Decoders, and Programmable Logic Devices
11. Latches and Flip-Flops
12. Registers and Counters
13. Analysis of Clocked Sequential Circuits
14. Derivation of State Graphs and Tables
15. Reduction of State Tables State Assignment
16. Sequential Circuit Design
3
Combinational
Logic
Sequential
Logic
Contents: Chapter 1
* Introduction
1.1 Digital Systems and Switching Circuits
1.2 Number Systems and Conversion
1.3 Binary Arithmetic
1.4 Representation of Negative Numbers
1.5 Binary Codes
4
Useful Digital System Example: Apple A17pro
https://twitter.com/Frederic_Orange/status/1711432628908253520
5
ENIAC and Integrated Circuits
▪ ENIAC(1946): Easily burnt Vaccum Tubes, High Power Consumption
▪ Integrated Circuit (IC) uses transistors (1948) instead of vaccum tubes
▪ First useful IC (1961) by Robert Noyce (Mayor of Silicon Valley)
The first electronic computer ENIAC (1946)
6
First Useful IC (1961) by Robert Noyce
Moore’s Law
▪ Cofounded Intel in 1968 with Robert
Noyce.
▪ Moore’s Law:
the number of transistors on a computer
chip doubles every year (observed in 1965)
▪ Since 1975, transistor counts have
doubled every two years.
Gordon Moore, 1929 ‐ 2023
7
Moore’s Law
https://assets.ourworldindata.org/uploads/2020/11/Transistor-Count-over-time.png
8
Why Digital?
▪ Digital vs. Analog Systems
▪In DIGITAL, current & voltage can assume only discrete values.
• Binary Digit ➔ Signal Processing as Bit unit
• Easy in realizing, processing using electrical switches, Switch On (1) Off (0)
• Small , Fast, and lighter due to Integrated Circuit Technology
• MOST importantly, Robust against Noises
▪In ANALOG, current & voltage levels are continuous & may
assume any value.
• Natural Phenomena (Pressure, Temperature, Speed…)
• Difficulty in realizing, processing using electronics
9
Digital vs. Analog Waveforms
Digital:
only assumes discrete values
Analog:
values vary over a broad range
continuously
10
Digital System Design
1. System Design:
▪Dividing overall system into subsystems
Ex) Computer
2. Logic Design:
▪Interconnected basic logic building blocks
of subsystems to perform a specific
function.
Ex) gates, flip flop required for binary
ADDER in processor
3. Circuit Design:
▪Specify the interconnection of specific
components to make logic building blocks
Ex) Resistors, transistors, capacitors
11
Spectrum of Digital Hardware
This course
We will study how logic gates or switching networks operate,
and are interconnected to perform specific digital function!
12
Binary Digit?
Binary
• Two values (0, 1)
• Each digit is called as a “bit” (Binary + Digit)
Good things in Binary Number
• Number representation with only two values (0,1)
• Can be implemented with simple electronics devices
(ex: Voltage High(1), Low(0) ; Switch On (1) Off(0)…)
Some binary numbers consisting of a specific
number of bits have special names
• Four-bit binary numbers are called nibbles (or nybble).
• Eight-bit binary numbers are called bytes.
• 16-bit binary numbers are called word.
13
1.2
Number Systems and Conversion
Decimal: 953.7810 = 9 × 102 + 5 × 101 + 3 × 100 + 7 × 10−1 + 8 × 10−2
Binary:
1011.112 = 1 × 23 + 0 × 22 + 1 × 21 + 1 × 20 + 1 × 2−1 + 1 × 2−2
1 1
3
= 8 + 0 + 2 + 1 + + = 11 = 11.7510
2 4
4
Radix(Base): 𝑁 = (𝑎4 𝑎3 𝑎2 𝑎1 𝑎0 . 𝑎−1 𝑎−2 𝑎−3 )𝑅
= 𝑎4 × 𝑅4 + 𝑎3 × 𝑅3 + 𝑎2 × 𝑅2 + 𝑎1 × 𝑅1 + 𝑎0 × 𝑅0
+ 𝑎−1 × 𝑅−1 + 𝑎−2 × 𝑅−2 + 𝑎−3 × 𝑅−3
Octal-Decimal:
Hexa-Decimal:
where 0≤ai≤ 𝑹 − 𝟏
147. 38 = 1 × 82 + 4 × 81 + 7 × 80 + 3 × 8−1 = 64 + 32 + 7 +
3
= 103.37510
8
𝐴2𝐹16 = 10 × 162 + 2 × 161 + 15 × 160 = 2560 + 32 + 15 = 260710
Note: when more than 10 symbols are needed to represent the digits, letters are used to represent digits
greater than 9.
14
Conversion of Decimal to Base-R
The base R equivalent of a decimal integer N
where 0≤ai≤ 𝐑 − 𝟏
N = (an an−1 ⋅⋅⋅ a2 a1 a0 )R = an Rn + an−1 Rn−1 +⋅⋅⋅ +a2 R2 + a1 R1 + a0 R0
Let’s divide N by R
N
a0
a0
n−1
n−2
1
= an R
+ an−1 R
+⋅⋅⋅ +a2 R + a1 + = Q1 + , remainder a0
R
R
R
Least significant bit
(LSB)
Then divide the quotient Q1 by R
Q1
a1
a1
n−2
n−3
1
= an R
+ an−1 R
+⋅⋅⋅ +a3 R + a2 + = Q 2 + , remainder a1
R
R
R
Again divide the quotient Q2 by R
Q2
a2
a2
n−3
n−4
= an R
+ an−1 R
+⋅⋅⋅ +a3 + = Q 3 + , remainder a2
R
R
R
This process is continued until we obtain an (zero quotient)
Note: LSB is obtained first.
15
Most significant bit
(MSB)
Conversion of Decimal to Base-R
Example: Decimal to Binary Conversion
2
53
16
Conversion of Decimal to Base-R
Example: Decimal to Binary Conversion
17
Conversion of a Decimal Fraction to Base-R
Suppose that we have a decimal fraction F that can be represented as.
𝐹 = (. 𝑎−1 𝑎−2 𝑎−3 ⋅⋅⋅ 𝑎−𝑚 )𝑅 = 𝑎−1 𝑅−1 + 𝑎−2 𝑅−2 + 𝑎−3 𝑅−3 +⋅⋅⋅ +𝑎−𝑚 𝑅−𝑚
𝐹𝑅 = 𝑎−1 + 𝑎−2 𝑅−1 + 𝑎−3 𝑅−2 +⋅⋅⋅ +𝑎−𝑚 𝑅−𝑚+1 = 𝑎−1 + 𝐹1
where F1: fractional part, a-1: integer part
𝐹1 𝑅 = 𝑎−2 + 𝑎−3 𝑅−1 +⋅⋅⋅ +𝑎−𝑚 𝑅−𝑚+2 = 𝑎−2 + 𝐹2
𝐹2 𝑅 = 𝑎−3 +⋅⋅⋅ +𝑎−𝑚 𝑅−𝑚+3 = 𝑎−3 + 𝐹3
This process is continued until we have zero fractional part.
Note: MSB is obtained first.
18
Conversion of a Decimal Fraction to Base-R
Example:
.62510 =?2
19
Conversion of a Decimal Fraction to Base-R
Example:
𝐹 = .625
×
2
1.250
(𝑎−1 = 1)
𝐹1 = .250
×
2
0.500
(𝑎−2 = 0)
𝐹2 = .500
×
2
1.000
(𝑎−3 = 1)
20
.62510
= .1012
Conversion of a Decimal Fraction to Base-R
Example: Convert 0.7 to binary
Be cautious!!!. The conversion process of a decimal fraction to base-R does not always terminate while
yielding a repeating fraction.
Example: Convert 231.34 to base-7
For conversion between two bases other than decimal, first convert
to decimal and then convert the decimal number to the new base.
Conversion of Binary to Hexadecimal
Partition the binary number into groups of four bits starting
from the binary point. And convert each group into its hex
equivalent.
Example: Convert 1001101.0101112 to base-16 (hexadecimal)
21
Conversion of a Decimal Fraction to Base-R
Conversion of Binary to Octal, Hexa-decimal
⚫ (101011010111)2
=(
)8, Octal
⚫ (1010111100100101)2
=(
)16, Hexadecimal
⚫ AC39D16 = (
)8, Octal
22
1.3
Binary Arithmetic
Binary arithmetic is performed much like decimal arithmetic except that the
largest binary digit is 1.
Four rules of adding binary digits
•
•
•
•
0+0=0
0+1=1
1+0=1
1 + 1 = 0 with a carry of 1 to the next column
Example:
23
1.3
Binary Arithmetic
Four rules of subtracting binary digits
•
•
•
•
0–0=0
0 – 1 = 1 with a borrow of 1 from the next column
1–0=1
1–1=0
Example:
24
1.3
Binary Arithmetic
Multiplication
•
•
•
•
0Х0=0
0Х1=0
1Х0=0
1Х1=1
Multiply: 13 x11(10)
1101
1011
1101
1101
0000
1101
10001111
= 14310
25
1.3
Binary Arithmetic
Division
: Similar to decimal division except that it is much easier because
the only two possible quotient digit, 0 and 1 are available.
The quotient is 1101 (=13) with a
remainder of 10 (2).
1. Since 10010 is larger than 1011, we put the first quotient
bit of 1 above 10010.
2. Bring down the next dividend bit, 0, to get 1110.
3. 1110 is larger than 1011, so the second quotient bit of 1is
placed next.
4. Subtract 1011 from 1110 to get 11.
5. Bring down the next dividend bit that results in 110.
6. Since 110 is smaller than 1011, the third quotient bit is 0.
7. Bring down the last dividend bit and subtract 1011 from
1101which leads to a final remainder of 10 and the last
quotient bit of 1.
26
1.4
Representation of Negative Numbers
In most computers, the first bit in a word is used as a sign bit to represent p
ositive and negative numbers.
bn – 1
b1
Magnitude
MSB
(a) Unsigned number
bn – 1
b0
bn – 2
b1
b0
Magnitude
Sign
0 denotes
+
1 denotes
–
MSB
(b) Signed number
Sign and Magnitude System
: For an n-bit word, the first bit is the sign and the
remaining n-1 bits represents the magnitude of the
number.
→ Thus, it can represent 2n-1 positive integers or
2n-1 negative integers.
27
❖ But, two representations for 0 exist
and very difficult in doing arithmetic.
1.4
Representation of Negative Numbers
The 2’s complement and 1’s complement system are commonly used
because arithmetic units are easy to design with these systems.
2’s complement of a positive integer N
: represented by a 0 followed by the magnitude as in the sign and
magnitude system. However, a negative number –N (=N*) is
represented by
𝑁 ∗ = 2𝑛 − 𝑁
Ex) for n=4, -N is represented by 24-N or 16-N.
-3 is represented by 16-3=13=11012.
28
1.4
Representation of Negative Numbers
1’s complement of a positive integer N
𝑁 = (2𝑛 − 1) − 𝑁
Always gives all 1’s
Example:
: defined as
Easy way to form the 1’s complement is to simply complement N bit-bybit by replacing 0’s with 1’s and 1’s with 0’s.
With n=6 and N=0101012 (=2110)
2𝑛 − 1 = 111111
𝑁 = 010101
𝑁 = 101010
Compare 2’s and 1’s complement system
𝑁 ∗ = 2𝑛 − 𝑁 = (2𝑛 − 1 − 𝑁) + 1 = 𝑁 + 1
==➔ 2’s complement: 1’s complement + ‘1’
To convert a negative number to 2’s complement form
Add leading zeros to make the number the appropriate length,
Then complement all the bits in the number, i.e., change the ones to zeros, and change the zeros to ones.
Add 1 to the complement.
29
1.4
Representation of Negative Numbers
Table 1-1: Signed Binary Integers (word length n = 4)
30
1.4
Representation of Negative Number
Addition of 2’s complement Numbers
✓ straightforward using the 2’s complement system.
✓ Ignore any carry from the sign position.
When n=4, -8≤ 𝐍 ≤7
Case 1
Case 2
Case 3
Case 4
✓ Be cautious of an overflow.
+3
+4
+7
0011
0100
0111
+5
+6
0101
0110
1011
+5
−6
−5
+6
0101
1010
1111
1011
0110
(1)0001
(correct answer)
wrong answer because of overflow
(+11 requires 5 bits including sign)
(correct answer)
correct answer when the carry from the sign bit
is ignored (this is not an overflow)
31
1.4
Representation of Negative Numbers
Addition of 2’s complement Numbers
Case 5
Case 6
−3
−4
−7
1101
1100
(1)1001
−5
−6
1011
1010
(1)0101
correct answer when the last carry is ignored
(this is not an overflow)
wrong answer because of overflow
(-11 requires 5 bits including sign)
Note: an overflow condition can be easily detected by looking at the sign bit!!!
i.e., An overflow occurs if adding two positive numbers give a negative answer or if
adding two negative numbers gives a positive answer.
Case 4:
-A + B (where B>A)
A* + B = (2n - A) +B = 2n + (B – A) > 2n
Last carry
Case 5:
-A - B (where A + B ≤2n-1)
A* + B * = (2n - A) + (2n – B) = 2n + 2n - (A + B) = (A + B)*
32
1.4
Representation of Negative Numbers
Addition of 1’s complement Numbers
When n=4, -7≤ 𝐍 ≤7
Case 3
Case 4
+5
0101
−6
1001
−1
1110
: similar to 2’s complement except that instead of
discarding the last carry, it is added to the n-bit sum in
the position furthest to the right, which is referred to
as an end-around carry.
(correct answer)
−5
1010
+6
0110
(1) 0000
1
0001
Case 5
−3
1100
−4
1011
(end-around carry)
(correct answer, no overflow)
(1) 0111
1
1000
(end-around carry)
(correct answer, no overflow)
33
1.4
Representation of Negative Numbers
Addition of 1’s complement Numbers
Case 6
−5
1010
−6
1001
(1) 0011
1
0100
Case 4 :
(end-around carry)
(wrong answer because of overflow)
− A + B (whereB  A)
A + B = (2n − 1 − A) + B = 2n + ( B − A) − 1 = ( B - A)
Case 5 :
− A − B ( A + B  2n −1 )
End-around carry
A + B = (2 n − 1 − A) + (2n − 1 − B) = 2 n + [2 n − 1 − ( A + B)] − 1
= ( A + B)
34
1.4
Representation of Negative Numbers
Addition of 1’s complement Numbers
• Add -11 and -20
Addition of 2’s complement Numbers
• Add -8 and 19
35
When n=8, -127 ≤ 𝑵 ≤ +127
When n=8, -128 ≤ 𝑵 ≤ +127
1.5
Binary Codes
Binary-Coded-Decimal (BCD):
➢
In general the input-output equipment uses decimal
numbers, so the decimal numbers should be coded
in terms of binary signals.
➢ Each decimal digit is replaced by its binary
equivalent.
➢ Ease of conversion between machine and humanreadable formats.
➢ More explicitly it is referred to as 8-4-2-1 BCD.
9 3 7 .2 5
1001 0011 0111 . 0010 0101
Note: There are many other possibilities to represent each
decimal number using a distinct combination of binary digits.
Decimal
Digit
0
8-4-2-1
6-3-1-1
Code
Code
(BCD)
0000
0000
Excess-3 2-out-of-5
Code
Code
8-4-2-1 and 6-3-1-1 code : weighed codes
𝑁 = 𝑤3 𝑎3 + 𝑤2 𝑎2 + 𝑤1 𝑎1 + 𝑤0 𝑎0
Gray
Code
𝑁 =6⋅1+3⋅0+1⋅1+1⋅1= 8
Thus, the binary code 1011 represents the decimal digit 8.
0011
00011
0000
1
0001
0001
0100
00101
0001
2
0010
0011
0101
00110
0011
3
0011
0100
0110
01001
0010
4
0100
0101
0111
01010
0110
5
0101
0111
1000
01100
1110
6
0110
1000
1001
10001
1010
7
0111
1001
1010
10010
1011
8
1000
1011
1011
10100
1001
9
1001
1100
1100
11000
1000
Excess-3 code : add 3 (0011) to 8-4-2-1
2-out-of-5 code: only 2 out the 5 bits are one for every valid
combination.
Gray code: Successive decimal digits differ in exactly one bit.
36
1.5
Binary Codes
❖ A binary code is a way of representing
text or computer processor instructions
by the use of the binary number
system's two-binary digits 0 and 1.
❖ One common alphanumeric code is the
ASCII code which is a 7-bit code.
❖ 27 (128) different code combinations are
available to represent letters, numbers
and other symbols.
Let’s represent the word
“DIGITAL” In ASCII code like below example
Table 1-3
ASCII (American Standard Code for Information
Interchange) code (incomplete)
37
Download