Professional Documents
Culture Documents
12-M2@Integer Data Representation-17-01-2024
12-M2@Integer Data Representation-17-01-2024
Organization
Monday 16:00-16:50
Wednesday 17:00-17:50
Thursday 14:00-14:50
Dr. Venkata Phanikrishna B, SCOPE, VIT-Vellore
Syllabus- Module 2
Module:2 Data Representation and Computer Arithmetic 10 hours
Flag: For a number of reasons, it can be important to export a number of status codes from the ALU, for detecting errors, and for
making decisions. Dr. Venkata Phanikrishna B, SCOPE, VIT-Vellore
Data Representation
• Efficiency: Unsigned integer operations are often more efficient in hardware because there is no need to perform additional
operations for sign extension or handling negative numbers.
• Memory Efficiency: Unsigned representations can be more memory-efficient when negative values are not needed. This is
crucial in applications with limited memory resources.
• Logical Operations: Logical operations (e.g., AND, OR, XOR) on unsigned integers are straightforward and align with
common bitwise operations.
• Limited Range: Unsigned integers have a limited range, representing only non-negative values. If
negative numbers need to be represented, an alternative signed representation is required.
• Arithmetic Overflow: Unsigned integers are susceptible to arithmetic overflow, where the result of an
operation exceeds the maximum representable value. This can lead to unexpected behavior and
requires careful handling.
• Compatibility Issues: When interfacing with systems that use signed representations, conversion and
compatibility issues may arise. It's important to handle data types carefully in mixed-sign
environments. Dr. Venkata Phanikrishna B, SCOPE, VIT-Vellore
Integer /Fixed point representations :Sign-Magnitude
Sign-magnitude representation is a numerical format used to represent both
positive and negative numbers. In this representation, a specific bit is used to
indicate the sign of the number (positive or negative), and the remaining bits
represent the magnitude (absolute value) of the number.
• Use left most (most significant bit, MSB) bit of integer to represent the sign of
the integer
• 0 be positive,
• 1 be negative.
• The rest of the integer is a magnitude, using same encoding as unsigned integers
Things to notice:
• 1. any negative number will have a 1 in the MSB.
• 2. there are 2 representations for 0,
• 00000 and 11111.
+6: 0110
-6: 1001
-----------
0: 1111
• For finding 2's complement of the binary number, we will first find the 1's
complement of the binary number and then add 1 to the least significant bit
of it.
• To get the additive inverse of a 2's comp integer,
• 1. take the 1's comp.
• 2. add 1
Dr. Venkata Phanikrishna B, SCOPE, VIT-Vellore
Integer /Fixed point representations :TWO's COMPLEMENT