0% found this document useful (0 votes)
32 views36 pages

Week2 Lecture Chapter1

This document is the first chapter of a course on principles of computer and composition taught by Dr. Yiju Wang at Xiamen University. The chapter covers topics related to data representation and manipulation, including numeric and non-numeric data representation systems like binary, octal, hexadecimal, ASCII, and BCD codes. It also discusses integer formats for microcomputers like byte and word integers in both unsigned and signed forms. Finally, it covers basic arithmetic operations on integers using sign-magnitude, one's complement, and two's complement representations.

Uploaded by

CST2109168
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views36 pages

Week2 Lecture Chapter1

This document is the first chapter of a course on principles of computer and composition taught by Dr. Yiju Wang at Xiamen University. The chapter covers topics related to data representation and manipulation, including numeric and non-numeric data representation systems like binary, octal, hexadecimal, ASCII, and BCD codes. It also discusses integer formats for microcomputers like byte and word integers in both unsigned and signed forms. Finally, it covers basic arithmetic operations on integers using sign-magnitude, one's complement, and two's complement representations.

Uploaded by

CST2109168
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 36

PRINCIPLES OF COMPUTER AND

COMPOSITION

Course Information

Dr. Yiju Wang


School of Aerospace and Engineering, Xiamen University
[email protected]
Office: A1-425
CHAPTER 1

DATA REPRESENTATION AND MANIPULATION


3
Chapter1 Data Representation and Manipulation
4

 1.1 Numeric data representation


 1.2 Non-numeric data representation
 1.3 Basic arithmetic and Logic operations
Chapter1 Data Representation and Manipulation
5

 1.1 Numeric data representation


 1.1.1 Number System
 1.1.1.1 Decimal Number
 1.1.1.2 Binary Number
 1.1.1.3 Octal Number
 1.1.1.4 Hexadecimal Number
 1.1.2 Number Conversion
 1.1.2.1 Conversions to Decimal Numbers
 1.1.2.2 Conversions from Decimal Numbers
 1.1.2.3 Conversion between Hexadecimal and binary numbers
 1.2 Non-numeric data representation
 1.2.1 BCD(Binary Coded Decimal) Code
 1.2.2 ASCII code
 1.3 Basic arithmetic operations
 1.3.1 Operation of Binary
 1.3.2 Integer Formats in Microcomputers
1.3.2 Integer Formats in Microcomputers
6

 Unsigned integer data


 Unsigned byte integer
 Unsigned word integer
 Unsigned double word integer
 Signed integer data
 Signed byte integer
 Signed word integer
 Signed double word integer
1.3.2 Integer Formats in Microcomputers
7

 Byte Integer
 Unsigned (0-255)
 Signed (-128-+127)

 Word Integer
 Unsigned (0-65535)
 Signed (-32768-+32767)
8
1.3.2 Integer Formats in Microcomputers
9

 Signed data
 Sign-Magnitude Representation ( Original binary
data )
 One’s Complements (Radix-1 complements)
 Two’s Complements (Radix complements)
1.3.2 Integer Formats in Microcomputers
10

 Signed data
 Sign-Magnitude Representation ( Original binary
data )
 One’s Complements (Radix-1 complements)
 Two’s Complements (Radix complements)
1.3.2 Integer Formats in Microcomputers
11

 Sign-Magnitude Representation
 Byte
7 6 5 4 3 2 1 0

Sign bit numerical bits

 Word
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Sign bit numerical bits


1.3.2 Integer Formats in Microcomputers
12

 Sign-Magnitude Representation
 The most significant bit is a sign bit.
 Zero identifies a positive number
 One identifies a negative number
 Numerical bits are the same
1.3.2 Integer Formats in Microcomputers
13

 Sign-Magnitude Representation
 Positive
 Sign bit is 0
 Numeric bits is magnitude
 Negative
 Sign bit is 1
 Numeric bits is magnitude
1.3.2 Integer Formats in Microcomputers
14

 Sign-Magnitude Representation
 [+1D ]=00000001B=01H
 [-1D ]=10000001B=81H
1.3.2 Integer Formats in Microcomputers
15

 One’s Complements
 Positive
 same as its original binary data
 Negative
 invert
1.3.2 Integer Formats in Microcomputers
16

 Sign-magnitude data
 [+1D ]=00000001B=01H

 [-1D ]=10000001B=81H

 One’s Complements
 [+1D ]=00000001B=01H

 [-1D ]=11111110B=FEH
1.3.2 Integer Formats in Microcomputers
17
1.3.2 Integer Formats in Microcomputers
18

 Two’s Complements
 Positive
 same as its original binary data
 Negative
 invert and then add 1
1.3.2 Integer Formats in Microcomputers
19

 Original binary data


 [+1D ]=00000001B=01H

 [-1D ]=10000001B=81H

 One’s Complements
 [+1D ]=00000001B=01H

 [-1D ]=11111110B=FEH

 Two’s Complements
 [+1D ]=00000001B=01H

 [-1D ]=11111111B=FFH
1.3.2 Integer Formats in Microcomputers
20
1.3.2 Integer Formats in Microcomputers
21

 Byte Two’s Complements


 [+1]=00000001B=01H
 [-1]=11111111B=0FFH

 Word Two’s Complements


 [+1]=0000000000000001B=0001H
 [-1]=1111111111111111B=0FFFFH
1.3.2 Integer Formats in Microcomputers
22

 Range of representation
 Sign-Magnitude Representation
1.3.2 Integer Formats in Microcomputers
23

 Range of representation
 Sign-Magnitude Representation
1.3.2 Integer Formats in Microcomputers
24

 Range of representation
 One’s Complements
1.3.2 Integer Formats in Microcomputers
25

 Range of representation
 One’s Complements
1.3.2 Integer Formats in Microcomputers
26

 Range of representation
 Two’s Complements
1.3.2 Integer Formats in Microcomputers
27

 Range of representation
 Two’s Complements
1.3.2 Integer Formats in Microcomputers
28

 Range of representation in two’s Complement


notation
 Byte
 Unsigned integer(0-255)
 Signed integer(-128-+127)
 Word
 Unsigned integer(0-65535)
 Signed integer(-32768-+32767)
1.3.2 Integer Formats in Microcomputers
29

 Two’s Complements Arithmetic


 Addition
 [X+Y]=[X]+[Y]
 Subtraction
 [X-Y]=[X]+[-Y]
1.3.2 Integer Formats in Microcomputers
30

 Example of Addition and Subtraction in two’s


Complements
 23+15
 (-23)+(-15)
 23-15
 (-23)-(-15)
1.3.2 Integer Formats in Microcomputers
31

 Solution
 [23]=00010111B=17H
 [-23]=11101001B=0E9H
 [15]=00001111B=0FH
 [-15]=11110001B=0F1H
1.3.2 Integer Formats in Microcomputers
32

 Solution
1.3.2 Integer Formats in Microcomputers
33

 Solution
1.3.2 Integer Formats in Microcomputers
34

 Solution
1.3.2 Integer Formats in Microcomputers
35

 Solution
1.3.2 Integer Formats in Microcomputers
36

 Method to find the opposite number(negation)

You might also like