Administrivia Assignments Labs Questions?? Class questions – –Goes to dpd and the TA’s Hand in lab assignments.

Slides:



Advertisements
Similar presentations
EET 1131 Unit 7 Arithmetic Operations and Circuits
Advertisements

1 Chapter 2 The Digital World. 2 Digital Data Representation.
CMSC 150 DATA REPRESENTATION CS 150: Mon 30 Jan 2012.
Datorteknik DigitalCircuits bild 1 Combinational circuits Changes at inputs propagate at logic speed to outputs Not clocked No internal state (memoryless)
Chapter 1 — Computer Abstractions and Technology — 1 Lecture 7 Carry look ahead adders, Latches, Flip-flops, registers, multiplexors, decoders Digital.
1 Lecture 20 Sequential Circuits: Latches. 2 Overview °Circuits require memory to store intermediate data °Sequential circuits use a periodic signal to.
Number Representation and Logic Design CS 3220 Fall 2014 Hadi Esmaeilzadeh Georgia Institute of Technology Some slides adopted from.
LOGIC GATES ADDERS FLIP-FLOPS REGISTERS Digital Electronics Mark Neil - Microprocessor Course 1.
EE1A2 Microprocessor Systems & Digital Logic Part I Digital Electronic System Design Dr. T. Collins.
Our First Real System.
COMP3221: Microprocessors and Embedded Systems--Lecture 1 1 COMP3221: Microprocessors and Embedded Systems Lecture 3: Number Systems (I)
1 Foundations of Software Design Lecture 3: How Computers Work Marti Hearst Fall 2002.
Traffic Light Behavior IF A=1 AND B=0 Car Sensors B A.
Administrivia New students? No class Thursday 9/27 Lab Problem Set Favorite browser and why Favorite search engine and why Questions??
Memory; Sequential & Clocked Circuits; Finite State Machines COS 116: 3/25/2008 Sanjeev Arora.
Midterm Review October 23, 2001.
Chapter 10-Arithmetic-logic units
Addition : _________________ Binary Numbers (contd)
Memory. The logic and arithmetic circuits we’ve seen so far have no memory. They just transform input to output. Can we make circuits that remember? Memory.
Arithmetic-Logic Units (ALUs). The four-bit adder The basic four-bit adder always computes S = A + B + CI But by changing what goes into the adder inputs.
Introduction to Registers Being just logic, ALUs require all the inputs to be present at once. They have no memory. ALU AB FS.
Review: Our Friend the Logic Puzzle
CHARACTERS Data Representation. Using binary to represent characters Computers can only process binary numbers (1’s and 0’s) so a system was developed.
CENG 311 Machine Representation/Numbers
How circuits acquire memory: Sequential & Clocked Circuits. COS 116, Spring 2011 Sanjeev Arora.
1 CS 502: Computing Methods for Digital Libraries Lecture 4 Text.
Memory; Sequential & Clocked Circuits; Finite State Machines
Computer Science 1000 Digital Circuits. Digital Information computers store and process information using binary as we’ve seen, binary affords us similar.
Binary Numbers.
1 CS/COE0447 Computer Organization & Assembly Language Chapter 3.
Click to edit Master title style Click to edit Master text styles –Second level Third level –Fourth level »Fifth level 1 Today’s Topics How information.
1 Modified from  Modified from 1998 Morgan Kaufmann Publishers Chapter Three: Arithmetic for Computers citation and following credit line is included:
Levels of Architecture & Language CHAPTER 1 © copyright Bobby Hoggard / material may not be redistributed without permission.
EX_01.1/46 Numeric Systems. EX_01.2/46 Overview Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code,
ECEN2102 Digital Logic Design Lecture 1 Numbers Systems Abdullah Said Alkalbani University of Buraimi.
Computing Theory – F453 Number Systems. Data in a computer needs to be represented in a format the computer understands. This does not necessarily mean.
Binary Numbers. Why Binary? Maximal distinction among values  minimal corruption from noise Imagine taking the same physical attribute of a circuit,
1 Arithmetic Logic Unit ALU. 2 The Bus Concept 3 CPU Building Blocks  Registers (IR, PC, ACC)  Control Unit (CU)  Arithmetic Logic Unit (ALU)
Introduction to State Machine
1 Data Representation Characters, Integers and Real Numbers Binary Number System Octal Number System Hexadecimal Number System Powered by DeSiaMore.
מבנה מחשב תרגול 2. 2 Boolean AND Operation Truth Table Equivalent Gate Different notations:
Computer Science Binary. Binary Code Remember the power supply that is inside your computer and how it sends electricity to all of the components? That.
Data Representation Conversion 24/04/2017.
Outline Binary Addition 2’s complement Binary Subtraction Half Adder
School of Computer and Communication Engineering, UniMAP Mohd ridzuan mohd nor DKT 122/3 - DIGITAL SYSTEM I Chapter.
Sequential Logic Computer Organization II 1 © McQuain A clock is a free-running signal with a cycle time. A clock may be either high or.
Concepts of Engineering and Technology Copyright © Texas Education Agency, All rights reserved.
Arithmetic-logic units1 An arithmetic-logic unit, or ALU, performs many different arithmetic and logic operations. The ALU is the “heart” of a processor—you.
1 Digital Logic Design Lecture 2 More Number Systems/Complements.
CO5023 Latches, Flip-Flops and Decoders. Sequential Circuit What does this do? The OUTPUT of a sequential circuit is determined by the current output.
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.
1 Digital Logic Design Engr. Kashif Shahzad. 2 What’s Course About?  Digital logic, focusing on the design of computers  Stay above transistor level.
09/06/ Data Representation ASCII, Binary Denary Conversion, Integer & Boolean data types.
Explain Half Adder and Full Adder with Truth Table.
Combinational circuits
Object Oriented Programming
Binary Addition and Subtraction
Summary Half-Adder Basic rules of binary addition are performed by a half adder, which has two binary inputs (A and B) and two binary outputs (Carry out.
BEE1244 Digital System and Electronics BEE1244 Digital System and Electronic Chapter 2 Number Systems.
Subtraction The arithmetic we did so far was limited to unsigned (positive) integers. Today we’ll consider negative numbers and subtraction. The main problem.
Data Representation Conversion 05/12/2018.
Fundamentals of Data Representation
CS/COE0447 Computer Organization & Assembly Language
CS/COE0447 Computer Organization & Assembly Language
Electronic Homework Submission and Grading
Unit 10 Arithmetic-logic Units
Binary Numbers.
COMS 361 Computer Organization
Latches The second part of CS231 focuses on sequential circuits, where we add memory to the hardware that we’ve already seen. Our schedule will be very.
Combinational Circuits
Presentation transcript:

Administrivia Assignments Labs Questions?? Class questions – –Goes to dpd and the TA’s Hand in lab assignments – –Goes to a file.

Adding Decimal Numbers ========= We all know that the answer is 1008 but how do we do this?

Adding Decimal Numbers ========= Start from the right 5+3 = 8 and there is no carry

Adding Decimal Numbers ========= 8 Start from the right 5+3 = 8 and there is no carry Next, 6+4 = 10 Write the 0, carry the 1

Adding Decimal Numbers ========= 0 8 Start from the right 5+3 = 8 and there is no carry Next, 6+4 = 10 Write the 0, carry the 1

Adding Decimal Numbers ========= 0 8 Start from the right 5+3 = 8 and there is no carry Next, 6+4 = 10 Write the 0, carry the 1 Finally, = 10 Write the 0, carry the 1

Adding Decimal Numbers ========= Start from the right 5+3 = 8 and there is no carry Next, 6+4 = 10 Write the 0, carry the 1 Finally, = 10 Write the 0, carry the 1

Adding Decimal Numbers ========= Start from the right 5+3 = 8 and there is no carry Next, 6+4 = 10 Write the 0, carry the 1 Finally, = 10 Write the 0, carry the 1 At each stage, take 2 addends (5 and 3 or 6 and 4 or 4 and 5) and a bit telling whether there is a carry and produce a sum bit and a bit telling if there is a carry.

Bad news It is inconvenient to add decimal numbers in a computer –Truth tables are easier than addition tables –The universal method wants to work from truth tables

Bad news/Good News Bad news – It is inconvenient to add decimal numbers in a computer –Truth tables are easier than addition tables –The universal method wants to work from truth tables Good news – the same thing works for binary numbers

Adding Binary Numbers At each stage, take 2 addends and a bit telling whether there is a carry and produce a sum bit and a bit telling if there is a carry.

Adding Binary Numbers (cont.) _______________ = = = =10

Sidebar – what are binary numbers Base 2 rather than base 10 Decimal numbers –We write (1234) 10 to represent a decimal number that has 4 units, 3 tens, 2 hundreds and 1 thousand. –(1234) 10 = 1 x x x x10 0

Sidebar – what are binary numbers Base 2 rather than base 10 Decimal numbers –We write (1234) 10 to represent a decimal number that has 4 units, 3 tens, 2 hundreds and 1 thousand. –(1234) 10 = 1 x x x x10 0 Binary numbers –We write (1001) 2 to represent a decimal number that has 1 unit, 0 2’s, 0 4’s and 1 8. –(1001) 2 = 1 x x x x2 0

Adding Binary Numbers At each stage, take 2 addends and a bit telling whether there is a carry and produce a sum bit and a bit telling if there is a carry.

Adding Binary Numbers At each stage, take 2 addends and a bit telling whether there is a carry and produce a sum bit and a bit telling if there is a carry. We can build a black box to do this addend carry bit in Sum bit carry bit out

Adding Binary Numbers Write the numbers as –X4 X3 X2 X1 X0 –Y4 Y3 Y2 Y1 Y0 Represent the sum as –C Z4 Z3 Z2 Z1 Z0

Adding Binary Numbers Write the numbers as –X4 X3 X2 X1 X0 –Y4 Y3 Y2 Y1 Y0 Represent the sum as –C Z4 Z3 Z2 Z1 Z0 Start with X0, Y0, 0 in, Z0 and C0 out Then X1,Y1,C0 in and Z1 and C1 out. And so on

Adding Binary Numbers At the ith stage ith bit of X ith bit of Y carry bit ith bit of Z carry bit out Abstraction in action -- This is a piece of a carry-ripple adder Universal Circuit

Carry-Ripple Adder Z0 C0 Universal Circuit X0 Y0 Z1 C1 Universal Circuit X1 Y1 Z2 C2 Universal Circuit X2 Y2 X2 X1 X0 Y2 Y1 Y0 ============ C2 Z2 Z1 Z0 0 Fixed at 0

What’s inside the box? Zi Cout Universal Circuit Xi Yi Cin

What’s inside the box? Zi Cout Universal Circuit Xi Yi Cin Do the problem set and find out

Carry ripple adders Useful for some applications Too slow for other –Delay while waiting for the carry to ripple One solution – add larger blocks –Details on the homework assignment

Arithmetic Logical Unit (ALU) This is the part of the CPU that does arithmetic and comparison operations We’ve built a piece of the ALU With abstraction, we could build the other parts –Multiplication/subtraction/division –Comparison Then we would write a language to let the user talk to the ALU (programming)

Pause Questions?? How to build the other parts of the ALU? –Use abstraction Back to representing information

Representing information How do we represent characters? –How many characters might we want to represent? –What characters might we want to represent?

Representing information How do we represent characters? –How many characters might we want to represent? –What characters might we want to represent? A-Z 26 A-Z and a-z 52 All the keys on my keyboard 104 Maybe a power of 2? 128 Maybe an even power of 2? 256 Maybe an even bigger power of 2?65536

Representing characters ASCII is the American Standard Code for Information Interchange. It is a 7-bit code. Many 8-bit codes contain ASCII as their lower half The ASCII standard was published by the United States of America Standards Institute (USASI) in 1968.

Unicode Universal Character Set (UCS) contains all characters of all other character set standards. It also guarantees round-trip compatibility, i.e., conversion tables can be built such that no information is lost when a string is converted from any other encoding to UCS and back. UCS contains the characters required to represent almost all known languages. This includes apart from the many languages which use extensions of the Latin script also the following scripts and languages: Greek, Cyrillic, Hebrew, Arabic, Armenian, Gregorian, Japanese, Chinese, Hiragana, Katakana, Korean, Hangul, Devangari, Bengali, Gurmukhi, Gujarati, Oriya, Tamil, Telugu, Kannada, Malayam, Thai, Lao, Bopomofo, and a number of others. Work is going on to include further scripts like Tibetian, Khmer, Runic, Ethiopian, Hieroglyphics, various Indo-European languages, and many others. It’s intended to use 31 bits (32768 possible characters)

What do we do in practice Problems –Bits represent too little – too many are needed –Decimal numbers don’t translate well into bits So, –Group into blocks of 4 and 8 bits 8 bits = 256 characters, holds ASCII 8 bits make 1 byte – things are organized into bytes 4 bits make 1 nibble

Shorthand: Hexadecimal ABCDEF89ABCDEF

Sidebar – what are hexadecimal numbers Base 16 rather than base 10 Decimal numbers –We write (1234) 10 to represent a decimal number that has 4 units, 3 tens, 2 hundreds and 1 thousand. –(1234) 10 = 1 x x x x10 0 Hexadecimal numbers –We write (2AC4) 16 to represent a decimal number that has 1 units, 12 16’s, ’s and 2 65,536’s –(2AC4) 16 = 1 x x x x16 0

Hexadecimal We can add numbers –1+1=2, 2+2=4, 4+4=8, 4+8=C, 2+8=A, … We can combine 2 hexadecimal numbers to make a byte. It’s easier to read than 0’s and 1’s In ASCII –hex 41 through 5A represent A to Z –Hex 61 through 7A represent a to z

Memory

Logic circuits we’ve seen so far have no memory. They just transform input to output. Can we make logic circuits that remember?

The Stubborn Guy Matt really likes Sue, but he doesn’t like changing his mind… so: Matt decides to go to the party if Sue decides to go OR if he (Matt) already feels like going.

The Stubborn Guy: Feedback Matt decides to go to the party if Sue decides to go OR if he (Matt) already feels like going. OR Sue Matt Feedback Wire

The Stubborn Guy: Feedback Matt decides to go to the party if Sue decides to go OR if he (Matt) already feels like going. If Sue decides to go... OR Sue Matt 1

The Stubborn Guy: Feedback Matt decides to go to the party if Sue decides to go OR if he (Matt) already feels like going. If Sue decides to go, Matt will go. OR Sue Matt 1 1 1

The Stubborn Guy: Feedback Matt decides to go to the party if Sue decides to go OR if he (Matt) already feels like going. If Sue changes her mind… OR Sue Matt 0 1 1

The Stubborn Guy: Feedback Matt decides to go to the party if Sue decides to go OR if he (Matt) already feels like going. If Sue changes her mind, Matt will still go! Once he decides to go, we can’t ever get Matt to change his mind. OR Sue Matt 0 1 1

Enter Rita Matt doesn’t like Rita Matt decides to go to the party if Sue decides to go OR if he (Matt) already feels like going, UNLESS Rita decides to go.

Enter Rita Matt doesn’t like Rita Matt decides to go to the party if Sue decides to go OR: If he (Matt) already feels like going AND Rita decides NOT to go.

Enter Rita Matt doesn’t like Rita Matt decides to go to the party if Sue decides to go OR: If he (Matt) already feels like going AND Rita decides NOT to go. OR AND Sue Rita Matt Feedback Wire

Enter Rita Matt doesn’t like Rita Matt decides to go to the party if Sue decides to go OR: If he (Matt) already feels like going AND Rita decides NOT to go. OR AND Sue Rita Matt

Enter Rita Matt doesn’t like Rita Matt decides to go to the party if Sue decides to go OR: If he (Matt) already feels like going AND Rita decides NOT to go. OR AND Sue Rita Matt

Enter Rita Matt doesn’t like Rita Matt decides to go to the party if Sue decides to go OR: If he (Matt) already feels like going AND Rita decides NOT to go. OR AND Sue Rita Matt

Enter Rita Matt doesn’t like Rita Matt decides to go to the party if Sue decides to go OR: If he (Matt) already feels like going AND Rita decides NOT to go. OR AND Sue Rita Matt

Enter Rita Matt doesn’t like Rita Matt decides to go to the party if Sue decides to go OR: If he (Matt) already feels like going AND Rita decides NOT to go. OR AND Sue Rita Matt 0 – nothing changes

Enter Rita Matt doesn’t like Rita Matt decides to go to the party if Sue decides to go OR: If he (Matt) already feels like going AND Rita decides NOT to go. OR AND Sue Rita Matt

Enter Rita Matt doesn’t like Rita Matt decides to go to the party if Sue decides to go OR: If he (Matt) already feels like going AND Rita decides NOT to go. OR AND Sue Rita Matt

Enter Rita Matt doesn’t like Rita Matt decides to go to the party if Sue decides to go OR: If he (Matt) already feels like going AND Rita decides NOT to go. OR AND Sue Rita Matt

Enter Rita Matt doesn’t like Rita Matt decides to go to the party if Sue decides to go OR: If he (Matt) already feels like going AND Rita decides NOT to go. OR AND Sue Rita Matt

Enter Rita Matt doesn’t like Rita Matt decides to go to the party if Sue decides to go OR: If he (Matt) already feels like going AND Rita decides NOT to go. OR AND Sue Rita Matt

Enter Rita Matt doesn’t like Rita Matt decides to go to the party if Sue decides to go OR: If he (Matt) already feels like going AND Rita decides NOT to go. OR AND Sue Rita Matt

Enter Rita Matt doesn’t like Rita Matt decides to go to the party if Sue decides to go OR: If he (Matt) already feels like going AND Rita decides NOT to go. OR AND Sue Rita Matt

The Flip-Flop OR AND Set Reset M M becomes 1 if Set is turned on M becomes 0 if Reset is turned on Otherwise (if Set and Reset are both 0), M just remembers its value

The Flip-Flop M becomes 1 if Set is turned on M becomes 0 if Reset is turned on Otherwise (if Set and Reset are both 0), M just remembers its value S R M

AND The Data Flip-Flop Nothing happens unless Write = 1 S R M D Write

AND The Data Flip-Flop Nothing happens unless Write = 1 If Write = 1, then M becomes set to D Once Write = 0 again, M just keeps its value. (It ignores D.) S R M D Write

AND Using a Data Flip-Flop Initially, Write = 0. Let’s say M = 1. S R M D Write

AND Using a Data Flip-Flop Initially, Write = 0. Let’s say M = 1. First, set D to desired value, say 0. S R M D Write

AND Using a Data Flip-Flop Initially, Write = 0. Let’s say M = 1. First, set D to desired value, say 0. Then, set Write to 1. S R M D Write

AND Using a Data Flip-Flop Initially, Write = 0. Let’s say M = 1. First, set D to desired value, say 0. Then, set Write to 1. This causes M to be reset to 0. S R M D Write

AND Using a Data Flip-Flop Initially, Write = 0. Let’s say M = 1. First, set D to desired value, say 0. Then, set Write to 1. This causes M to be reset to 0. Finally set Write back to 0. Now D irrelevant. S R M D Write ? 1

The Data Flip-Flop If Write = 0, M just keeps its value. (It ignores D.) If Write = 1, then M becomes set to D D Write M

A subtle problem When Write = 1, then M = D. If we have some feedback between M and D, then circuit could go haywire. D Write M ??

A subtle problem For example, suppose NOT gate connects M and D. When Write = 1, M and D keep changing. We have no control. D Write M NOT 1 ? ?

A subtle problem We want to control the feedback, so that each time we set Write to 1 and then back to 0, M stores only the last value of D (In this case, M should invert itself once each time we set Write to 1 and back to 0) D Write M NOT 1 ? ?

“Airlock” Flip-Flop D1D1 W1W1 M1M1 D0D0 W0W0 M0M0 “Outer door” “Inner door” Write Two-Stage System to prevent feedback loop. D M

“Airlock” Flip-Flop D1D1 W1W1 M1M1 D0D0 W0W0 M0M0 “Outer door” “Inner door” Write We start with Write = 0. Let’s say D is always NOT M. Start with D = 0, M = 1. D M

“Airlock” Flip-Flop D1D1 W1W1 M1M1 D0D0 W0W0 M0M0 “Outer door” “Inner door” Write We start with Write = 0. Let’s say D is always NOT M. Start with D = 0, M = 1. D M

“Airlock” Flip-Flop D1D1 W1W1 M1M1 D0D0 W0W0 M0M0 “Outer door” “Inner door” Write Want to store D in memory. Set Write to 1 D M

“Airlock” Flip-Flop D1D1 W1W1 M1M1 D0D0 W0W0 M0M0 “Outer door” “Inner door” Write Want to store D in memory. Set Write to 1 “Outer” flip-flop sets M 0 = D 0 = 0 “Inner” flip-flop ignores D 1 since W 1 = 0 D M

“Airlock” Flip-Flop D1D1 W1W1 M1M1 D0D0 W0W0 M0M0 “Outer door” “Inner door” Write Now, set Write back to 0 D M

“Airlock” Flip-Flop D1D1 W1W1 M1M1 D0D0 W0W0 M0M0 “Outer door” “Inner door” Write Now, set Write back to 0 Now “Inner” flip-flop sets M = D 1 = 0 D M

“Airlock” Flip-Flop D1D1 W1W1 M1M1 D0D0 W0W0 M0M0 “Outer door” “Inner door” Write Because of feedback, D might change to (NOT M), which is 1 But Write = 0, so “Outer” flip-flop ignores D, and so M 0 stays 0. D M

“Airlock” Flip-Flop D1D1 W1W1 M1M1 D0D0 W0W0 M0M0 “Outer door” “Inner door” Write So memory does not change until we “toggle” Write. (“toggle” means change from 0 to 1 or vice versa) D M

“Airlock” Flip-Flop D1D1 W1W1 M1M1 D0D0 W0W0 M0M0 “Outer door” “Inner door” Write This is Real Memory! D M

Memory “Register”: 4 bits D M W D M W D M W D M W Write Data 1 Data 2 Data 3 Data 4

Review We have used the Universal method to build –ALU –Memory Next steps –State machines to computer with memory –Building the computer –Writing a program to use the computer