Computer Architecture CPIT 210 LAB 1 Manual. Prepared By: Mohammed Ghazi Al Obeidallah.

Similar documents
Computer Science 281 Binary and Hexadecimal Review

Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8

Useful Number Systems

Base Conversion written by Cathy Saxton

Goals. Unary Numbers. Decimal Numbers. 3,148 is s 100 s 10 s 1 s. Number Bases 1/12/2009. COMP370 Intro to Computer Architecture 1

Lecture 2. Binary and Hexadecimal Numbers

NUMBER SYSTEMS. 1.1 Introduction

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

Chapter 2. Binary Values and Number Systems

CSI 333 Lecture 1 Number Systems

Number and codes in digital systems

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Solution for Homework 2

Today. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic

Chapter 4: Computer Codes

CPEN Digital Logic Design Binary Systems

Systems I: Computer Organization and Architecture

To convert an arbitrary power of 2 into its English equivalent, remember the rules of exponential arithmetic:

Positional Numbering System

LSN 2 Number Systems. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology

Binary Numbers. Binary Octal Hexadecimal

2010/9/19. Binary number system. Binary numbers. Outline. Binary to decimal

CS101 Lecture 11: Number Systems and Binary Numbers. Aaron Stevens 14 February 2011

1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal:

Decimal to Binary Conversion

The string of digits in the binary number system represents the quantity

Number Systems and Radix Conversion

Number Representation

3. Convert a number from one number system to another

Chapter 7 Lab - Decimal, Binary, Octal, Hexadecimal Numbering Systems

Binary Representation. Number Systems. Base 10, Base 2, Base 16. Positional Notation. Conversion of Any Base to Decimal.

=

2 Number Systems. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to:

Unsigned Conversions from Decimal or to Decimal and other Number Systems

Chapter Binary, Octal, Decimal, and Hexadecimal Calculations

COMPSCI 210. Binary Fractions. Agenda & Reading

Lecture 11: Number Systems

Counting in base 10, 2 and 16

HOMEWORK # 2 SOLUTIO

NUMBER SYSTEMS. William Stallings

Lecture 8: Binary Multiplication & Division

Binary Adders: Half Adders and Full Adders

EE 261 Introduction to Logic Circuits. Module #2 Number Systems

Numeral Systems. The number twenty-five can be represented in many ways: Decimal system (base 10): 25 Roman numerals:

Number Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi)

2011, The McGraw-Hill Companies, Inc. Chapter 3

Binary Representation

CS201: Architecture and Assembly Language

THE BINARY NUMBER SYSTEM

Digital Design. Assoc. Prof. Dr. Berna Örs Yalçın

Section 1.4 Place Value Systems of Numeration in Other Bases

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

Subnetting Examples. There are three types of subnetting examples I will show in this document:

Numbering Systems. InThisAppendix...

Number of bits needed to address hosts 8

IT:101 Cisco Networking Academy I Subnetting

6 The Hindu-Arabic System (800 BC)

plc numbers Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

Chapter 1: Digital Systems and Binary Numbers

Everything you wanted to know about using Hexadecimal and Octal Numbers in Visual Basic 6

Chapter 5 Instructor's Manual

Gates, Plexers, Decoders, Registers, Addition and Comparison

This 3-digit ASCII string could also be calculated as n = (Data[2]-0x30) +10*((Data[1]-0x30)+10*(Data[0]-0x30));

Activity 1: Using base ten blocks to model operations on decimals

Activity 6.7.4: IPv4 Address Subnetting Part 2

Accentuate the Negative: Homework Examples from ACE

Preliminary Mathematics

Classful Subnetting Explained

A Step towards an Easy Interconversion of Various Number Systems

The Answer to the 14 Most Frequently Asked Modbus Questions

Core Maths C1. Revision Notes

CHAPTER 5 Round-off errors

Classless Subnetting Explained

Binary, Hexadecimal, Octal, and BCD Numbers

1. Convert the following base 10 numbers into 8-bit 2 s complement notation 0, -1, -12

Number Systems. Introduction / Number Systems

Binary Number System. 16. Binary Numbers. Base 10 digits: Base 2 digits: 0 1

Outline. hardware components programming environments. installing Python executing Python code. decimal and binary notations running Sage

Exponents. Learning Objectives 4-1

Sample EHG CL and EHG SL10 16-bit Modbus RTU Packet

Today s topics. Digital Computers. More on binary. Binary Digits (Bits)

26 Integers: Multiplication, Division, and Order

BCD (ASCII) Arithmetic. Where and Why is BCD used? Packed BCD, ASCII, Unpacked BCD. BCD Adjustment Instructions AAA. Example

APPENDIX B. Routers route based on the network number. The router that delivers the data packet to the correct destination host uses the host ID.

COMBINATIONAL CIRCUITS

The BBP Algorithm for Pi

Machine Architecture and Number Systems. Major Computer Components. Schematic Diagram of a Computer. The CPU. The Bus. Main Memory.

Arithmetic in MIPS. Objectives. Instruction. Integer arithmetic. After completing this lab you will:

Exponents, Radicals, and Scientific Notation

Session 29 Scientific Notation and Laws of Exponents. If you have ever taken a Chemistry class, you may have encountered the following numbers:

Unpacked BCD Arithmetic. BCD (ASCII) Arithmetic. Where and Why is BCD used? From the SQL Server Manual. Packed BCD, ASCII, Unpacked BCD

Radicals - Multiply and Divide Radicals

Addition Methods. Methods Jottings Expanded Compact Examples = 15

PROBLEMS (Cap. 4 - Istruzioni macchina)

Levent EREN A-306 Office Phone: INTRODUCTION TO DIGITAL LOGIC

Section 1.1 Real Numbers

The programming language C. sws1 1

CS321. Introduction to Numerical Methods

DNA Data and Program Representation. Alexandre David

A Prime Investigation with 7, 11, and 13

Transcription:

Computer Architecture CPIT 210 LAB 1 Manual Prepared By: Mohammed Ghazi Al Obeidallah malabaidallah@kau.edu.sa

LAB 1 Outline: 1. Students should understand basic concepts of Decimal system, Binary system, and hexadecimal system. 2. Students will be asked to solve some problems to increase their understanding of arithmetic operations on binary and hexadecimal numbering systems. 3. Students will understand how to convert from any numbering system to another. LAB 1 main Outcome: 1. Students will be able to convert from any numbering system to another.

A Brief Review of Number Systems: Table 1: Numbering systems Hexadecimal Binary Decimal 0 0000 0 1 0001 1 2 0010 2 3 0011 3 4 0100 4 5 0101 5 6 0110 6 7 0111 7 8 1000 8 9 1001 9 A 1010 10 B 1011 11 C 1100 12 D 1101 13 E 1110 14 F 1111 15 1. Two s complement notation of Binary numbers: The two s complement of a binary integer is formed by reversing its bits and adding 1. Example: 000111110011 111000001101 2. Two s complement notation of Hexadecimal numbers: To form the two s complement of a hexadecimal integer, reverse all bits and add 1. An easy way to reverse all bits of a hexadecimal digit is to subtract the digit from 15 (F). Here are several examples of hexadecimal integers converted to their two s complements: 6A3D (F-6)(F-A)(F-3)(F-D) 95C2 95C2 + 1 95C3 95C3 (F-9)(F-5)(F-C)(F-3) 6A3C 6A3C + 1 6A3D DE10 (F-D)(F-E)(F-1)(F-0) 21EF 21EF + 1 21F0 3. Converting unsigned decimal to binary To translate an unsigned decimal integer into binary, repeatedly divide the decimal value by 2, saving each remainder as a binary digit. Example: 37 00100101 4. Converting unsigned binary to decimal Example: 00001001 (1 x 2 0 ) + (1 X 2 3 ) =9

5. Converting signed decimal to binary Here are the steps to follow: 1- Convert the absolute value of the decimal integer to binary. 2- If the original integer was negative, form the two s complement of the binary number. Example: -43 11010101 1. The binary representation of the unsigned 43 is 00101011. 2. Because the original value was negative, we form the two s complement of 00101011 which is 11010101. This is the representation of -43 decimal. 6. Converting signed binary to decimal Here are the steps to follow: - If the highest bit is a 1, it is currently stored in a two s complement notation. You must form its two s complement notation a second time to get its positive equivalent. Then you can convert this new number to decimal as if it were an unsigned binary integer. - If the highest bit is a 0, you can convert it to decimal as it were an unsigned binary integer. For example, signed binary 11110000 has a 1 in highest bit, indicating that is a negative integer. Step 1: form the twos complement 00010000 Step 2: convert to decimal 16 step 3: infer the decimal value -16 7. Converting hexadecimal to binary Each digit in a hexadecimal integer represents four binary bits: Example: 0AB3 0000 1010 1011 0011 8. Converting binary to hexadecimal Each four bits in a binary integer represents a single hexadecimal integer. Example: 0000 0101 0011 1010 053A 9. Converting unsigned decimal to hexadecimal To convert an unsigned decimal integer to hexadecimal, repeatedly divide the decimal value by 16, and keep each remainder as a hexadecimal digit. For example: 422 (1A6) hex 10. Converting Signed decimal to hexadecimal To convert a signed decimal integer to hexadecimal, do the following: - Convert the absolute value of the decimal integer to hexadecimal. - If the decimal integer was negative, form the two s complement of the hexadecimal number. Example: -43 D5, here are the steps I did to convert it: Step 1: convert 43 to hexadecimal 2B Step 2: because the decimal integer is negative, we will form the twos complement of a hexadecimal. 2B D4 +1 D5

11. Converting signed hexadecimal to decimal To convert a signed hexadecimal integer to a decimal, do the following: - If the hexadecimal integer is negative, form its two s complement; otherwise, retain as is. - Using the integer from the previous step, convert it to decimal. If the original value was negative, attach a minus sign to the begging of the decimal integer. Important Note: You can tell if a hexadecimal integer is positive or negative by inspecting its most significant (highest) digit. If the digit is >=8, the number is negative; if the digit is <=7, the number is positive. For example, hexadecimal 8A21 is negative, and 7FD9 is positive. For example, signed hexadecimal A02F has an A in highest digit, indicating that is a negative integer. Step 1: form the twos complement of a hexadecimal 5FD0 + 1 _ 5FD1 Step 2: convert to decimal (1 X 16 0 ) + (13 X 16 1 ) + (15 X 16 2 ) + (5 X 16 3 ) = 24529 Step 3: infer the decimal value -24529 Homework 1 : Q 1) Complete table 1, by writing numbers from 0 to 40.