Prof. Sin-Min Lee Department of Computer Science

Slides:



Advertisements
Similar presentations
Part 4: combinational devices
Advertisements

Modular Combinational Logic
Combinational Circuits
Functions and Functional Blocks
Combinational Circuits. Analysis Diagram Designing Combinational Circuits In general we have to do following steps: 1. Problem description 2. Input/output.
التصميم المنطقي Second Course
Computer Arithmetic, Multiplexers Prof. Sin-Min Lee Department of Computer Science.
Design of Arithmetic Circuits – Adders, Subtractors, BCD adders
Cache Memory Midterm 2 Revision 2 Prof. Sin-Min Lee Department of Computer Science.
EE2174: Digital Logic and Lab
Lecture 3. Boolean Algebra, Logic Gates
Part 2: DESIGN CIRCUIT. LOGIC CIRCUIT DESIGN x y z F F = x + y’z x y z F Truth Table Boolean Function.
CS 105 Digital Logic Design
Chapter 3 Data Representation part2 Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2010.
Dr. Bernard Chen Ph.D. University of Central Arkansas
Chapter3 Fixed Point Representation Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
Sahar Mosleh PageCalifornia State University San Marcos 1 Multiplexer, Decoder and Circuit Designing.
Dr. Ahmed El-Bialy, Dr. Sahar Fawzy Combinational Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Logic Circuits I.
Chapter 6-1 ALU, Adder and Subtractor
1 © 2015 B. Wilkinson Modification date: January 1, 2015 Designing combinational circuits Logic circuits whose outputs are dependent upon the values placed.
Digital Logic Problems (II) Prof. Sin-Min Lee Department of Mathematics and Computer Science.
Combinational Design, Part 3: Functional Blocks
CSE221- Logic Design, Spring 2003
Hamming Code,Decoders and D,T-flip flops Prof. Sin-Min Lee Department of Computer Science.
1 Chapter 4 Combinational Logic Logic circuits for digital systems may be combinational or sequential. A combinational circuit consists of input variables,
1 Fundamentals of Computer Science Combinational Circuits.
Mid3 Revision 3 Prof. Sin-Min Lee Department of Computer Science.
Exam1 Review Dr. Bernard Chen Ph.D. University of Central Arkansas.
LECTURE 4 Logic Design. LOGIC DESIGN We already know that the language of the machine is binary – that is, sequences of 1’s and 0’s. But why is this?
ECE DIGITAL LOGIC LECTURE 15: COMBINATIONAL CIRCUITS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 10/20/2015.
Simple ALU  Half adder  Full adder  Constructing 4 bits adder  ALU does several operations  General ALU structure  Timing diagram of adder  Overflow.
Logic Design (CE1111 ) Lecture 4 (Chapter 4) Combinational Logic Prepared by Dr. Lamiaa Elshenawy 1.
Materials on the Exam Introduction Data Representation in Computer Systems Boolean Algebra Digital Logic MARIE: An Introduction to a Simple Computer Until.
Gunjeet Kaur Dronacharya Group of Institutions. Binary Adder-Subtractor A combinational circuit that performs the addition of two bits is called a half.
Lecture 4: Digital Systems & Binary Numbers (4)
Unit 1 Introduction Number Systems and Conversion.
Invitation to Computer Science, C++ Version, Fourth Edition
Chap 3. Combinational Logic Design
Combinational Circuits
Chapter 4 Operations on Bits.
Prof. Sin-Min Lee Department of Computer Science
Chap 7. Register Transfers and Datapaths
SLIDES FOR CHAPTER 12 REGISTERS AND COUNTERS
Combinational Functions and Circuits
Digital Systems Section 8 Multiplexers. Digital Systems Section 8 Multiplexers.
Lecture 4: Combinational Functions and Circuits
Computer Architecture CST 250
Basics of Digital Logic Design Presentation D
Digital Systems Section 14 Registers. Digital Systems Section 14 Registers.
Invitation to Computer Science, Java Version, Third Edition
FUNCTION OF COMBINATIONAL LOGIC CIRCUIT
MIPS ALU.
Registers and Counters Register : A Group of Flip-Flops. N-Bit Register has N flip-flops. Each flip-flop stores 1-Bit Information. So N-Bit Register Stores.
Digital Design Fundamentals
Chapter 4 Combinational Logic
Digital Electronics & Logic Design
King Fahd University of Petroleum and Minerals
EE207: Digital Systems I, Semester I 2003/2004
Lecture 11: Hardware for Arithmetic
Digital Systems Section 12 Binary Adders. Digital Systems Section 12 Binary Adders.
Overview Part 1 – Design Procedure Part 2 – Combinational Logic
COMS 361 Computer Organization
Combinational Circuits
Chapter-4 Combinational Logic
Copyright © Cengage Learning. All rights reserved.
ECE 331 – Digital System Design
Chapter3 Fixed Point Representation
靜夜思 床前明月光, 疑是地上霜。 舉頭望明月, 低頭思故鄉。 ~ 李白 李商隱.
Chapter5: Synchronous Sequential Logic – Part 3
Presentation transcript:

Prof. Sin-Min Lee Department of Computer Science Lecture 14 Midterm 2 Revision 2 Prof. Sin-Min Lee Department of Computer Science

Subtract by Summation Subtraction with complement is done with binary numbers in a similar way. Using two binary numbers X=1010100 and Y=1000011 We perform X-Y and Y-X

X-Y X= 1010100 2’s com. of Y= 0111101 Sum= 10010001 Answer= 0010001

Y-X Y= 1000011 2’s com. of X= 0101100 Sum= 1101111 There’s no end carry: answer is negative --- 0010001 (2’s complement of 1101111)

How To Represent Signed Numbers Plus and minus signs used for decimal numbers: 25 (or +25), -16, etc. For computers, it is desirable to represent everything as bits. Three types of signed binary number representations: signed magnitude, 1’s complement, and 2’s complement

1. signed magnitude In each case: left-most bit indicates sign: positive (0) or negative (1). Consider 1. signed magnitude: 000011002 = 1210 Sign bit Magnitude 100011002 = -1210 Sign bit Magnitude

2. One’s Complement Representation The one’s complement of a binary number involves inverting all bits. To find negative of 1’s complement number take the 1’s complement of whole number including the sign bit. 000011002 = 1210 Sign bit Magnitude 111100112 = -1210 Sign bit 1’complement

3. Two’s Complement Representation The two’s complement of a binary number involves inverting all bits and adding 1. To find the negative of a signed number take the 2’s the 2’s complement of the positive number including the sign bit. 000011002 = 1210 Sign bit Magnitude 111101002 = -1210 Sign bit 2’s complement

Sign addition in 2’s complement The rule for addition is add the two numbers, including their sign bits, and discard any carry out of the sign (leftmost) bit position. Numerical examples for addition are shown below. Example: + 6 00000110 - 6 11111010 +13 00001101 +13 00001101 +19 00010011 +7 00000111 +6 00000110 -6 11111010 -13 11110011 -13 11110011 -7 11111001 -19 11101101 In each of the four cases, the operation performed is always addition, including the sign bits. Only one rule for addition, no separate treatment of subtraction. Negative numbers are always represented in 2’s complement. 9 9

Arithmetic Subtraction A subtraction operation can be changed to an addition operation if the sign of the subtrahend is changed. (±A) - (+B) = (±A) + (-B) (±A) - (-B) = (±A) + (+B)

Arithmetic Subtraction Consider the subtraction of (-6) - (-13) = +7. In binary with eight bits this is written as 11111010 - 11110011. The subtraction is changed to addition by taking the 2’s complement of the subtrahend (-13) to give (+13). In binary this is 11111010 + 00001101 = 100000111. Removing the end carry, we obtain the correct answer 00000111 (+ 7).

Overflow The detection of an overflow after the addition of two binary numbers depends on whether the considered numbers are signed or unsigned. When two unsigned numbers are added, an overflow is detected from the end carry out of the most significant position. In the case of signed numbers, the leftmost bit always represents the sign, and negative numbers are in 2’s complement form. When two signed numbers are added, the sign bit is treated as part of the number and the end carry does not indicate an overflow.

Overflow Overflow example: +70 0 1000110 -70 1 0111010 +70 0 1000110 -70 1 0111010 +80 0 1010000 -80 1 0110000 = +150 1 0010110 =-150 0 1101010

Overflow An overflow cannot occur after an addition if one number is positive and the other is negative, since adding a positive number to a negative number produces a result that is smaller than the larger of the two original numbers. An overflow may occur if the two numbers added are both either positive or negative.

Some commonly used components Decoders: n inputs, 2n outputs. the inputs are used to select which output is turned on. At any time exactly one output is on. Multiplexors: 2n inputs, n selection bits, 1 output. the selection bits determine which input will become the output. Adder: 2n inputs, 2n outputs. Computer Arithmetic.

Multiplexer “Selects” binary information from one of many input lines and directs it to a single output line. Also known as the “selector” circuit, Selection is controlled by a particular set of inputs lines whose # depends on the # of the data input lines. For a 2n-to-1 multiplexer, there are 2n data input lines and n selection lines whose bit combination determines which input is selected.

MUX Enable 2n Data Inputs Data Output n Input Select

(Only one O/P asserted at any time Remember the 2 – 4 Decoder? Sel(3) S1 Sel(2) Sel(1) S0 Sel(0) Mutually Exclusive (Only one O/P asserted at any time

4 to 1 MUX DataFlow Control D3:D0 Dout 4 4 2 - 4 Decoder Sel(3:0) 2 S1:S0

4-to-1 MUX (Gate level) Control Section Three of these signal inputs will always be 0. The other will depend on the data value selected

Multiplexer (cont.) Until now, we have examined single-bit data selected by a MUX. What if we want to select m-bit data/words?  Combine MUX blocks in parallel with common select and enable signals Example: Construct a logic circuit that selects between 2 sets of 4-bit inputs (see next slide for solution).

Example: Quad 2-to-1 MUX Uses four 4-to-1 MUXs with common select (S) and enable (E). Select line chooses between Ai’s and Bi’s. The selected four-wire digital signal is sent to the Yi’s Enable line turns MUX on and off (E=1 is on).

Implementing Boolean functions with Multiplexers Any Boolean function of n variables can be implemented using a 2n-1-to-1 multiplexer. A MUX is basically a decoder with outputs ORed together, hence this isn’t surprising. The SELECT signals generate the minterms of the function. The data inputs identify which minterms are to be combined with an OR.

Example F(X,Y,Z) = X’Y’Z + X’YZ’ + XYZ’ + XYZ = Σm(1,2,6,7) There are n=3 inputs, thus we need a 22-to-1 MUX The first n-1 (=2) inputs serve as the selection lines

Efficient Method for implementing Boolean functions For an n-variable function (e.g., f(A,B,C,D)): Need a 2n-1 line MUX with n-1 select lines. Enumerate function as a truth table with consistent ordering of variables (e.g., A,B,C,D) Attach the most significant n-1 variables to the n-1 select lines (e.g., A,B,C) Examine pairs of adjacent rows (only the least significant variable differs, e.g., D=0 and D=1). Determine whether the function output for the (A,B,C,0) and (A,B,C,1) combination is (0,0), (0,1), (1,0), or (1,1). Attach 0, D, D’, or 1 to the data input corresponding to (A,B,C) respectively.

Another Example Consider F(A,B,C) = m(1,3,5,6). We can implement this function using a 4-to-1 MUX as follows. The index is ABC. Apply A and B to the S1 and S0 selection inputs of the MUX (A is most sig, S1 is most sig.) Enumerate function in a truth table.

MUX Example (cont.) When A=B=0, F=C When A=0, B=1, F=C 1 When A=B=0, F=C When A=0, B=1, F=C When A=1, B=0, F=C When A=B=1, F=C’

MUX implementation of F(A,B,C) = m(1,3,5,6)

These pictures have errors.

1 input Decoder Decoder O0 I O1 Treat I as a 1 bit integer i. The ith output will be turned on (Oi=1), the other one off.

1 input Decoder O0 I O1

2 input Decoder Decoder O0 I0 O1 O2 I1 O3 Treat I0I1 as a 2 bit integer i. The ith output will be turned on (Oi=1), all the others off.

2 input Decoder I0 I1 O0 = !I0 && !I1 O1 = !I0 && I1 O2 = I0 && !I1

3 Input Decoder Decoder O0 I0 O1 O2 I1 O3 O4 I2 O5 O6 O7

3-Decoder Partial Implementation . . .

2 Input Multiplexor Inputs: I0 and I1 Selector: S Output: O Mux If S is a 0: O=I0 If S is a 1: O=I1 Mux I0 O I1 S

2-Mux Logic Design S I0 I1 I0 && !S O I1 && S

4 Input Multiplexor Inputs: I0 I1 I2 I3 Selectors: S0 S1 Output: O Mux I0 1 I1 I2 I3 I3 S0 S1

One Possible 4-Mux 2-Decoder S0 I0 S1 I1 O I2 I3

Adder We want to build a box that can add two 32 bit numbers. Assume 2s complement representation We can start by building a 1 bit adder.

Addition We need to build a 1 bit adder compute binary addition of 2 bits. We already know that the result is 2 bits. A B O0 O1 1 This is addition! A + B O0 O1

One Implementation A A && B O0 B !A (!A && B) || (A && !B) B O1 A !B

Binary addition and our adder 1 1 Carry 01001 + 01101 10110 What we really want is something that can be used to implement the binary addition algorithm. O0 is the carry O1 is the sum

What about the second column? 1 1 Carry 01001 + 01101 10110 We are adding 3 bits new bit is the carry from the first column. The output is still 2 bits, a sum and a carry

Truth Table for Addition Carry In Out Sum 1

Synchronous Sequential Circuit with T Flip-Flop -- Figure 8.12

Timing Diagram Figure 8.13

State Table and State Diagram

K-Maps for Example

Example 2.Synchronous Sequential Circuit with JK Flip-flops

Timing Diagram and State Table for Example 2

K-Maps for Example 2

Generating the State Table From K-maps -- Example 2

Example 3.Synchronous Sequential Circuit Synthesis

Introductory Synthesis Example -- Example 3

Flip-flop Input Tables -- Example 3

Generating the JK Flip-flop Excitation Maps -- Example 3

Clocked JK Flip-Flop Implementation -- Example 3

Application Equation Method for Deriving Excitation Equations -- Example 3

Registers Two independent flip-flops with clear and preset