CS/COE0447: Computer Organization and Assembly Language

Similar documents
CS/COE1541: Introduction to Computer Architecture. Logic Design Review. Sangyeun Cho. Computer Science Department University of Pittsburgh

CS/COE0447: Computer Organization

CS/COE0447: Computer Organization

Logic design? Transistor as a switch. Layered design approach. CS/COE1541: Introduction to Computer Architecture. Logic Design Review.

Digital Logic. CS211 Computer Architecture. l Topics. l Transistors (Design & Types) l Logic Gates. l Combinational Circuits.

Digital Logic (2) Boolean Algebra

EE40 Lec 15. Logic Synthesis and Sequential Logic Circuits

Boolean Algebra and Digital Logic 2009, University of Colombo School of Computing

Number System. Decimal to binary Binary to Decimal Binary to octal Binary to hexadecimal Hexadecimal to binary Octal to binary

Chapter 7 Logic Circuits

ECE/CS 250 Computer Architecture

EEE130 Digital Electronics I Lecture #4

ECE 250 / CPS 250 Computer Architecture. Basics of Logic Design Boolean Algebra, Logic Gates

Logic Design. Chapter 2: Introduction to Logic Circuits

EECS150 - Digital Design Lecture 19 - Combinational Logic Circuits : A Deep Dive

Lecture 22 Chapters 3 Logic Circuits Part 1

Why digital? Overview. Number Systems. Binary to Decimal conversion

ECE/CS 250: Computer Architecture. Basics of Logic Design: Boolean Algebra, Logic Gates. Benjamin Lee

CHAPTER1: Digital Logic Circuits Combination Circuits

Digital Logic Appendix A

COSC 243. Introduction to Logic And Combinatorial Logic. Lecture 4 - Introduction to Logic and Combinatorial Logic. COSC 243 (Computer Architecture)

Introduction to Karnaugh Maps

Combinational Logic. Review of Combinational Logic 1

CSC9R6 Computer Design. Practical Digital Logic

Fundamentals of Digital Design

ENG2410 Digital Design Combinational Logic Circuits

Boolean Algebra & Logic Gates. By : Ali Mustafa

EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits)

Number System conversions

Outline. EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits) Combinational Logic (CL) Defined

MC9211 Computer Organization

Boolean Algebra. Digital Logic Appendix A. Postulates, Identities in Boolean Algebra How can I manipulate expressions?

UNIVERSITI TENAGA NASIONAL. College of Information Technology

4 Switching Algebra 4.1 Axioms; Signals and Switching Algebra

XI STANDARD [ COMPUTER SCIENCE ] 5 MARKS STUDY MATERIAL.

Review for Test 1 : Ch1 5

ENGG 1203 Tutorial - 2 Recall Lab 2 - e.g. 4 input XOR. Parity checking (for interest) Recall : Simplification methods. Recall : Time Delay

Chapter 2 Combinational logic

Boolean algebra. Examples of these individual laws of Boolean, rules and theorems for Boolean algebra are given in the following table.

Hakim Weatherspoon CS 3410 Computer Science Cornell University

CS 226: Digital Logic Design

Switches: basic element of physical implementations

Week-I. Combinational Logic & Circuits

Philadelphia University Student Name: Student Number:

COS 140: Foundations of Computer Science

Propositional Logic. Logical Expressions. Logic Minimization. CNF and DNF. Algebraic Laws for Logical Expressions CSC 173

S C F F F T T F T T S C B F F F F F T F T F F T T T F F T F T T T F T T T

Gates and Logic: From switches to Transistors, Logic Gates and Logic Circuits

211: Computer Architecture Summer 2016

Ch 2. Combinational Logic. II - Combinational Logic Contemporary Logic Design 1

Possible logic functions of two variables

Logic Simplification. Boolean Simplification Example. Applying Boolean Identities F = A B C + A B C + A BC + ABC. Karnaugh Maps 2/10/2009 COMP370 1

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3

Sample Test Paper - I

Logic and Boolean algebra

Systems I: Computer Organization and Architecture

UNIT 4 MINTERM AND MAXTERM EXPANSIONS

BOOLEAN ALGEBRA. Introduction. 1854: Logical algebra was published by George Boole known today as Boolean Algebra

Chap 2. Combinational Logic Circuits

Combinational Logic. By : Ali Mustafa

Slide Set 3. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

ECE 545 Digital System Design with VHDL Lecture 1. Digital Logic Refresher Part A Combinational Logic Building Blocks

Prove that if not fat and not triangle necessarily means not green then green must be fat or triangle (or both).

Simplifying Logic Circuits with Karnaugh Maps

2. Associative Law: A binary operator * on a set S is said to be associated whenever (A*B)*C = A*(B*C) for all A,B,C S.

Boolean Algebra and logic gates

Review. EECS Components and Design Techniques for Digital Systems. Lec 06 Minimizing Boolean Logic 9/ Review: Canonical Forms

ELCT201: DIGITAL LOGIC DESIGN

Floating Point Representation and Digital Logic. Lecture 11 CS301

Logic Gate Level. Part 2


Contents. Chapter 3 Combinational Circuits Page 1 of 36

Boolean Algebra. Digital Logic Appendix A. Boolean Algebra Other operations. Boolean Algebra. Postulates, Identities in Boolean Algebra

Boolean Algebra, Gates and Circuits

T02 Tutorial Slides for Week 6

Combinational logic. Possible logic functions of two variables. Minimal set of functions. Cost of different logic functions.

Chapter 4. Combinational: Circuits with logic gates whose outputs depend on the present combination of the inputs. elements. Dr.

EECS Variable Logic Functions

Lecture 2 Review on Digital Logic (Part 1)

Combinatorial Logic Design Principles

Chapter 2: Switching Algebra and Logic Circuits

Unit 8A Computer Organization. Boolean Logic and Gates

10/14/2009. Reading: Hambley Chapters

Principles of Computer Architecture. Appendix B: Reduction of Digital Logic. Chapter Contents

CS61c: Representations of Combinational Logic Circuits

Appendix B. Review of Digital Logic. Baback Izadi Division of Engineering Programs

Binary Logic and Gates. Our objective is to learn how to design digital circuits.

Vidyalankar S.E. Sem. III [CMPN] Digital Logic Design and Analysis Prelim Question Paper Solution

Chapter 2 Combinational Logic Circuits

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Digital Logic

II. COMBINATIONAL LOGIC DESIGN. - algebra defined on a set of 2 elements, {0, 1}, with binary operators multiply (AND), add (OR), and invert (NOT):

Every time has a value associated with it, not just some times. A variable can take on any value within a range

Ex: Boolean expression for majority function F = A'BC + AB'C + ABC ' + ABC.

This form sometimes used in logic circuit, example:

Numbers & Arithmetic. Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University. See: P&H Chapter , 3.2, C.5 C.

UC Berkeley College of Engineering, EECS Department CS61C: Representations of Combinational Logic Circuits

Unit 2 Session - 6 Combinational Logic Circuits

COMP2611: Computer Organization. Introduction to Digital Logic

Digital Techniques. Figure 1: Block diagram of digital computer. Processor or Arithmetic logic unit ALU. Control Unit. Storage or memory unit

Review Getting the truth table

Transcription:

CS/COE0447: Computer Organization and Assembly Language Logic Design Introduction (Brief?) Appendix B: The Basics of Logic Design Dept. of Computer Science

Logic design? Digital hardware is implemented by way of logic design Digital circuits process and produce two discrete values: 0 and 1 Example: 1-bit full adder (FA) 2

Layered design approach Logic design is done using logic gates Often we design a desired hardware function using high-level languages (HDLs) and somewhat higher level than logic gates Two approaches in design Top down Bottom up Microarchitecture Function blocks Logic gates Transistors We ll do logic bottom up 3

Transistor as a switch X ON X OFF X G G=1 G=0 N -type TR Y Y Y X X X G G=0 G=1 P -type TR Y Y Y 4

An inverter 1 P -type TR A Y N -type TR 0 5

When A = 1 1 P -type TR OFF A=1 Y=0 N -type TR ON 0 6

When A = 0 1 P -type TR ON A=0 Y=1 N -type TR OFF 0 7

Abstraction 1 P -type TR A Y A Y N -type TR 0 8

Logic gates 2-input AND A B Y Y=A & B 2-input OR A B Y Y=A B 2-input NAND A B Y Y=~(A & B) 2-input NOR A B Y Y=~(A B) 9

Describing a function Output A = F(Input 0, Input 1,, Input N 1 ) Output B = F (Input 0, Input 1,, Input N 1 ) Output C = F (Input 0, Input 1,, Input N 1 ) Methods Truth table Sum of products Product of sums 10

Truth table Input Output A B C in S C out 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1 11

Sum of products Input Output A B C in S C out 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1 S = A B C in + A BC in + AB C in + ABC in C out = A BC in + AB C in + ABC in + ABC in OR two minterms Minterm NOT(A) AND NOT(B) AND Cin 12

Combinational vs. sequential logic Combinational logic = function A function whose outputs are dependent only on the current inputs As soon as inputs are known, outputs can be determined Sequential logic = combinational logic + memory Some memory elements (i.e., state ) Outputs are dependent on the current state and the current inputs Next state is dependent on the current state and the current inputs 13

Combinational logic delay (it takes time to compute) inputs outputs Outputs are uniquely determined by the inputs at any moment 14

Combinational logic delay (it takes time to compute) inputs outputs Outputs are uniquely determined by the inputs at any moment 15

Sequential logic delay (it takes time to compute, matched to clock) inputs outputs current state next state clock Outputs are determined by current & past inputs (past is state ) 16

Sequential logic delay (it takes time to compute, matched to clock) inputs outputs current state next state clock Outputs are determined by current & past inputs (past is state ) 17

Combinational logic Any combinational logic can be implemented using sum of products (OR-AND) or product of sums (AND-OR) Input-output relationship can be defined in a truth table format From truth table, derive each output function And then we can derive a circuit!! Let s try it! Example: Write circuit for an 1-bit ADDER Boolean expressions can be further manipulated (e.g., to reduce cost) using various Boolean algebraic rules 18

Boolean algebra Boole, George (1815~1864): mathematician and philosopher; inventor of Boolean Algebra, the basis of all computer arithmetic Binary values: {0,1} Two binary operations: AND ( / ), OR (+) One unary operation: NOT (~) 19

Boolean algebra Binary operations: AND ( / ), OR (+) Idempotent a a = a+a = a Commutative a b = b a a+b = b+a Associative a (b c) = (a b) c a+(b+c) = (a+b)+c Distributive a (b+c) = a b + a c a+(b c) = (a+b) (a+c) 20

Boolean algebra De Morgan s laws ~(a b) = ~a + ~ b ~(a+b) = ~a ~b More a+(a b) = a a (a+b) = a ~~a = a a+~a = 1 a (~a) = 0 It is not true I ate the sandwich and the soup. same as: I didn t eat the sandwich or I didn t eat the soup. It is not true that I went to the store or the library. same as: I didn t go to the store and I didn t go to the library. 21

Expressive power With AND/OR/NOT, we can express any function in Boolean algebra Sum (+) of products ( ) What if we have NAND/NOR/NOT? What if we have NAND only? What if we have NOR only? 22

Using NAND only 23

Using NOR only (your turn) Can you do it? NOR is (A + B) I.e., We need to write NOT, AND, and OR in terms of NOR NOT = (A + A) = A ^ A = A AND = ( (A + A) + (B + B)) = ( A ^ A + B ^ B) = ( A + B) = ( A) ^ ( B) = A ^ B OR = ( (A + B) + (A + B)) = (A + B) ^ (A + B) = A + B 24

Using NOR only (your turn) 25

Now, it s really your turn. How about XOR? A B C 0 0 0 0 1 1 1 0 1 1 1 0 C = A B + AB 26

Now, it s really your turn. How about XOR? A B C 0 1 0 0 0 1 1 0 1 1 1 0 1 1 0 1 1 0 C = A B + AB 0 1 0 1 0 1 0 27

Simplifying expressions Input Output A B C in S C out 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1 C out = A BC in + AB C in + ABC in + ABC in C out = BC in + AC in + AB Simplification reduces complexity: faster, smaller circuit! 28

Karnaugh map C out = A BC in + AB C in + ABC in + ABC in BC in A 0 1 A tool to help simplify boolean expressions Like a slide rule : Useful but limited A truth table listing minterms Minterms written in Gray code order One var value changes betw. col/row 00 0 0 Build from the initial boolean expr. Put a 1 where a minterm is true 01 0 1 AC in E.g.., AB C in has a 1 11 1 10 0 1 1 BC in AB Now, to simplify: Look for adjacent max rectangular groups with power of 2 elements. In such a group, some var is {0,1} Eliminate that variable C out = BC in +AB+AC in Here s another one! Groups can be vertical too. They can even wrap around They can also overlap Diagonals aren t allowed 29

C out = A BC in + AB C in + ABC in + ABC in S = A B C in + A BC in + AB C in + ABC in BC in A 0 1 BC in A 0 1 00 0 0 00 0 1 01 0 1 AC in 01 1 0 11 1 1 BC in 11 0 1 10 0 1 AB 10 1 0 C out = BC in +AB+AC in S = A B C in + A BC in + AB C in + ABC in 30

Four (or more?) Variables AB AB CD 00 01 11 10 00 0 0 0 0 01 0 0 0 0 11 0 1 1 0 10 0 1 1 0 CD 00 01 11 10 00 0 0 0 0 01 1 1 1 1 11 1 1 1 1 10 0 0 0 0 Can you minimize this one? In AB: B is both {0,1} In CD: C is both {0,1} Eliminate B, C Thus, we have just AD Can you minimize this one? C,D both have {0,1} A has {0,1} Eliminate A,C,D Thus, we have just B 31

Four (or more?) Variables AB CD 00 01 11 10 00 1 0 0 1 01 0 0 0 0 11 0 0 0 0 10 1 0 0 1 Can you minimize this one? Combine on top row Combine on bottom row A B D AB D These terms can now combine Thus, we have B D Karnaugh Maps (K-Maps) are a simple calculation tool. In practice, sophisticated logic synthesis algorithms/tools are used. 32

In-class Example A device called a 7 segment LED digit There are 8 LEDs one for seven segments of a numeral and 1 for a decimal point Problem Given a 3-bit number, draw the corresponding numeral E.g., 000 is the numeral 0, 001 is numeral 1 and so forth Solution Create a Boolean function for each segment. Ignore the decimal point. Boolean function over three inputs for the 3-bit number. Let s try it!! 33

d0 d1 d2 d3 Segments numbered d0 to d7 Hex Digit LED 7 segments, 1 decimal point Turn each segment on/off State: 0=OFF, 1=ON Draw numbers 0 to 9 d7 d6 d5 d4

d0 d1 d2 d3 Numeral 0 0 1 1 1 0 1 1 1 d0 d7 Hex Digit LED 7 segments, 1 decimal point Turn each segment on/off State: 0=OFF, 1=ON Draw numbers 0 to 9 d7 d6 d5 d4

d0 d1 d2 d3 Numeral 1 0 0 0 1 0 1 0 0 d0 d7 Hex Digit LED 7 segments, 1 decimal point Turn each segment on/off State: 0=OFF, 1=ON Draw numbers 0 to 9 d7 d6 d5 d4

d0 d1 d2 d3 Numeral 2 1 0 1 1 0 0 1 1 d0 d7 Hex Digit LED 7 segments, 1 decimal point Turn each segment on/off State: 0=OFF, 1=ON Draw numbers 0 to 9 d7 d6 d5 d4

d0 d1 d2 d3 Numeral 3 1 0 1 1 0 1 1 0 d0 d7 Hex Digit LED 7 segments, 1 decimal point Turn each segment on/off State: 0=OFF, 1=ON Draw numbers 0 to 9 d7 d6 d5 d4

d0 d1 d2 d3 Numeral 4 1 1 0 1 0 1 0 0 d0 d7 Hex Digit LED 7 segments, 1 decimal point Turn each segment on/off State: 0=OFF, 1=ON Draw numbers 0 to 9 d7 d6 d5 d4

d0 d1 d2 d3 Numeral 5 1 1 1 0 0 1 1 0 d0 d7 Hex Digit LED 7 segments, 1 decimal point Turn each segment on/off State: 0=OFF, 1=ON Draw numbers 0 to 9 d7 d6 d5 d4

d0 d1 d2 d3 Numeral 6 1 1 0 0 0 1 1 1 d0 d7 Hex Digit LED 7 segments, 1 decimal point Turn each segment on/off State: 0=OFF, 1=ON Draw numbers 0 to 9 d7 d6 d5 d4

d0 d1 d2 d3 Numeral 7 0 0 1 1 0 1 0 0 d0 d7 Hex Digit LED 7 segments, 1 decimal point Turn each segment on/off State: 0=OFF, 1=ON Draw numbers 0 to 9 d7 d6 d5 d4

In-class Example Create a truth table Inputs are numbered i0 to i2 (3 bits) Outputs are numbered d0 to d7, corresponding to segments Draw the numerals by setting d0 to d7 to 1s or 0s. 43

inputs outputs i2 i1 i0 d0 d1 d2 d3 d4 d5 d6 d7 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 Input: 3-bit number Outputs: Segments for the LED hex digit

inputs outputs i2 i1 i0 d0 d1 d2 d3 d4 d5 d6 d7 0 0 0 0 1 1 1 0 1 1 1 0 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 Fill in the truth table for each numeral Numerals 0 to 2 are shown. Can you complete 3 to 7?

inputs outputs i2 i1 i0 d0 d1 d2 d3 d4 d5 d6 d7 0 0 0 0 1 1 1 0 1 1 1 0 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1 0 1 1 0 1 0 0 1 1 0 1 0 1 0 0 1 0 1 1 1 1 0 0 1 1 0 1 1 0 1 1 0 0 0 1 1 1 1 1 1 0 0 1 1 0 1 0 0 Completed truth table Now, write down the minimal (simplified) Boolean functions Use a K-map to minimize each one!

inputs outputs i2 i1 i0 d0 d1 d2 d3 d4 d5 d6 d7 0 0 0 0 1 1 1 0 1 1 1 0 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1 0 1 1 0 1 0 0 1 1 0 1 0 1 0 0 1 0 1 1 1 1 0 0 1 1 0 1 1 0 1 1 0 0 0 1 1 1 1 1 1 0 0 1 1 0 1 0 0 Completed truth table Now, write down the minimal (simplified) Boolean functions Use a K-map to minimize each one!

i1, i0 00 01 11 10 i2 0 1 Use a K-map for each output function d0 to d7 Let s start with d0 We ll only do a few d0, d3 and d5 Can you do the rest on your own???

Function d0 i1, i0 00 01 11 10 i2 0 0 0 1 1 1 1 1 0 1 i2 i1 i0 d0 d1 d2 d3 d4 d5 d6 d7 0 0 0 0 1 1 1 0 1 1 1 0 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1 0 1 1 0 1 0 0 1 1 0 1 0 1 0 0 1 0 1 1 1 1 0 0 1 1 0 1 1 0 1 1 0 0 0 1 1 1 1 1 1 0 0 1 1 0 1 0 0

Function d0 i1, i0 00 01 11 10 i2 0 0 0 1 1 1 1 1 0 1 i2 i1 i0 d0 d1 d2 d3 d4 d5 d6 d7 0 0 0 0 1 1 1 0 1 1 1 0 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1 0 1 1 0 1 0 0 1 1 0 1 0 1 0 0 1 0 1 1 1 1 0 0 1 1 0 1 1 0 1 1 0 0 0 1 1 1 1 1 1 0 0 1 1 0 1 0 0 3 terms i2 i1 i2i1 I2i0 d0=i2i1 + i2i1 + i2i0

Function d3 i1, i0 00 01 11 10 i2 0 1 1 1 1 1 1 0 1 0 i2 i1 i0 d0 d1 d2 d3 d4 d5 d6 d7 0 0 0 0 1 1 1 0 1 1 1 0 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1 0 1 1 0 1 0 0 1 1 0 1 0 1 0 0 1 0 1 1 1 1 0 0 1 1 0 1 1 0 1 1 0 0 0 1 1 1 1 1 1 0 0 1 1 0 1 0 0

Function d3 i1, i0 00 01 11 10 i2 0 1 1 1 1 1 1 0 1 0 i2 i1 i0 d0 d1 d2 d3 d4 d5 d6 d7 0 0 0 0 1 1 1 0 1 1 1 0 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1 0 1 1 0 1 0 0 1 1 0 1 0 1 0 0 1 0 1 1 1 1 0 0 1 1 0 1 1 0 1 1 0 0 0 1 1 1 1 1 1 0 0 1 1 0 1 0 0 d3=i2 + i1i0 + i1i0

Function d5 i1, i0 00 01 11 10 i2 0 1 1 1 0 1 1 1 1 1 i2 i1 i0 d0 d1 d2 d3 d4 d5 d6 d7 0 0 0 0 1 1 1 0 1 1 1 0 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1 0 1 1 0 1 0 0 1 1 0 1 0 1 0 0 1 0 1 1 1 1 0 0 1 1 0 1 1 0 1 1 0 0 0 1 1 1 1 1 1 0 0 1 1 0 1 0 0

Function d5 i1, i0 00 01 11 10 i2 0 1 1 1 0 1 1 1 1 1 i2 i1 i0 d0 d1 d2 d3 d4 d5 d6 d7 0 0 0 0 1 1 1 0 1 1 1 0 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1 0 1 1 0 1 0 0 1 1 0 1 0 1 0 0 1 0 1 1 1 1 0 0 1 1 0 1 1 0 1 1 0 0 0 1 1 1 1 1 1 0 0 1 1 0 1 0 0 d5=i1 + i0 + i2

Completed Circuit with all functions d0 to d7 Inputs Outputs to the LED hex digit See example: LEDhexdigit.circ

Multiplexor (aka MUX) An example, yet VERY useful circuit! A B 0 1 Y S A B Y 0 0 x 0 0 1 x 1 1 x 0 0 1 x 1 1 S=1 S=0 Y = (S)? B:A; Y=S A+SB when S = 0: output A 1: output B 56

A 32-bit MUX Use 32 1-bit muxes Each mux selects 1 bit S is connected to each mux 57

Building a 1-bit ALU ALU = arithmetic logic unit = arithmetic unit + logic unit 58

Building a 32-bit ALU 59

Implementing sub Binvert=1 CarryIn=1 for 1 st 1-bit ALU Operation=2 60

Implementing NAND and NOR NOR: NOT (A OR B) by DeMorgan s Law: (NOT A) AND (NOT B) Thus, Operation=0, Ainvert=1, Binvert=1 And, NAND??? 61

Implementing SLT (set-less-than) 1-bit ALU for bits 0~30 1-bit ALU for bit 31 62

Implementing SLT (set-less-than) SLT uses subtraction slt $t0,$t1,$t2 $t1<$t2: $t1-$t2 gives negative result set is 1 when negative 1 0 Setting the control perform subtraction (Cin=1,Binvert=1) select Less as output (Operation=3) ALU31 s Set connected to ALU0 Less 0 Consider Suppose $t1=10 and $t2=11 $t1 - $t2 = -1 = 1111 1 binary $t0 = 0000...1 1 0 63

Implementing SLT (set-less-than) SLT uses subtraction slt $t0,$t1,$t2 $t1<$t2: $t1-$t2 gives negative result set is 1 when negative Setting the control perform subtraction (Cin=1,Binvert=1) select Less as output (Operation=3) ALU31 s Set connected to ALU0 Less Why do we need Set? Could we use just the Result31? 64

Supporting BEQ and BNE BEQ uses subtraction beq $t0,$t1,label perform $t0-$t1 result=0 è equality zero detector Setting the control subtract (Cin=1,Binvert=1) select result (operation=2) detect zero result 65

Abstracting ALU Note that ALU is a combinational logic 66