DIGITAL CIRCUITS David Kauchak CS52 – Fall 2015.

Slides:



Advertisements
Similar presentations
Combinational Circuits
Advertisements

Tutorial: Wednesday Week 3 Hand in on Monday, Do the questions for tutorials 1 & 2 at the back of the course notes (answers to tutorial 3 will be published.
Hardware Implementations Gates and Circuits. Three Main Gates  AND  OR  NOT.
Addition (2). Outline Full Adder 3-Bit Adder 2’s Complement Subtraction.
Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Arithmetic See: P&H Chapter 3.1-3, C.5-6.
ECE 331 – Digital System Design
Computer ArchitectureFall 2008 © August 25, CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (1)
Design of Arithmetic Circuits – Adders, Subtractors, BCD adders
Homework Reading Machine Projects Labs
ECE 301 – Digital Electronics
ECE 301 – Digital Electronics
ENGIN112 L14: Binary Adder Subtractor October 3, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 14 Binary Adders and Subtractors.
Computer ArchitectureFall 2007 © August 29, 2007 Karem Sakallah CS 447 – Computer Architecture.
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
Calculator Lab Overview Note: Slides Updated 10/8/12
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.
Logic Design CS221 1 st Term combinational circuits Cairo University Faculty of Computers and Information.
Binary Numbers.
Binary Addition CSC 103 September 17, 2007.
Basic Arithmetic (adding and subtracting)
Binary Addition Section 4.5. Binary Addition Example.
+ CS 325: CS Hardware and Software Organization and Architecture Combinational Circuits 1.
Chapter 6-1 ALU, Adder and Subtractor
Topic: Arithmetic Circuits Course: Digital Systems Slide no. 1 Chapter # 5: Arithmetic Circuits.
1 Adders & Subtractors Adders –An adder is a combinational logic circuit that performs the addition of 2 binary numbers (A & B) to generate the sum (S)
CSE 241 Computer Organization Lecture # 9 Ch. 4 Computer Arithmetic Dr. Tamer Samy Gaafar Dept. of Computer & Systems Engineering.
Basic Arithmetic (adding and subtracting)
Lecture 9 Topics: –Combinational circuits Basic concepts Examples of typical combinational circuits –Half-adder –Full-adder –Ripple-Carry adder –Decoder.
Numbers and Arithmetic Hakim Weatherspoon CS 3410, Spring 2013 Computer Science Cornell University See: P&H Chapter , 3.2, C.5 – C.6.
Instructor: Alexander Stoytchev CprE 281: Digital Logic.
درس مدارهای منطقی دانشگاه قم مدارهای منطقی محاسباتی تهیه شده توسط حسین امیرخانی مبتنی بر اسلایدهای درس مدارهای منطقی دانشگاه.
4. Computer Maths and Logic 4.2 Boolean Logic Logic Circuits.
Digital Logic. 2 Abstractions in CS (gates) Basic Gate: Inverter IO IO GNDI O Vcc Resister (limits conductivity) Truth Table.
Logic Design CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
Lecture 18: Hardware for Arithmetic Today’s topic –Intro to Boolean functions (Continued) –Designing an ALU 1.
Half Adder & Full Adder Patrick Marshall. Intro Adding binary digits Half adder Full adder Parallel adder (ripple carry) Arithmetic overflow.
1 CS 151: Digital Design Chapter 4: Arithmetic Functions and Circuits 4-1,2: Iterative Combinational Circuits and Binary Adders.
1 Ethics of Computing MONT 113G, Spring 2012 Session 5 Binary Addition.
Logic and computers 2/6/12. Binary Arithmetic /6/ Only two digits: the bits 0 and 1 (Think: 0 = F, 1.
COMP541 Arithmetic Circuits
N, Z, C, V in CPSR with Adder & Subtractor Prof. Taeweon Suh Computer Science Education Korea University.
Logic Gates Informatics INFO I101 February 3, 2003 John C. Paolillo, Instructor.
Kavita Bala CS 3410, Spring 2014 Computer Science Cornell University.
69 Decimal (Base 10) Numbers n Positional system - each digit position has a value n 2534 = 2*1, * *10 + 4*1 n Alternate view: Digit position.
Computer Architecture
1 IKI20210 Pengantar Organisasi Komputer Kuliah No. 23: Aritmatika 18 Desember 2002 Bobby Nazief Johny Moningka
Logic Design CS221 1 st Term combinational circuits Cairo University Faculty of Computers and Information.
1 Fundamentals of Computer Science Combinational Circuits.
1 Lecture 14 Binary Adders and Subtractors. 2 Overview °Addition and subtraction of binary data is fundamental Need to determine hardware implementation.
Gates AND, OR, NOT NAND, NOR Combinational logic No memory A set of inputs uniquely and unambiguously specifies.
Number Representation (Part 2) Computer Architecture (Fall 2006)
1 Ethics of Computing MONT 113G, Spring 2012 Session 4 Binary Addition.
Computer Arthmetic Chapter Four P&H. Data Representation Why do we not encode numbers as strings of ASCII digits inside computers? What is overflow when.
MicroProcessors Lec. 4 Dr. Tamer Samy Gaafar. Course Web Page —
President UniversityErwin SitompulDigital Systems 7/1 Lecture 7 Digital Systems Dr.-Ing. Erwin Sitompul President University
LOGIC CIRCUITLOGIC CIRCUIT. Goal To understand how digital a computer can work, at the lowest level. To understand what is possible and the limitations.
ETE 204 – Digital Electronics Combinational Logic Design Single-bit and Multiple-bit Adder Circuits [Lecture: 9] Instructor: Sajib Roy Lecturer, ETE,ULAB.
Arithmetic Circuits I. 2 Iterative Combinational Circuits Like a hierachy, except functional blocks per bit.
Gunjeet Kaur Dronacharya Group of Institutions. Binary Adder-Subtractor A combinational circuit that performs the addition of two bits is called a half.
David Kauchak CS 52 – Spring 2017
Computer Arthmetic Chapter Four P&H.
Combinational Circuits
ECE 3130 Digital Electronics and Design
5. Combinational circuits
Digital Logic.
Logic Gates.
Digital Logic.
Instructor: Alexander Stoytchev
Carryout bit? Carryout bit is ‘1’ also on four cases. When a, b and carryin are 110, 101, 011, 111. Does it mean that we need a similar circuit as sum?
Presentation transcript:

DIGITAL CIRCUITS David Kauchak CS52 – Fall 2015

Admin Assignment 4 due Monday at 11:59pm Assignment 5 posted soon  due Friday Oct. 23rd, at 5pm CS lunch today!

Midterm Average: Top quartile: 26 Top half (median): 24.6 Bottom quartile: 21.4

Diving into your computer

Normal computer user

After intro CS

After 5 weeks of cs52

What now?

One last note on CS41B memory address instructions (assembly code) binary representation of code How do we get this?

Encoding assembly instructions opcode dest src0src1

What now?

Review: binary addition ? Do the binary addition, making sure to keep track of the carries. Assume unsigned numbers for now. +

Review: binary addition Just to be sure, what are these numbers in decimal? +

Review: binary addition We saw before, that we can view this problem recursively. How? +

handle a digit at a time

generate two pieces of information -output bit -carry bit

A recursive component in1in2 out carry-out carry-in

Adding with components in1in2 out carry-out in1in2 out carry-out carry-in in1in2 out carry-out carry-in in1in2 out carry-out carry-in

Adding with components in1in2 out carry-out in1in2 out carry-out carry-in in1in2 out carry-out carry-in in1in2 out carry-out carry-in ? ? +

Adding with components in1in2 out carry-out in1in2 out carry-out carry-in in1in2 out carry-out carry-in in1in2 out carry-out carry-in ? ?

Adding with components in1in2 out carry-out in1in2 out carry-out carry-in in1in2 out carry-out carry-in in1in2 out carry-out carry-in ? ?

Adding with components in1in2 out carry-out in1in2 out carry-out carry-in in1in2 out carry-out carry-in in1in2 out carry-out carry-in ? ?

Adding with components in1in2 out carry-out in1in2 out carry-out carry-in in1in2 out carry-out carry-in in1in2 out carry-out carry-in

Implementing the component in1in2 out carry-out carry-in What goes on inside the component?

Implementing the component in1in2 out carry-out carry-in Current implementation uses addition!

Implementing the component in1in2 out carry-out carry-in in1in2carry-inoutcarry- out What are the outputs?

Implementing the component in1in2 out carry-out carry-in in1in2carry-inoutcarry- out

Another implementation -Don’t use addition anymore -Translated the problem into a boolean logic problem

What are some boolean operators? ABA and BA or Bnot A

What are some boolean operators? ABA and BA or Bnot AA nand BA nor BA xor B

Gates Gates have inputs and outputs  values are 0 or 1 Are hardware components!

Gates as hardware

Utilizing gates ? ABA and BA or Bnot AA nand BA nor BA xor B

Utilizing gates ABA and BA or Bnot AA nand BA nor BA xor B

Utilizing gates ? ABA and BA or Bnot AA nand BA nor BA xor B

Utilizing gates When is this circuit 1? ABA and BA or Bnot AA nand BA nor BA xor B

Utilizing gates in1in2in3OUT

Designing more interesting circuits in1in2in3OUT ABA and BA or Bnot AA nand BA nor BA xor B Design a circuit for this

Designing more interesting circuits in1in2in3OUT

Back to addition… in1in2 out carry-out carry-in in1in2carry-incarry- out sum

A half-adder: no carry-in ABcarrysum

A half-adder: no carry-in ABA and BA or Bnot AA nand BA nor BA xor B Design a circuit for this Hint: solve each output bit independently ABcarrysum

A half-adder: no carry-in low order bit of A+B higher order bit of A+B ABcarrysum

Implementing a full adder

low order bit of A+B high order bit of A+B low order bit of A+B+C high order bit of A+B+C Can I ever get a carry from both half adders?

Implementing the component in1in2 out carry-out carry-in What goes on inside the component?

Implementing the component A B sum carry-out carry-in

Ripple carry adder To implement an n-bit adder, we chain together n full- adders, each adder handles one bit position A0A0 B 0 out carry-out A1A1 B 1 out carry-out carry-in A2A2 B2B2 out carry-out carry-in A3A3 B3B3 out carry-out carry-in A = A 3 A 2 A 1 A 0 B = B 3 B 2 B 1 B 0 Adder for adding 4-bit numbers ?

Ripple carry adder To implement an n-bit adder, we chain together n full- adders, each adder handles one bit position A0A0 B 0 out carry-out A1A1 B 1 out carry-out carry-in A2A2 B2B2 out carry-out carry-in A3A3 B3B3 out carry-out carry-in A = A 3 A 2 A 1 A 0 B = B 3 B 2 B 1 B 0 Adder for adding 4-bit numbers 0

Signed addition ? Do the binary addition, making sure to keep track of the carries. Assume signed numbers for now. +

Signed addition Is that right? What numbers are these? throw away last carry bit +

Signed addition Ripple carry adder will work for signed and unsigned numbers +

Subtraction We can solve this doing addition

Subtraction flip bits and add Do addition!

Ripple carry adder/subtractor FA D = 0: addition D = 1: subtraction Why does this work?

Ripple carry adder/subtractor If D = 0  Carry in for first adder = 0  B i XOR 0 = B i If D = 1  Carry in for first adder = 1 (+1 to sum)  B i XOR 1 = NOT B i (flip all the bits of B) FA

C, N, Z and V bits In addition to the sum, we often also calculate some other useful information:  C: carry out bit of the adder  Z: 1 if the total result is zero, 0 otherwise  N: sign bit of the result  V: if there was “signed overflow”: the result cannot be represented with the number of bits we’re using What are the cases where signed overflow can occur?

V bit V: if there was “signed overflow”: the result cannot be represented with the number of bits we’re using -Adding two positive numbers (too big positive) -Subtracting a negative number from a positive number (too big positive) -Adding two negative numbers (too big negative) -Subtracting a positive number from a negative number (too big negative)

Detecting overflow Add these (as signed numbers). Does overflow occur?

Detecting overflow Yes. How do we detect it?

Detecting overflow Added two positive numbers and got a negative - In general: if the sign bits are the same (of the numbers we end up adding), but the higher order bit of result is different = overflow

Detecting overflow Subtract these (as signed numbers). Does overflow occur?

Detecting overflow Yes. How do we detect it?

Detecting overflow Subtracted a negative number from a positive, should have been positive - In general: if the sign bits are the different (of the numbers we end up subtracting), but the higher order bit of result is different = overflow

Detecting overflow Subtracted a negative number from a positive - In general: if the sign bits are the same (of the numbers we end up adding), but the higher order bit of result is different = overflow

Python basics