CS231: Computer Architecture I Laxmikant Kale Fall 2002.

Slides:



Advertisements
Similar presentations
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify and.
Advertisements

التصميم المنطقي Second Course
Cosc 2150: Computer Organization Chapter 3: Boolean Algebra and Digital Logic.
Assembly Language and Computer Architecture Using C++ and Java
CSC 110 – Intro to Computing Lecture 14: Midterm Review.
1 Number Systems. 2 Numbers Each number system is associated with a base or radix – The decimal number system is said to be of base or radix 10 A number.
Mantıksal Tasarım – BBM231 M. Önder Efe
(2.1) Fundamentals  Terms for magnitudes – logarithms and logarithmic graphs  Digital representations – Binary numbers – Text – Analog information 
CS231 Fundamentals1 Fundamentals What kind of data do computers work with? – Deep down inside, it’s all 1s and 0s What can you do with 1s and 0s? – Boolean.
Computer Organization By Dr. M. Khamis Mrs. Dua’a Al Sinari.
Numeral Systems Subjects: Numeral System Positional systems Decimal
CS231: Computer Architecture I Laxmikant Kale Fall 2004.
1 CHAPTER 4: PART I ARITHMETIC FOR COMPUTERS. 2 The MIPS ALU We’ll be working with the MIPS instruction set architecture –similar to other architectures.
CSU0014 Assembly Languages Homepage: Textbook: Kip R. Irvine, Assembly Language for Intel-Based Computers,
Binary Numbers.
Summer 2014 Chapter 1: Basic Concepts. Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Chapter Overview Welcome to Assembly Language.
Assembly Language for x86 Processors 7th Edition
IKI a-Boolean Algebra Bobby Nazief Semester-I The materials on these slides are adopted from those in CS231’s Lecture Notes at UIUC,
Logic and Digital System Design - CS 303
CS1Q Computer Systems Lecture 9 Simon Gay. Lecture 9CS1Q Computer Systems - Simon Gay2 Addition We want to be able to do arithmetic on computers and therefore.
EE2174: Digital Logic and Lab Professor Shiyan Hu Department of Electrical and Computer Engineering Michigan Technological University CHAPTER 2 Number.
IKI a-Combinatorial Components Bobby Nazief Semester-I The materials on these slides are adopted from those in CS231’s Lecture Notes.
1 Boolean Algebra & Logic Gates. 2 Objectives Understand the relationship between Boolean logic and digital computer circuits. Learn how to design simple.
IKI Data Types & Representations Bobby Nazief Semester-I The materials on these slides are adopted from those in CS231’s Lecture Notes.
1 CS103 Guest Lecture Number Systems & Conversion Bitwise Logic Operations.
CS231 Boolean Algebra1 K-map Summary K-maps are an alternative to algebra for simplifying expressions. – The result is a minimal sum of products, which.
June 10, 2002© Howard Huang1 Number systems To get started, we’ll discuss one of the fundamental concepts underlying digital computer design:
CS231 Boolean Algebra1 Summary so far So far: – A bunch of Boolean algebra trickery for simplifying expressions and circuits – The algebra guarantees us.
Boolean Functions and Boolean Algebra Laxmikant Kale.
CS231: Computer Architecture I Laxmikant (Sanjay) Kale And Luddy Harrison Fall 2006.
CSC 331: DIGITAL LOGIC DESIGN COURSE LECTURER: E. Y. BAAGYERE. CONTACT: LECTURE TIME: 15:40 – 17:45 hrs. VENUE: SP-LAB.
Addition and multiplication Arithmetic is the most basic thing you can do with a computer, but it’s not as easy as you might expect! These next few lectures.
BINARY SYSTEMS ENGR. KASHIF SHAHZAD 1. BINARY NUMBERS 1/2 Internally, information in digital systems is of binary form groups of bits (i.e. binary numbers)
Addition and multiplication1 Arithmetic is the most basic thing you can do with a computer, but it’s not as easy as you might expect! These next few lectures.
Unit 1 Introduction Number Systems and Conversion.
Cosc 2150: Computer Organization
DAT10403 CHAPTER 4 COMPUTER ARITHMETIC By Noordiana Kassim
Invitation to Computer Science, C++ Version, Fourth Edition
Morgan Kaufmann Publishers
Combinational Logic Design&Analysis.
Number Systems.
COMPUTING FUNDAMENTALS
Addition and multiplication
CS231: Computer Architecture I
Circuit analysis summary
Boolean algebra Last time we talked about Boolean functions, Boolean expressions, and truth tables. Today we’ll learn how to how use Boolean algebra to.
Fundamentals & Ethics of Information Systems IS 201
IT 0213: INTRODUCTION TO COMPUTER ARCHITECTURE
University of Gujrat Department of Computer Science
Additional Gates and Decoders
Digital Electronics & Logic Design
CISC101 Reminders Your group name in onQ is your grader’s name.
Subtraction The arithmetic we did so far was limited to unsigned (positive) integers. Today we’ll consider negative numbers and subtraction. The main problem.
Functions Computers take inputs and produce outputs, just like functions in math! Mathematical functions can be expressed in two ways: We can represent.
Digital Logic.
Digital Systems and Binary Numbers
Addition and multiplication
CS231: Computer Architecture I
Dr. Clincy Professor of CS
From now on: Combinatorial Circuits:
Addition and multiplication
Number Systems Rayat Shikshan Sanstha’s
CMSC250 Fall 2018 Circuits 1 1.
Copyright © Cengage Learning. All rights reserved.
CS231: Computer Architecture I
Karnaugh maps Last time we saw applications of Boolean logic to circuit design. The basic Boolean operations are AND, OR and NOT. These operations can.
Number Systems Rayat Shikshan Sanstha’s
Basic circuit analysis and design
Computer Organization
Presentation transcript:

CS231: Computer Architecture I Laxmikant Kale Fall 2002

Introduction to CS231 1 Review There are 10 kinds of people in the world – Those who understand binary and those who don’t

Introduction to CS231 2 Binary addition example worked out Some terms are given here Exercise: what are these numbers equivalent to in decimal? 1110(Carries) 1011(Augend) +1110(Addend) 11001(Sum) The initial carry in is implicitly 0 most significant bit (MSB) least significant bit (LSB)

Introduction to CS231 3 Basic Gates There are three basic kinds of logic gates AND of two inputs OR of two inputs NOT (complement) on one input Operation: Logic gate: Two Questions: How can we implement such switches? What can we build with Gates? And How?

Introduction to CS231 4 Doing addition with gates Lets do simple stuff first: – Can we add two numbers each with just 1 bit? Bit: binary digit – 0+0 = 0, 0+1 = 1, 1+0 = 1, and 1+1 = ??? 2. But 2 is not a symbol. 10 (just as is 10 in decimal) Result is 0 with 1 carried over to the next bit.. – Whats 1 and 0? High and low voltage respectively. Result Carry Half adder

Introduction to CS231 5 Half adder: result Result This circuit is so common, that it has a name an symbol as a gate by itself: Exclusive OR Exclusive OR Output is 1 iff exactly one of the 2 inputs is 1

Introduction to CS231 6 Adding two bits A half adder is used to add two bits. The result consists of two bits: a sum (the right bit) and a carry out (the left bit) Here is the circuit and its block symbol 0+ 0= = = = 10

Introduction to CS231 7 Adding three bits But what we really need to do is add three bits: the augend and addend, and the carry in from the right = = = = = = = = 11

Introduction to CS231 8 Full adder circuit Why are these things called half adders and full adders? You can build a full adder by putting together two half adders.

Introduction to CS231 9 A 4-bit adder Four full adders together can make a 4-bit adder There are nine total inputs to the 4-bit adder: – two 4-bit numbers, A3 A2 A1 A0 and B3 B2 B1 B0 – an initial carry in, CI The five outputs are: – a 4-bit sum, S3 S2 S1 S0 – a carry out, CO

Introduction to CS An example of 4-bit addition Let’s put our initial example into this circuit: A=1011, B=1110 Step 1:Fill in all the inputs, including CI=0 Step 2:The circuit produces C1 and S0 ( = 01) Step 3:Use C1 to find C2 and S1 ( = 10) Step 4:Use C2 to compute C3 and S2 ( = 10) Step 5:Use C3 to compute CO and S3 ( = 11) The final answer is

Introduction to CS Now that we can add, how about some memory? We want to save results computed before, and recall them in a later calculation, for example Gates help us build memory How can a circuit “remember” anything on its own? – After all, the values on the wires are always changing, as outputs are generated in response to inputs. The basic idea is feedback: we make a “loop” in the circuit, so the circuit outputs are inputs as well When S and R are 0, Q is “stable”: whatever it was, it stays in that state. Ergo : memory. When S is 1 and R is 0, Q becomes 1 When R is 1 and S is 0, Q becomes 0 Set and Reset inputs…

Introduction to CS So, we have built a calculator It is not a computer yet… – We have to type each step into a calculator – We’d like to “program” standard steps E.g. Add 57 numbers sitting in memory in specific places – Also, support other operations (subtract..) Two new ideas and components are needed for this: – Addressable memory – Stored Program Addressable memory – Memory organized in a bunch of locations, such that contents of specified location can be brought back to the adder when needed. – Each memory location has an “address” (binary, of course) Stored Program: – The instructions for which numbers to operate on, what operation to do (add/subtract,..) and where to store the result – The instructions themselves can be represented in binary and stored in the memory! – The processor must have circuits to decode and “interpret” these instructions

Introduction to CS Components of a basic computer Memory ALU (Arithmetic/Logic Unit: Basic operations Data Program Control and Decoding

Introduction to CS Summary Controllable Switches are easy to make These switches can be used to put together “Logic Gates” Logic Gates can be put together to make half adder, full adders and multi-bit adders – So we can see they can be used for other such circtuits as well Logic Gates can be used to make circtuits that “remember” or store data A Computer includes, at its heart : – An ALU (Arithmetic Logic Unit) – Instruction Decoding and associated circuits – Memory – Stored Program

© Howard Huang 15 Number systems To get started, we’ll discuss one of the fundamental concepts underlying digital computer design: Deep down inside, computers work with just 1s and 0s. Computers use voltages to represent information. In modern CPUs the voltage is usually limited to V to minimize power consumption. It’s convenient for us to translate these analog voltages into the discrete, or digital, values 1 and 0. But how can two lousy digits be useful for anything? – First, we’ll see how to represent numbers with just 1s and 0s. – Then we’ll introduce special operations for computing with 1s and 0s, by treating them as the logical values “true” and “false.” Volts

Introduction to CS Rest of Today’s lecture Having seen an overview last week, – We will now start a more thorough study Number systems – Review of binary number representation – How to convert between binary and decimal representations – Octal and Hex representations Basic boolean operations – AND, OR and NOT – The idea of “Truth Table” – Boolean functions and expressions – Truth table for Boolean expressions

Introduction to CS Decimal review Numbers consist of a bunch of digits, each with a weight: The weights are all powers of the base, which is 10. We can rewrite the weights like this: To find the decimal value of a number, multiply each digit by its weight and sum the products. (1 x 10 2 ) + (6 x 10 1 ) + (2 x 10 0 ) + (3 x ) + (7 x ) + (5 x ) =

Introduction to CS Converting binary to decimal We can use the same trick to convert binary, or base 2, numbers to decimal. The only difference is that the weights are powers of 2. For example, here is in binary: The decimal value is: (1 x 2 3 ) + (1 x 2 2 ) + (0 x 2 1 ) + (1 x 2 0 ) + (0 x 2 -1 ) + (1 x 2 -2 ) = = 13.25

Introduction to CS Converting decimal to binary To convert a decimal integer into binary, keep dividing by 2 until the quotient is 0. Collect the remainders in reverse order. To convert a fraction, keep multiplying the fractional part by 2 until it becomes 0. Collect the integer parts in forward order. Example: : So, = / 2= 81rem 0 81 / 2= 40rem 1 40 / 2= 20rem 0 20 / 2= 10rem 0 10 / 2= 5rem 0 5 / 2= 2rem 1 2 / 2= 1rem 0 1 / 2= 0rem x 2 = x 2 = x 2 = 1.000

Introduction to CS Why does this work? This works for converting from decimal to any base Why? Think about converting from decimal to decimal. Each division strips off the rightmost digit (the remainder). The quotient represents the remaining digits in the number. Similarly, to convert fractions, each multiplication strips off the leftmost digit (the integer part). The fraction represents the remaining digits. 162 / 10= 16rem 2 16 / 10= 1rem 6 1 / 10= 0rem x 10 = x 10 = x 10 = 5.000

Introduction to CS Base 16 is useful too The hexadecimal system uses 16 digits: A B C D E F You can convert between base 10 and base 16 using techniques like the ones we just showed for converting between decimal and binary. For our purposes, base 16 is most useful as a “shorthand” notation for binary numbers. – Since 16 = 2 4, one hexadecimal digit is equivalent to 4 binary digits. – It’s often easier to work with a number like B4 instead of Hex is frequently used to specify things like 32-bit IP addresses and 24-bit colors.

Introduction to CS Binary and hexadecimal conversions Converting from hexadecimal to binary is easy: just replace each hex digit with its equivalent 4-bit binary sequence. To convert from binary to hex, make groups of 4 bits, starting from the binary point. Add 0s to the ends of the number if needed. Then, just convert each bit group to its corresponding hex digit = = = = B 4. 2 C 16

Introduction to CS Number Systems Summary Computers are binary devices. – We’re forced to think in terms of base 2. – Today we learned how to convert numbers between binary, decimal and hexadecimal. We’ve already seen some of the recurring themes of architecture: – We use 0 and 1 as abstractions for analog voltages. – We showed how to represent numbers using just these two signals. Next we’ll introduce special operations for binary values and show how those correspond to circuits.

© Howard Huang 24 Boolean Operations So far, we’ve talked about how arbitrary numbers can be represented using just the two binary values 1 and 0. Now we’ll interpret voltages as the logical values “true” and “false” instead. We’ll show: – How functions can be defined for expressing computations – How to build circuits that implement our functions in hardware

Introduction to CS Boolean values Earlier, we used electrical voltages to represent two discrete values 1 and 0, from which binary numbers can be formed. It’s also possible to think of voltages as representing two logical values, true and false. For simplicity, we often still write digits instead: – 1 is true – 0 is false We will use this interpretation along with special operations to design functions and hardware for doing arbitrary computations. Volts True False

Introduction to CS Functions Computers take inputs and produce outputs, just like functions in math! Mathematical functions can be expressed in two ways: We can represent logical functions in two analogous ways too: – A finite, but non-unique Boolean expression. – A truth table, which will turn out to be unique and finite. f(x,y)= 2x + y = x + x + y = 2(x + y/2) =... An expression is finite but not unique A function table is unique but infinite

Introduction to CS Basic Boolean operations There are three basic operations for logical values. AND (product) of two inputs OR (sum) of two inputs NOT (complement) on one input xy, or x  yx + yx’ Operation: Expression: Truth table:

Introduction to CS Boolean expressions We can use these basic operations to form more complex expressions: f(x,y,z) = (x + y’)z + x’ Some terminology and notation: – f is the name of the function. – (x,y,z) are the input variables, each representing 1 or 0. Listing the inputs is optional, but sometimes helpful. – A literal is any occurrence of an input variable or its complement. The function above has four literals: x, y’, z, and x’. Precedences are important, but not too difficult. – NOT has the highest precedence, followed by AND, and then OR. – Fully parenthesized, the function above would be kind of messy: f(x,y,z) = (((x +(y’))z) + x’)

Introduction to CS Truth tables A truth table shows all possible inputs and outputs of a function. Remember that each input variable represents either 1 or 0. – Because there are only a finite number of values (1 and 0), truth tables themselves are finite. – A function with n variables has 2 n possible combinations of inputs. Inputs are listed in binary order—in this example, from 000 to 111. f(0,0,0)= (0 + 1)0 + 1= 1 f(0,0,1)= (0 + 1)1 + 1= 1 f(0,1,0)= (0 + 0)0 + 1= 1 f(0,1,1)= (0 + 0)1 + 1= 1 f(1,0,0)= (1 + 1)0 + 0= 0 f(1,0,1)= (1 + 1)1 + 0= 1 f(1,1,0)= (1 + 0)0 + 0= 0 f(1,1,1)= (1 + 0)1 + 0= 1 f(x,y,z) = (x + y’)z + x’

Introduction to CS Primitive logic gates Each of our basic operations can be implemented in hardware using a primitive logic gate. – Symbols for each of the logic gates are shown below. – These gates output the product, sum or complement of their inputs. Logic gate: AND (product) of two inputs OR (sum) of two inputs NOT (complement) on one input xy, or x  yx + yx’ Operation: Expression:

Introduction to CS Expressions and circuits Any Boolean expression can be converted into a circuit by combining basic gates in a relatively straightforward way. The diagram below shows the inputs and outputs of each gate. The precedences are explicit in a circuit. Clearly, we have to make sure that the hardware does operations in the right order! (x + y’)z + x’

Introduction to CS Boolean operations summary We can interpret high or low voltage as representing true or false. A variable whose value can be either 1 or 0 is called a Boolean variable. AND, OR, and NOT are the basic Boolean operations. We can express Boolean functions with either an expression or a truth table. Every Boolean expression can be converted to a circuit. Next time, we’ll look at how Boolean algebra can help simplify expressions, which in turn will lead to simpler circuits.