Today s Lecture. Basics of Logic Design: Boolean Algebra, Logic Gates. Recursive Example. Review: The C / C++ code. Recursive Example (Continued)

Similar documents
Basics of Logic Design Arithmetic Logic Unit (ALU)

6/23/2011. Review: IEEE-754. CSE 2021: Computer Organization. Exercises. Examples. Shakil M. Khan (adapted from Profs. Roumani & Asif)

Course Administration

Quiz2 45mins. Personal Number: Problem 1. (20pts) Here is an Table of Perl Regular Ex

Stack Manipulation. Other Issues. How about larger constants? Frame Pointer. PowerPC. Alternative Architectures

Systems I. Logic Design I. Topics Digital logic Logic gates Simple combinational logic circuits

Computer Arithmetic Logical, Integer Addition & Subtraction Chapter

George Boole. IT 3123 Hardware and Software Concepts. Switching Algebra. Boolean Functions. Boolean Functions. Truth Tables

MIPS I/O and Interrupt

CS 130 : Computer Systems - II. Shankar Balachandran Dept. of Computer Science & Engineering IIT Madras

CS 241. Fall 2017 Midterm Review Solutions. October 24, Bits and Bytes 1. 3 MIPS Assembler 6. 4 Regular Languages 7.

Questions About Numbers. Number Systems and Arithmetic. Introduction to Binary Numbers. Negative Numbers?

What do all those bits mean now? Number Systems and Arithmetic. Introduction to Binary Numbers. Questions About Numbers

Pointers and Arrays. More Pointer Examples. Pointers CS 217

What do all those bits mean now? Number Systems and Arithmetic. Introduction to Binary Numbers. Questions About Numbers

CMPUT101 Introduction to Computing - Summer 2002

Virtual Machine (Part I)

CS201 Discussion 10 DRAWTREE + TRIES

Mid-term exam. Scores. Fall term 2012 KAIST EE209 Programming Structures for EE. Thursday Oct 25, Student's name: Student ID:

cisc1110 fall 2010 lecture VI.2 call by value function parameters another call by value example:

Register Transfer Level (RTL) Design

Lists in Lisp and Scheme

LING/C SC/PSYC 438/538. Lecture 21 Sandiway Fong

GC03 Boolean Algebra

CS61C : Machine Structures

QUESTION BANK FOR TEST

Introduction to Computer Engineering EECS 203 dickrp/eecs203/ CMOS transmission gate (TG) TG example

Describing Combinational circuits in BSV

Midterm 2 Sample solution

Virtual Machine I: Stack Arithmetic

CS2204 DIGITAL LOGIC & STATE MACHINE DESIGN SPRING 2014

ASTs, Regex, Parsing, and Pretty Printing

Section 3.1: Sequences and Series

Fundamentals of Engineering Analysis ENGR Matrix Multiplication, Types

Introduction to Integration

Engineer To Engineer Note

CS 31: Intro to Systems Digital Logic

The Basic Properties of the Integral

Introduction to Computer Architecture

Compilers Spring 2013 PRACTICE Midterm Exam

10/9/2012. Operator is an operation performed over data at runtime. Arithmetic, Logical, Comparison, Assignment, Etc. Operators have precedence

2B 52 AB CA 3E A1 +29 A B C. CS120 Fall 2018 Final Prep and super secret quiz 9

Simplifying Algebra. Simplifying Algebra. Curriculum Ready.

Computer Organization and Levels of Abstraction

MTH 146 Conics Supplement

CPSC 213. Polymorphism. Introduction to Computer Systems. Readings for Next Two Lectures. Back to Procedure Calls

Dynamic Programming. Andreas Klappenecker. [partially based on slides by Prof. Welch] Monday, September 24, 2012

SYNERGY INSTITUTE OF ENGINEERING & TECHNOLOGY,DHENKANAL LECTURE NOTES ON DIGITAL ELECTRONICS CIRCUIT(SUBJECT CODE:PCEC4202)

EECS 281: Homework #4 Due: Thursday, October 7, 2004

such that the S i cover S, or equivalently S

Scope, Functions, and Storage Management

Midterm Exam Review. CS 2420 :: Fall 2016 Molly O'Neil

COMP 423 lecture 11 Jan. 28, 2008

Theory of Computation CSE 105

NOTES. Figure 1 illustrates typical hardware component connections required when using the JCM ICB Asset Ticket Generator software application.

ΕΠΛ323 - Θεωρία και Πρακτική Μεταγλωττιστών

The Fundamental Theorem of Calculus

Math 464 Fall 2012 Notes on Marginal and Conditional Densities October 18, 2012

Matrices and Systems of Equations

Computer Organization and Levels of Abstraction

Concepts Introduced. A 1-Bit Logical Unit. 1-Bit Half Adder (cont.) 1-Bit Half Adder

1. Prove that if you have tri-state buffers and inverters, you can build any combinational logic circuit. [4]

Objectives: 1- Bolean Algebra. Eng. Ayman Metwali

10.5 Graphing Quadratic Functions

Parallel logic circuits

Tries. Yufei Tao KAIST. April 9, Y. Tao, April 9, 2013 Tries

A Tautology Checker loosely related to Stålmarck s Algorithm by Martin Richards

Geometric transformations

Bawar Abid Abdalla. Assistant Lecturer Software Engineering Department Koya University

In the last lecture, we discussed how valid tokens may be specified by regular expressions.

CS470: Computer Architecture. AMD Quad Core

Stack. A list whose end points are pointed by top and bottom

This Unit: Processor Design. What Is Control? Example: Control for sw. Example: Control for add

CS61C : Machine Structures

Fall 2017 Midterm Exam 1 October 19, You may not use any books, notes, or electronic devices during this exam.

Lecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: continued. Consulting hours. Introduction to Sim. Milestone #1 (due 1/26)

CSCE 531, Spring 2017, Midterm Exam Answer Key

CS429: Computer Organization and Architecture

APPLICATIONS OF INTEGRATION

How to Design REST API? Written Date : March 23, 2015

Representation of Numbers. Number Representation. Representation of Numbers. 32-bit Unsigned Integers 3/24/2014. Fixed point Integer Representation

Languages. L((a (b)(c))*) = { ε,a,bc,aa,abc,bca,... } εw = wε = w. εabba = abbaε = abba. (a (b)(c)) *

CS321 Languages and Compiler Design I. Winter 2012 Lecture 5

PARALLEL AND DISTRIBUTED COMPUTING

Lecture 3: Binary Subtraction, Switching Algebra, Gates, and Algebraic Expressions

Computer Architecture Set Four. Arithmetic

Summer Review Packet For Algebra 2 CP/Honors

LSN 4 Boolean Algebra & Logic Simplification. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology

Introduction to hardware design using VHDL

Engineer To Engineer Note

Solutions - Homework 2 (Due date: October 9:30 am) Presentation and clarity are very important!

ELCT 501: Digital System Design

Fig.25: the Role of LEX

Boolean Unit (The obvious way)

Functor (1A) Young Won Lim 8/2/17

a < a+ x < a+2 x < < a+n x = b, n A i n f(x i ) x. i=1 i=1

SIMPLIFYING ALGEBRA PASSPORT.

CS 430 Spring Mike Lam, Professor. Parsing

Definition of Regular Expression

Functor (1A) Young Won Lim 10/5/17

Transcription:

Tod s Lecture Bsics of Logic Design: Boolen Alger, Logic Gtes Alvin R. Leeck CPS 4 Lecture 8 Homework #2 Due Ferur 3 Outline Review (sseml recursion) Building the uilding locks Logic Design Truth tles, Boolen functions, Gtes nd Circuits Exmples: 2- MUX, Full Adder Reding Appendix B, Chpter 4 CPS 4 2 #include <stdio> Review: The C / C++ code int min ( ) { int i; int sum = ; for(i=; i <= ; i++) sum = sum + i*i ; cout << The nswer is << sum << endl; } Alred did itertive version, recursive version Recursive Exmple.lign 2.text foo: suu $sp, $sp, 32 # stck frme 32 tes sw $r, 2($sp) # sve return ddress sw $fp, 6($sp) # sve old frme pointer ddu $fp, $fp, 6 # set up new frme pointer move $v, $zero # cler return vlue slti $t, $, eq $t, $zero, done # if > do not recurse mul $t, $, $ # i*i $t, 2($sp) # sve sw multipl ddi $, $, # i++ jl foo # recurse lw $t, 2($sp) # restore multipl dd $v, $v, $t # sum += i*i done: lw $fp, 6($sp) # restore old frme ptr lw $r, 2($sp) # restore return ddress ddu $sp, $sp, 32 # remove frme j $r CPS 4 3 CPS 4 4 Recursive Exmple (Continued) Recursive Exmple (Continued).text.glol min min: suu $sp, $sp, 32 # stck frme 32 tes sw $r, 2($sp) # sve return ddress sw $fp, 6($sp) # sve old frme pointer ddu $fp, $fp, 6 # set up new frme pointer.dt mstr:.sciiz "The nswer is " endl:.sciiz "\n" li $v, 4 # 4 = print string l $, mstr # lod ddress of string sscll # print string li $, # initilize $i jl foo # cll foo move $, $v # put result in $ li $v, # = print int sscll # print int li $v, 4 # 4 = print string l $, endl # lod ddress of endl sscll # print string This is on course we pge (code ) lw $fp, 6($sp) # restore old frme ptr lw $r, 2($sp) # restore return ddress ddu $sp, $sp, 32 # remove frme j $r CPS 4 5 CPS 4 6

The Big Picture Wht We ve Done, Where We re Going The Five Clssic Components of Computer Processor/CPU Control Dtpth Memor Input Output Top Down Appliction Compiler Operting Sstem CPU Memor I/O sstem Digitl Design Circuit Design Firmwre Softwre Interfce Between HW nd SW Instruction Set Architecture, Memor, I/O Hrdwre Bottom UP to CPU CPS 4 7 CPS 4 8 Digitl Design Boolen Alger Logic Design, Switching Circuits, Digitl Logic Recll: Everthing is uilt from trnsistors A trnsistor is switch It is either on or off On or off cn represent True or Flse Need method to reson out complex expressions Given unch of its Is this instruction lw or eq? Wht register do I red? How do I dd two numers? Boolen functions hve rguments tht tke two vlues ({T,F} or {,}) nd the return single or set of ({T,F} or {,}) vlue(s). Boolen functions cn lws e represented tle clled Truth Tle Exmple: F: {,} 3 -> {,} 2 c f f 2 CPS 4 9 CPS 4 NOT() Boolen Functions Exmple Boolen Functions: NOT, AND, OR, XOR,... AND(,) OR(,) Boolen Functions nd Expressions Boolen lger nottion: Use * for AND, + for OR, ~ for NOT. Not is lso written s A nd A Using the ove nottion one cn write Boolen expressions for functions F(A, B, C) = (A * B) + (~A * C) XOR(,) XNOR(,) NOR(,) One cn evlute the Boolen expression with ll possile rgument vlues to construct truth tle. Wht is truth tle for F? CPS 4 CPS 4 2

Boolen Function Simplifiction Boolen Function Simplifiction Boolen expressions cn e simplified using the following rules: A*A = A A* = A* = A A*~A = A+A = A A+ = A A+ = A+~A = A*B = B*A A*(B+C) = (B+C)*A = A*B + A*C c f f 2 f = ~*~*c + ~**c + *~*c + **c f 2 = ~*~*~c + ~*~*c + **~c + **c Simplif these functions... CPS 4 4 CPS 4 5 Boolen Functions nd Expressions Boolen Functions nd Expressions The Fundmentl Theorem of Boolen Alger: Ever Boolen function cn e written in disjunctive norml form s n OR of ANDs (Sum-of products) of it s rguments or their complements. Proof: Write the truth tle, construct sum-ofproduct from the tle. XNOR(,) XNOR = (~ * ~) + ( * ) Exmple-2: c f f 2 f = ~*~*c + ~**~c + *~*~c + **c f 2 = ~*~*~c + ~*~*c + **~c + **c CPS 4 7 CPS 4 8 DeMorgn s Lws Boolen Gtes ~(A+B) = ~A * ~B ~(A*B) = ~A + ~B Exmple: Gtes re electronic devices tht implement simple Boolen functions Exmples ~C*~A*B + ~C*A*~B + C*A*B + C*~A*~B Use onl XOR to represent this function AND(,) OR(,) NOT() XOR(,) NAND(,) NOR(,) XNOR(,) CPS 4 9 CPS 4 2

Relit Check Bsic Boolen Gte -4 Trnsistors Pentium III Processor Core 9.5 Million Trnsistors Totl: 28 Million Trnsistors Pentium 4 Totl: 42 Million Trnsistors Boolen Functions, Gtes nd Circuits Circuits re mde from network of gtes. (function compositions). XOR(,) F = ~* + ~* XOR(,) F CPS 4 2 CPS 4 22 Digitl Design Exmples Design Exmple Input: 2 its representing n unsigned numer (n) Output: n 2 s unsigned inr numer Input: 2 its representing n unsigned numer (n) Output: 3-n s unsigned inr numer Consider mchine with 4 registers Given 2-it input (register specifier, I, I ) Wnt one of 4 output its (O 3 -O ) to e E.g., llows single register to e ccessed Wht is the circuit for this? CPS 4 23 CPS 4 24 Circuit Exmple: Decoder Circuit Exmple: 2x MUX Q3 Multiplexor (MUX) selects from one of mn inputs Q2 Q I I Q Q Q 2 Q 3 s MUX(A, B, S) = (A * S) + (B * ~S) Q B Gte Gte 3 Y = (A * S) + (B * ~S) A Gte 2 S I I CPS 4 25 CPS 4 26

Exmple 4x MUX Arithmetic nd Logicl Opertions in ISA c d c d 3 2 Wht opertions re there? How do we implement them? Consider -it Adder s s 2 S CPS 4 27 CPS 4 28 Summr Boolen Alger & functions Logic gtes (AND, OR, NOT, etc) Multiplexors Reding Appendix B, Chpter 4 CPS 4 29