Solutions - Homework 2 (Due date: October 4 5:30 pm) Presentation and clarity are very important! Show your procedure!

Similar documents
Solutions - Homework 2 (Due date: February 5 5:30 pm) Presentation and clarity are very important! Show your procedure!

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-278: Digital Logic Design Fall Notes - Unit 4. hundreds.

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-2700: Digital Logic Design Winter Notes - Unit 4. hundreds.

Number System. Introduction. Decimal Numbers

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two Solutions 26 February 2014

Decimal & Binary Representation Systems. Decimal & Binary Representation Systems

Binary Codes. Dr. Mudathir A. Fagiri

Chapter 2 Number System

Binary Addition. Add the binary numbers and and show the equivalent decimal addition.

CSCI 2212: Intermediate Programming / C Chapter 15

Basic Definition INTEGER DATA. Unsigned Binary and Binary-Coded Decimal. BCD: Binary-Coded Decimal

Chapter 10 Binary Arithmetics

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

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two 26 February 2014

Lecture 2: Number Systems

CHW 261: Logic Design

Computer Organization

1010 2?= ?= CS 64 Lecture 2 Data Representation. Decimal Numbers: Base 10. Reading: FLD Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

CSE 351: The Hardware/Software Interface. Section 2 Integer representations, two s complement, and bitwise operators

What Is It? Instruction Register Address Register Data Register

Korea University of Technology and Education

Representation of Information

Microcontroller Architecture and Interfacing HOMEWORK 3

Number Systems and Conversions UNIT 1 NUMBER SYSTEMS & CONVERSIONS. Number Systems (2/2) Number Systems (1/2) Iris Hui-Ru Jiang Spring 2010

M1 Computers and Data

Survey. Motivation 29.5 / 40 class is required

Binary Representations and Arithmetic


Digital Fundamentals

Computer (Literacy) Skills. Number representations and memory. Lubomír Bulej KDSS MFF UK

CHAPTER 1 Numerical Representation

Logic Circuits I ECE 1411 Thursday 4:45pm-7:20pm. Nathan Pihlstrom.

Chapter 1. Digital Systems and Binary Numbers

ECE2049: Homework 1. Consider the following code to compute the average of your exam grades: #define NUM_EXAMS (3)

World Inside a Computer is Binary

Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as:

Number Representations

Decoders Wilfrid Laurier University

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

Number representations

Semester Transition Point. EE 109 Unit 11 Binary Arithmetic. Binary Arithmetic ARITHMETIC

CS 241 Data Organization Binary

IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1

DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING, THE UNIVERSITY OF NEW MEXICO ECE-238L: Computer Logic Design Fall 2013.

Binary Arithmetic Intro to Assembly Language CS 64: Computer Organization and Design Logic Lecture #3

EE292: Fundamentals of ECE

Data Representation and Binary Arithmetic. Lecture 2

COMP2121: Microprocessors and Interfacing. Instruction Set Architecture (ISA)

Binary Arithmetic CS 64: Computer Organization and Design Logic Lecture #2

Data Representation COE 301. Computer Organization Prof. Muhamed Mudawar

Advanced Computer Architecture-CS501

Moodle WILLINGDON COLLEGE SANGLI. ELECTRONICS (B. Sc.-I) Introduction to Number System

Computer Organization & Systems Exam I Example Questions

Numbering systems. Dr Abu Arqoub

Chapter 1 Review of Number Systems

EE 109L Review. Name: Solutions

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

CS/EE1012 INTRODUCTION TO COMPUTER ENGINEERING SPRING 2013 HOMEWORK I. Solve all homework and exam problems as shown in class and sample solutions

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

Recap from Last Time. CSE 2021: Computer Organization. It s All about Numbers! 5/12/2011. Text Pictures Video clips Audio

data within a computer system are stored in one of 2 physical states (hence the use of binary digits)

Information Science 1

Inf2C - Computer Systems Lecture 2 Data Representation

Microcomputers. Outline. Number Systems and Digital Logic Review

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

Groups of two-state devices are used to represent data in a computer. In general, we say the states are either: high/low, on/off, 1/0,...

Electronic Data and Instructions

CS & IT Conversions. Magnitude 10,000 1,

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Internal architecture of 8086

Digital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.

EE 109L Final Review

ECOM 2325 Computer Organization and Assembly Language. Instructor: Ruba A.Salamah INTRODUCTION

Module 1: Information Representation I -- Number Systems

Question 4: a. We want to store a binary encoding of the 150 original Pokemon. How many bits do we need to use?

CHAPTER 6 ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS

Binary Arithmetic CS 64: Computer Organization and Design Logic Lecture #2 Fall 2018

Digital Arithmetic. Digital Arithmetic: Operations and Circuits Dr. Farahmand

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

Tutorial 1 Microcomputer Fundamentals

COMP2611: Computer Organization. Data Representation

Introduction to Computer Science-103. Midterm

Using MSI Logic To Build An Output Port

Chapter 3: Number Systems and Codes. Textbook: Petruzella, Frank D., Programmable Logic Controllers. McGraw Hill Companies Inc.

Content. Information Coding. Where are we? Where are we? Bit vectors (aka Words )

The MARIE Architecture

IDT Tsi620 Address Translation Application Note November 30, 2011

that system. weighted value associated with it. numbers. a number. the absence of a signal. MECH 1500 Quiz 2 Review Name: Class: Date:

EE 109 Unit 6 Binary Arithmetic

Introduction to Computer Science. Homework 1

2.1. Unit 2. Integer Operations (Arithmetic, Overflow, Bitwise Logic, Shifting)

Data Representation 1

Time: 8:30-10:00 pm (Arrive at 8:15 pm) Location What to bring:

SC2004MBS 20x4 Characters MODBUS RTU Slave LCD

COMP Overview of Tutorial #2

CS 261 Fall Binary Information (convert to hex) Mike Lam, Professor

BUILDING BLOCKS OF A BASIC MICROPROCESSOR. Part 1 PowerPoint Format of Lecture 3 of Book

Goals for this Week. CSC 2400: Computer Systems. Bits, Bytes and Data Types. Binary number system. Finite representations of binary integers

Digital Fundamentals

1/31/2017. Expressions are Used to Perform Calculations. ECE 120: Introduction to Computing. Five Arithmetic Operators on Numeric Types

Transcription:

Solutions - Homework 2 (Due date: October 4 th @ 5:30 pm) Presentation and clarity are very important! Show your procedure! PROBLEM 1 (28 PTS) a) What is the minimum number of bits required to represent: (2 pts) 16385 symbols? log 2 16385 = 15 Memory addresses from 0 to 131072? log 2 (131073) = 18 b) A microprocessor has a 32-bit address line. The size of the memory contents of each address is. The memory space is defined as the collection of memory positions the processor can address. (6 pts) - What is the address range (lowest to highest, in hexadecimal) of the memory space for this microprocessor? What is the size (in bytes, KB, or MB) of the memory space? 1KB = 2 10 bytes, 1MB = 2 20 bytes, 1GB = 2 30 bytes Range: 0x00000000 to 0xFFFFFFFF With 32 bits, we can address 2 32 bytes, thus we have 2 2 2 30 = 4GB of address space - A memory device is connected to the microprocessor. Based on the size of the memory, the microprocessor has assigned the addresses 0xFE400000 to 0xFE7FFFFF to this memory device. What is the size (in bytes, KB, or MB) of this memory device? What is the minimum number of bits required to represent the addresses only for this memory device? As per the figure, we only need 22 bits for the address 1111 1110 0100 0000 0000 0000 0000 0000: 0xFE400000 in the given range (where the 1111 1110 0100 0000 0000 0000 0000 0001: 0xFE400001 memory device is located). Thus, the size of the memory is 2 22 = 4 MB. 1111 1110 0111 1111 1111 1111 1111 1111: 0xFE7FFFFF c) A microprocessor has a memory space of 512 KB. Each memory address occupies one byte. (8 pts) - What is the address bus size (number of bits of the address) of this microprocessor? Since 512 KB = 2 19 bytes, the address bus size is 19 bits. - What is the range (lowest to highest, in hexadecimal) of the memory space for this microprocessor? With 19 bits, the address range is 0x00000 to 0x7FFFF. - The figure to the right shows four memory chips that are placed in the given positions: Complete the address ranges (lowest to highest, in hexadecimal) for each of the memory chips. 000 0000 0000 0000 0000: 0x00000 000 0000 0000 0000 0001: 0x00001 001 1111 1111 1111 1111: 0x1FFFF 010 0000 0000 0000 0000: 0x20000 010 0000 0000 0000 0001: 0x20001 011 1111 1111 1111 1111: 0x3FFFF 0 1 0 1 2 3 100 0000 0000 0000 0000: 0x40000 100 0000 0000 0000 0001: 0x40001 101 1111 1111 1111 1111: 0x5FFFF 2 110 0000 0000 0000 0000: 0x60000 110 0000 0000 0000 0001: 0x60001 111 1111 1111 1111 1111: 0x7FFFF 3 1 Instructor: Daniel Llamocca

d) The figure below depicts the entire memory space of a microprocessor. Each memory address occupies one byte. (12 pts) - What is the size (in bytes, KB, or MB) of the memory space? What is the address bus size of the microprocessor? space: 0x000000 to 0xFFFFFF. To represent all these addresses, we require 24 bits. So, the address bus size of the microprocessor is 24 bits. The size of the memory space is then 2 24 = 16 MB. - If we have a memory chip of 2MB, how many bits do we require to address 2MB of memory? 2 MB = 2 21 bytes. Thus, we require 21 bits to address only the memory device. - We want to connect the 2MB memory chip to the microprocessor. Recall that a memory chip must be placed in an address range where every single address share some MSBs (e.g.: 0x600000 to 0x7FFFFF). Provide a list of all the possible address ranges that the 2MB memory chip can occupy. You can only use any of the non-occupied portions of the memory space as shown below. 0x200000 to 0x3FFFFF 0x400000 to 0x5FFFFF 0x800000 to 0x9FFFFF 0xA00000 to 0xBFFFFF 0xC00000 to 0xDFFFFF 0xFFFFFF 0xDFFFFF 0xE00000 0xBFFFFF 0xC00000 0x9FFFFF 0xA00000 0x7FFFFF 0x800000 0x5FFFFF 0x600000 0x3FFFFF 0x400000 0x1FFFFF 0x200000 0x000000 PROBLEM 2 (28 PTS) In ALL these problems (a, b, c), you MUST show your conversion procedure. No procedure zero points. a) Convert the following decimal numbers to their 2 s complement representations: binary and hexadecimal. (9 pts) -136.6875, 207.65625, -128.5078125 +136.6875 = 010001000.1011-136.6875 = 101110111.0101 = 0xF77.5 207.65625 = 011001111.10101 = 0x0CF.A8 +128.5078125 = 010000000.1000001-128.5078125 = 101111111.0111111 = 0xF7F.7E b) Complete the following table. The decimal numbers are unsigned: (7 pts.) Decimal BCD Binary Reflective Gray Code 278 00100111 100010110 110011101 171 000101110001 10101011 11111110 307 001100000111 100110011 110101010 507 010100000111 111111011 100000110 995 100110010101 1111100011 1000010010 217 001000010111 11011001 10110101 84 10000100 01010100 01111110 c) Complete the following table. Use the fewest number of bits in each case: (12 pts.) REPRESENTATION Decimal Sign-and-magnitude 1's complement 2's complement -129 110000001 101111110 101111111 84 01010100 01010100 01010100-88 11011000 10100111 10101000 0 00 11111 0-64 11000000 10111111 1000000-39 1100111 1011000 1011001 2 Instructor: Daniel Llamocca

c 10 =1 c9=1 c8=0 c 7 =0 c7=1 c1=0 c 9 =0 c8=0 c3=0 b7=1 b 6 =0 b 5 =0 b 4 =0 b3=0 b 2 =0 b 1 =0 c1=0 b8=0 b 7 =1 b 6 =1 b5=1 b4=1 b 3 =1 b 2 =0 b1=0 c 2 =1 b 8 =1 b 7 =0 b 6 =0 b 5 =0 b 4 =0 b 3 =0 b 2 =1 b 1 =0 PROBLEM 3 (38 PTS) a) Perform the following additions and subtractions of the following unsigned integers. Use the fewest number of bits n to represent both operators. Indicate every carry (or borrow) from c 0 to c n (or b 0 to b n). For the addition, determine whether there is an overflow. For the subtraction, determine whether we need to keep borrowing from a higher bit. (8 pts) Example (n=8): 54 + 210 77-194 Borrow out! 54 = 0x36 = 0 1 1 0 + 210 = 0xD2 = 1 1 0 1 0 0 1 0 77 = 0x4D = 0 1 0 1-194 = 0xC2 = 1 1 1 0 1 1 0 0 0 0 0 0 1 209 + 68 34 + 437 n = 209 = 0xD1 = 1 1 0 1 0 0 0 1 + 68 = 0x44 = 0 1 0 0 0 1 0 0 277 =0x115 = 1 0 0 0 1 n = 9 bits 437 = 0x1B5 = 1 1 0 1 1 + 34 = 0x022 = 0 0 0 1 0 0 0 1 0 471 = 0x1D7 = 1 1 1 1 1 129 37 42-98 n = No Borrow Out 129 = 0x81 = 1 0 0 1-37 = 0x25 = 0 0 1 0 92 = 0x5C = 1 1 0 0 n = 7 bits Borrow out! 42 = 0x2A = 0 1 0-98 = 0x62 = 1 1 0 0 0 1 0 0x48 = 1 0 0 1 0 0 0 b) We need to perform the following operations, where numbers are represented in 2's complement: (24 pts) -98 + 256 105-62 206 + 309-127 - 36-257 + 256 246 + 31 For each case: Determine the minimum number of bits required to represent both summands. You might need to sign-extend one of the summands, since for proper summation, both summands must have the same number of bits. Perform the binary addition in 2 s complement arithmetic. The result must have the same number of bits as the summands. Determine whether there is overflow by: i. Using c n, c n 1 (carries). ii. Performing the operation in the decimal system and checking whether the result is within the allowed range for n bits, where n is the minimum number of bits for the summands. If we want to avoid overflow, what is the minimum number of bits required to represent both the summands and the result? -98 = 1 1 1 0 0 1 1 1 1 0 + 256 = 0 1 158 = 0 0 1 0 0 1 1 1 1 0-98+256 = 158 [-2 9, 2 9-1] no overflow n = c 8 c 7 =0 105 = 1 0 0 1 + -62 = 1 1 1 0 43 = 0 0 1 1 105=62 = 43 [-2 7, 2 7-1] no overflow 3 Instructor: Daniel Llamocca

c7=1 c5=1 c4=1 c2=1 c9=0 c 8 =0 c6=0 c 9 =0 c6=1 c3=1 c 2 =1 c11=0 c5=1 c2=1 c 1 =1 c 0 =1 c 7 =0 c 10 =0 c 10 206 = 0 0 1 1 1 0 + 309 = 0 1 0 0 1 1 1 0 0 0 1 1 206+309 = 515 [-2 9, 2 9-1] overflow! n = 11 bits (sign-extension) c 11 c 10 =0 206+309 = 515 [-2 10, 2 10-1] no overflow 206 = 0 0 0 1 1 1 0 + 309 = 0 0 1 0 0 1 1 515 = 0 1 0 0 0 1 1-257 = 1 0 1 1 1 1 1 1 1 1 + 256 = 0 1-1 = 1 1 1 1 1 1 1 1 1 1-257+256 = -1 [-2 9, 2 9-1] no overflow n = c 8 n = 9 bits c 9 c 8 =0-127 = 1 0 0 1 + -36 = 1 1 0 1 1 1 0 0 1 1 0 1-127-36 = -163 [-2 7, 2 7-1] overflow! n = 9 bits (sign-extension) c 9 c 8 =0-127 = 1 1 0 0 1 + -36 = 1 1 1 0 1 1 1 0 0-163 = 1 1 1 0 1-127-36 = -163 [-2 8, 2 8-1] no overflow 246 = 0 1 1 1 1 + 31 = 1 1 1 1 1 277 = 1 0 0 0 1 246+31 = 277 [-2 8, 2 8-1] overflow! (sign-extension) 246 = 0 0 1 1 1 1 + 31 = 0 1 1 1 1 1 277 = 0 1 0 0 0 1 246+31 = 277 [-2 9, 2 9-1] no overflow c) Get the multiplication results of the following numbers that are represented in 2 s complement arithmetic with 4 bits. (6 pts) 1001x1011, 1010x0101, 1110x0110. 1 0 0 1 x 1 0 1 1 0 1 1 1 x 0 1 1 1 0 1 1 1 0 1 0 0 0 1 1 0 1 0 0 0 1 1 1 0 1 0 x x 0 1 1 1 1 0 1 0 0 0 1 0 1 1 1 0 x 0 0 1 0 x 0 0 1 0 0 0 1 0 0 0 1 1 0 1 0 0 4 Instructor: Daniel Llamocca

PROBLEM 4 (6 PTS) Complete the timing diagram (signals DO and DATA) of the following circuit. The circuit in the blue box is a 4-bit Binary to Gray Decoder. For example, if T=1100, then DO=1010. DI 4 4 DATA DO 4 Binary to Gray Decoder T 4 OE OE DATA 1010 0100 0011 1001 1111 1010 0101 1110 DI DO 1011 0100 1001 1010 1110 1111 0010 1000 0111 5 Instructor: Daniel Llamocca