CS/COE 0447 Example Problems for Exam 2 Spring 2011

Similar documents
CS/COE 0447 Example Problems for Exam 2 Fall 2010

COMP 303 Computer Architecture Lecture 6

4. Write a sum-of-products representation of the following circuit. Y = (A + B + C) (A + B + C)

Week 7: Assignment Solutions

Review. Steps to writing (stateless) circuits: Create a logic function (one per output)

CS/COE0447: Computer Organization

CS/COE0447: Computer Organization

Chapter 3 Arithmetic for Computers

Combinational Circuits

Number Systems and Computer Arithmetic

DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS

Chapter 3 Arithmetic for Computers. ELEC 5200/ From P-H slides

Computer Architecture Set Four. Arithmetic

EE292: Fundamentals of ECE

EECS150 - Digital Design Lecture 13 - Combinational Logic & Arithmetic Circuits Part 3

Computer Organization and Structure. Bing-Yu Chen National Taiwan University

Arithmetic Processing

CPS 104 Computer Organization and Programming

Binary Adders: Half Adders and Full Adders

Timing for Ripple Carry Adder

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 3. Arithmetic for Computers

COMPUTER ARITHMETIC (Part 1)

ECE260: Fundamentals of Computer Engineering

361 div.1. Computer Architecture EECS 361 Lecture 7: ALU Design : Division

McGill University Faculty of Engineering FINAL EXAMINATION Fall 2007 (DEC 2007)

ECE 2030D Computer Engineering Spring problems, 5 pages Exam Two 8 March 2012

The ALU consists of combinational logic. Processes all data in the CPU. ALL von Neuman machines have an ALU loop.

Boolean Algebra. Chapter 3. Boolean Algebra. Chapter 3 Arithmetic for Computers 1. Fundamental Boolean Operations. Arithmetic for Computers

carry in carry 1101 carry carry

Integer Multiplication and Division

Arithmetic Logic Unit

Homework 3. Assigned on 02/15 Due time: midnight on 02/21 (1 WEEK only!) B.2 B.11 B.14 (hint: use multiplexors) CSCI 402: Computer Architectures

ECE 2030B 1:00pm Computer Engineering Spring problems, 5 pages Exam Two 10 March 2010

UNCA CSCI 255 Exam 1 Spring February, This is a closed book and closed notes exam. It is to be turned in by 1:45 PM.

Organisasi Sistem Komputer

More complicated than addition. Let's look at 3 versions based on grade school algorithm (multiplicand) More time and more area

Addition and multiplication

ECEN 468 Advanced Logic Design

Arithmetic Logic Unit. Digital Computer Design

A complement number system is used to represent positive and negative integers. A complement number system is based on a fixed length representation

LECTURE 4. Logic Design

Module 2: Computer Arithmetic

Chapter 3: part 3 Binary Subtraction

Tailoring the 32-Bit ALU to MIPS

Chapter 4 Arithmetic Functions

1. Mark the correct statement(s)

Slide Set 1. for ENEL 339 Fall 2014 Lecture Section 02. Steve Norman, PhD, PEng

Chapter 3: Arithmetic for Computers

CHW 261: Logic Design

ECE 30 Introduction to Computer Engineering

BINARY SYSTEM. Binary system is used in digital systems because it is:

Chapter 5 : Computer Arithmetic

Logic Design: Part 2

Lecture 6: Signed Numbers & Arithmetic Circuits. BCD (Binary Coded Decimal) Points Addressed in this Lecture

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

CS 5803 Introduction to High Performance Computer Architecture: Arithmetic Logic Unit. A.R. Hurson 323 CS Building, Missouri S&T

Code No: R Set No. 1

CPE 335 Computer Organization. MIPS Arithmetic Part I. Content from Chapter 3 and Appendix B

By, Ajinkya Karande Adarsh Yoga

Divide: Paper & Pencil

Microcomputers. Outline. Number Systems and Digital Logic Review

CARLETON UNIVERSITY. Laboratory 2.0

Combinational Logic Circuits

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

Computer Organisation CS303

EE260: Logic Design, Spring n Integer multiplication. n Booth s algorithm. n Integer division. n Restoring, non-restoring

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

Integer Multiplication. Back to Arithmetic. Integer Multiplication. Example (Fig 4.25)

CSE 141 Computer Architecture Summer Session Lecture 3 ALU Part 2 Single Cycle CPU Part 1. Pramod V. Argade

Logic Gates and Boolean Algebra ENT263

Chapter 5: Computer Arithmetic. In this chapter you will learn about:

Principles of Computer Architecture. Chapter 3: Arithmetic

Lecture #21 March 31, 2004 Introduction to Gates and Circuits

Review of Last lecture. Review ALU Design. Designing a Multiplier Shifter Design Review. Booth s algorithm. Today s Outline

Lecture 8: Addition, Multiplication & Division

Integer Encoding and Manipulation

Math in MIPS. Subtracting a binary number from another binary number also bears an uncanny resemblance to the way it s done in decimal.

Learning Objectives. Binary over Decimal. In this chapter you will learn about:

DLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 1 DLD P VIDYA SAGAR

Basic Arithmetic (adding and subtracting)

9 Multiplication and Division

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

Chapter 10 - Computer Arithmetic

Chapter 3 Arithmetic for Computers (Part 2)

Department of Electrical and Computer Engineering University of Wisconsin - Madison. ECE/CS 352 Digital System Fundamentals.

MIPS Integer ALU Requirements

Bawar Abid Abdalla. Assistant Lecturer Software Engineering Department Koya University

Introduction to Digital Logic Missouri S&T University CPE 2210 Multipliers/Dividers

DLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 3 DLD P VIDYA SAGAR

CPE300: Digital System Architecture and Design

Arithmetic Operations

Arithmetic Logic Unit (ALU)

(+A) + ( B) + (A B) (B A) + (A B) ( A) + (+ B) (A B) + (B A) + (A B) (+ A) (+ B) + (A - B) (B A) + (A B) ( A) ( B) (A B) + (B A) + (A B)

Computer Organization and Levels of Abstraction

NUMBER OPERATIONS. Mahdi Nazm Bojnordi. CS/ECE 3810: Computer Organization. Assistant Professor School of Computing University of Utah

Read this before starting!

Advanced Computer Architecture-CS501

INF2270 Spring Philipp Häfliger. Lecture 4: Signed Binaries and Arithmetic

Outline. EEL-4713 Computer Architecture Multipliers and shifters. Deriving requirements of ALU. MIPS arithmetic instructions

Chapter 5: Computer Arithmetic

Transcription:

CS/COE 0447 Example Problems for Exam 2 Spring 2011 1) Show the steps to multiply the 4-bit numbers 3 and 5 with the fast shift-add multipler. Use the table below. List the multiplicand (M) and product (P) in binary. In the field step, write ADD when the multiplicand is added. Write SHIFT to indicate when the product is shifted. In the iteration Start write the initial values for the mutiplicand and product. You may not need all steps (rows) in the table. Iter. Multiplicand (M) Product (P) Step Start 0011 0000 0101 set product=0s:r 1 0011 0011 0101 0001 1010 2 0011 0001 1010 0000 1101 3 0011 0011 1101 0001 1110 4 0011 0001 1110 0000 1111 lsb=1 => +M shift right 1 lsb=0 => +0 shift right 1 lsb=1 => +M shift right 1 lsb=0 => +0 shift right 1 5 NOT NEEDED 6 NOT NEEDED 7 NOT NEEDED 1 of 9

2) Show the steps to multiply an 6-bit number 17 and 3 with Booth s algorithm. Use the table below. List the multiplicand and product in binary. In the field step, write ADD, SUB, or NO OP to indicate which operation is done on each iteration. Iter. Multiplicand (M) Product (P) Step Start 010001 (negation is 101111) 000000 000011 0 set P, with pad bit 1 010001 101111 000011 0 110111 100001 1 2 010001 110111 100001 1 111011 110000 1 3 010001 001100 110000 1 000110 011000 0 4 010001 000110 011000 0 000011 001100 0 5 010001 000011 001100 0 000001 100110 0 6 010001 000001 100110 0 000000 110011 0 7 NOT NEEDED Final answer is: 000000 110011 lsbs=10: -M lsbs=11: +0 lsbs=01: +M lsbs=00: +0 lsbs=00: +0 lsbs=00: +0 N/A 3) Explain how the fast shift-add multiply improves over the original slow shift-add multiply. Be sure to indicate what hardware changes make the fast version faster than the slow version. combines registers, reduces size of ALU & does 3-steps in paralle. last two make it fast. 2 of 9

4) Consider restoring division with hardware design #3 (the design with a 32-bit divisor and a 64-bit remainder register that holds the remainder and quotient). Assume the quotient and divisor are 5 bit unsigned numbers. Fill in the table below for 17 / 3. For each step, indicate what shift, subtraction, and addition operations are done in the Step Notes column. Iteration Divisor (D) Remainder (R) Notes Init 00011 00000 10001 Initial values 1 00011 11101 10001 00001 00010 R<0: +D, left shift 0 into lsb 2 00011 11110 00010 00010 00100 R<0: +D, left shift 0 into lsb 3 00011 11111 00100 00100 01000 R<0: +D, left shift 0 into lsb 4 00011 00001 01000 00010 10001 R>0: left shift 1 into lsb 5 00011 11111 10001 00101 00010 R<0: +D, left shift 0 into lsb 6 00011 00010 00010 00100 00101 R>0: left shift 1 into lsb Done 00011 00010 00101 Right shift the left half of R by 1 Result = 5, Remainder = 2 5) Suppose we want to do the computation S = A + B. A and B are positive 2 s complement 8- bit binary numbers. Give a boolean expression that indicates whether there was an overflow when these numbers are added. To represent a certain bit i in A, B or S, use A i, B i or S i. E.g., bit position 3 in A is A 3. Assume the bits are numbered 0 to 7 (right to left). overflow happens when input values have same sign but output has different one Overflow = (A 7 B 7 S 7 ) OR ( A 7 B 7 S7) 6) Give the negation in one s complement binary representation (5 bit numbers) for the decimal numbers: 5d Negation (in one s complement binary) 11010 10d Negation (in one s complement binary) 10101-15d Negation (in one s complement binary) 01111 3 of 9

7) Give the negation in two s complement binary representation (5 bits) for the decimal numbers: 11d Negation (in two s complement binary) 10101 15d Negation (in two s complement binary) 10001-13d Negation (in two s complement binary) 01101 8) Give Booth s encoding for the 8-bit numbers: -19d Booth s encoding 00-11 0-11-1-19 in two s comp: 1110 1101-19 in two s comp with 0 pad: 1110 1101 0 Booth s encoding: 00-11 0-11-1 check yourself: -2 5 +2 4-2 2 +2 1-2 0 = -32+16-4+2-1=-19 27d Booth s encoding 0010-110-1 27 in two s comp: 0001 1011 27 in two s comp with 0 pad: 0001 1011 0 Booth s encoding: 0010-110-1 check yourself: 2 5-2 3 +2 2-2 0 = 32-8 + 4-1 = 27 62d Booth s encoding 0100 00-10 62 in two s comp: 0011 1110 62 in two s comp with 0 pad: 0011 1110 0 Booth s encoding: 0100 00-10 check yourself: 2 6-2 1 = 62 9) Give two reasons to use Booth s algorithm (encoding) to improve the multiplication hardware. 1. it can reduce the number of addition operations 2. it handles signed multiplication 10) Floating-point numbers represent a richer set of values than integer numbers. Nevertheless, processors support integer numbers and programs frequently use them. What primary advantage does integer numbers and operations offer over floating point numbers and operations? integer operations are significantly faster, programs frequently use discrete values thus, using integer for common operations/values offers a big performance benefit. 4 of 9

11) Using 1-bit adders, draw the circuit for a 4-bit ripple-carry addition unit. See book / class lecture slides. 12) Using 1-bit adders and 1-bit inverters (i.e., the not of a bit), draw a circuit for a 4-bit ripplecarry subtract unit. See book / class lecture slides (drawn on the board during class). 13) Consider the sum of products boolean equation: A BC + ABC + A B C. Give the truth table representation for this boolean equation. (A is NOT A and + is OR) This truth table has eight rows with three input values (A, B, C) and one output. Label the rows by counting in binary from 0 to 7. Row 011 (i.e., where A=0, B=1, C=1) has a 1 in the output, row 111 has a 1 in the output, and 001 has a 1 in the output. All other output values are 0. 14) Suppose you want to design a hardware circuit that has two inputs A and B, and one output O. The output O has the value 1 when exactly one input (A/B) is a 1. Give the truth table for this circuit design. INPUTS OUTPUT A B O 0 0 0 0 1 1 1 0 1 1 1 0 (this is exclusive-or!) 15) For question 15, what is the boolean equation for the truth table? O = A B + AB 16) Here is a truth table. What is the boolean equation for O? INPUTS OUTPUT A B C O 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 1 1 0 1 0 1 1 0 0 1 1 1 0 O=A B C + A BC + AB C 5 of 9

17) Let s consider a 4-bit adder. If each 1-bit adder takes 2ns to compute an output (1-bit result and carry-out), how long does it take to compute the full 4-bit result? it takes 4 * 2ns = 8ns (Note: We ll have more to say about this soon.) 18) Consider problem 17 again. This time, let s compute the time for subtraction (A-B). Suppose the 1-bit inverter (used to complement the B input of each 1-bit adder) takes 1ns. How long does it take to compute an answer with this subtraction unit? (Be careful: Think about whether the invert operations can be done simultaneously.) it takes 1ns additional for the first invert (9ns total); the rest are done in parallel. the first choice is actually faster, so I d pick this one, assuming costs are the same. 19) Consider the logic function: F = A BC + A BC + AB C + ABC. Draw a K-map for this function, circle the minimum terms (1s), and give the simplified Boolean equation. AB C 0 1 00 01 1 1 11 1 10 1 Simplified form: F = A B + AC 20) Given the K-map below, what is the simplified Boolean equation? CD 00 01 11 10 00 0 0 0 0 AB 01 0 0 0 0 11 0 1 1 0 10 0 1 1 0 F = AD 6 of 9

21) Given the K-map below, what is the simplified Boolean equation? CD 00 01 11 10 00 1 1 0 0 AB 01 0 0 1 1 11 0 0 1 1 10 0 0 0 0 F = A B C + BC 22) Consider the ALU below. Note this ALU has some minor wiring differences than the one described in class. Answer the questions below for this ALU. To perform addition, how should Ainvert, Binvert, CarryIn and Oper be set (if the input doesn t matter, use an X )? 7 of 9

Ainvert=0, Binvert=1, CarryIn=0, Oper=10 To perform an OR operation, how should Ainvert, Binvert, CarryIn and Oper be set (if the input doesn t matter, use an X )? Ainvert=0, Binvert=1, CarryIn=X, Oper=00 To perform a NAND operation, how should Ainvert, Binvert, CarryIn and Oper be set (if the input doesn t matter, use an X )? Ainvert=1, Binvert=0, CarryIn=X, Oper=00 To perform a NOR operation, how should Ainvert, Binvert, CarryIn and Oper be set (if the input doesn t matter, use an X )? Ainvert=1, Binvert=0, CarryIn=X, Oper=01 8 of 9

23) Consider the 4-bit ALU made with the 1-bit ALU from the previous questions. Suppose, Ainvert=0, Binvert=0, CarryIn=1, A=0100, B=0011, and Oper=10. What is Result? Result = 0001 (this is subtract) 24) Now, suppose, Ainvert=0, Binvert=0, CarryIn=1, A=0101, B=0011, and Oper=00. What is the result? Result = 1101 (Binvert causes B to be inverted to 1100, which is OR ed with A) 9 of 9