0% found this document useful (0 votes)
4 views35 pages

Module 2 - Part1

The document discusses data representation in computers, emphasizing the importance of binary representation for various data types including integers, fractions, characters, and multimedia. It covers number systems, fixed-point and floating-point representations, and algorithms for multiplication and division. Additionally, it outlines CPU register organization, addressing modes, and the instruction cycle.

Uploaded by

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

Module 2 - Part1

The document discusses data representation in computers, emphasizing the importance of binary representation for various data types including integers, fractions, characters, and multimedia. It covers number systems, fixed-point and floating-point representations, and algorithms for multiplication and division. Additionally, it outlines CPU register organization, addressing modes, and the instruction cycle.

Uploaded by

Saad Inamdar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ALU, Processor

organization and control


unit design
MODULE 2
Why Data Representation
Matters
- How Different types of data are stored, presented and transmitted
- Computers store and process only binary (0s and 1s)
- All numbers, characters, images, audio, video → represented in binary
- Efficiency, precision, and accuracy depend on representation
- Essential for understanding performance and limitations
Number Systems
- Decimal (Base 10): 0–9
- Binary (Base 2): 0,1
- Octal (Base 8): 0–7
- Hexadecimal (Base 16): 0–9, A–F

Conversions between number systems are fundamental for COA


Integer Representation
- Unsigned integers: only positive values
- Signed integers:
• Sign-Magnitude
• 1’s Complement
• 2’s Complement (most common)
- Range depends on number of bits
Fractional Representation
- Fixed-Point Representation:
• Binary point fixed at a position
• Limited precision, small range

- Floating-Point Representation (IEEE 754):


• Scientific notation form
• Large range, high precision
Character Representation
- ASCII (7-bit/8-bit): English characters, symbols
- Unicode (UTF-8/UTF-16): International character set
- Example: 'A' = 65 (01000001 in binary)
Other Data Types
- Boolean Data → True/False (1/0)
- Images → Pixels stored as RGB values
- Audio → Sampled waveforms stored as binary values
- Video → Sequence of images + audio
Fixed-Point and Floating-Point
Representation
COMPUTER ORGANIZATION & ARCHITECTURE
Recap: Binary Number System
- Base-2 digits: 0,1
- Place values: 2^n
- Fractional values: 2^-1, 2^-2...

Example: 0101.1010₂ = 5.625₁₀


Fixed-Point Representation
- Binary point fixed at location
- Types: Unsigned, Signed (sign-magnitude, 1’s, 2’s complement)
- Range depends on integer/fraction bits

Example: 8-bit word (4 int + 4 frac)


0101.1010₂ = 5.625₁₀
Solve:
1011.1100
1111.0101
Fixed-Point: Problem 1
Q: Represent -3.75₁₀ using 8-bit fixed-point (4 int + 4 frac, 2’s
complement)

Solution:
3.75 = 0011.1100₂
Take 2’s complement → 1100.0100
Floating-Point Concept
- Scientific notation: N = (-1)^s × M × 2^E
- Mantissa (M): normalized fraction
- Exponent (E): with bias
- Standard: IEEE 754 (Single 32-bit, Double 64-bit)
IEEE 754 Format (Single
Precision, 32-bit)
- 1 bit → Sign
- 8 bits → Exponent (bias=127)
- 23 bits → Mantissa
Example: +5.625
1. Decimal → Binary: 5.625 = 101.101₂
2. Normalize: 1.01101 × 2^2
3. Sign = 0
4. Exponent = 2+127=129=10000001₂
5. Mantissa = 011010...

Final: 0 10000001 01101000000000000000000


Floating-Point: Problem 2
Q: Represent -0.75₁₀ in IEEE 754 (32-bit)

Solution:
-0.75 = -0.11₂
Normalize: 1.1 × 2^-1
Sign=1, Exponent=-1+127=126=01111110₂
Mantissa=100000...

Final: 1 01111110 10000000000000000000000


Fixed vs Floating
Fixed-Point:
- Small range
- Limited precision
- Simple/Fast hardware
- Used in DSP, Embedded

Floating-Point:
- Large range
- High precision
- Complex/Slow hardware
- Used in AI, Graphics, Scientific
Multiplication
- Unsigned: Normal pen-paper method
-Signed: Booth’s multiplication algorithm
Booth’s Algorithm for signed number
Algorithm:
◦ The number of steps required is equal to the number of bits in the multiplier.
◦ At the beginning, consider an imaginary “0” beyond LSB of Multiplier
◦ At each step, examine two adjacent Multiplier bits from Right to Left.
◦ If the transition is from “0 to 1” then Subtract M from A and Right-Shift (A &
Q) combined.
◦ If the transition is from “1 to 0” then ADD M to A and Right-Shift.
◦ If the transition is from “0 to 0” then simply Right-Shift.
◦ If the transition is from “1 to 1” then simply Right-Shift.
◦ Repeat steps 1 to 5 for all bits of the multiplier.
◦ The final answer will be in A & Q combined.
Division
Restoring Division Non-Restoring Division
Algorithm: Algorithm:
• The number of steps required is equal to the • The number of steps required is equal to the
number of bits in the Dividend. number of bits in the Dividend.
• At each step, left shift the dividend by 1 • At each step, left shift the dividend by 1
position. position.
• Subtract the divisor from A (perform A - M). • Subtract the divisor from A (perform A - M).
• If the result is positive then the step is said to • If the result is positive then the step is said to
be “Successful”. be “Successful”.
• In this case quotient bit will be “1” and • In this case quotient bit will be “1” and
Restoration is NOT Required. Restoration is NOT Required.
• If the result is negative then the step is said to • The Next Step will also be Subtraction.
be “Unsuccessful”.
• If the result is negative then the step is said to
• In this case quotient bit will be “0”. be “Unsuccessful”.
• Here Restoration is performed by adding back • In this case quotient bit will be “0”.
the divisor.
• Here Restoration is NOT Performed.
• Hence the method is called Restoring Division.
• Instead the next step will be ADDITION in place
• Repeat steps 1 to 4 for all bits of the Dividend. of subtraction.
Restoring Division for signed
Numbers:
Algorithm:
• The number of steps required is equal to the number of bits in the Dividend.
• At each step, left shift the dividend by 1 position.
• If Sign of A and M is the same then Subtract the divisor from A (perform A - M), Else
Add M to A
• After the operation,
If Sign of A remains the same or the dividend (in A and Q) becomes zero, then the step
is said to be “Successful”. In this case quotient bit will be “1” and Restoration is NOT
Required.
• If Sign of A changes, then the step is said to be “Unsuccessful”. In this case quotient
bit will be “0”.
Here Restoration is Performed. Hence, the method is called Restoring Division.
• Repeat steps 1 to 4 for all bits of the Dividend
Floating point IEEE 754
formats
Single Precision

Double Precision
Extreme Cases in Floating
Point Numbers
Basic components of computer
Basic instruction cycle
Detailed Instruction cycle
State Diagram
Interrupts
Instruction cycle with
interrupts
Bus Interconnection
Register Organization
• CPU must have some working space (temporary storage)
• Called registers
• Number and function vary between processor designs
How big?
• Large enough to hold full address
• Large enough to hold full word
• Often possible to combine two data registers

User-visible registers: These enables the machine - or assembly language


programmer to minimize main memory reference by optimizing use of registers.
Control and status registers: These are used by the control unit to control the
operation of the CPU. Operating system programs may also use these in
privileged mode to control the execution of program .
User Visible Registers Control and status registers
• General Purpose
◦ Can be assigned to a variety of functions by the
programmer • Program Counter
◦ May be used for data or addressing • Instruction Decoding
Register
• Data
◦ used to hold only data and cannot be employed • Memory Address Register
in the calculation of an operand address.
0 • Memory Buffer
0 Register
• Address
◦ Segment pointers
◦ Index registers
◦ Stack Pointer

• Condition Codes
◦ PSW: Program status word
Sign, zero, carry, equal, overflow, interrupt
enable/disable, supervisor
Addressing Modes
A manner in which operand is given in an instruction
• Immediate MOV AL, 05H ; Move immediate value 05H into AL

• Register MOV AX, BX ; Move content of register BX into AX

• Direct MOV AL, [1234H] ; Move value from memory address 1234H into AL

• Indirect
• Register indirect MOV AL, [BX] ; Move the content from the memory address in BX
into AL
• Register relative MOV AL, [BX + 5] ; Access memory at BX + 5
• Base indexed MOV AL, [BX + SI] ; Effective address = BX + SI
• Base relative plus indexed MOV AL, [BX + SI + 10] ; Effective address = BX + SI + 10
Mode Example Notes

Immediate MOV AL, 05H Constant operand

Register MOV AX, BX Operand is a register

Direct MOV AL, [1234H] Direct memory address

MOV SI, 2000H Address stored in


Indirect
MOV AL, [SI] register

Register Indirect MOV AL, [BX] Address in a register

Register Relative MOV AL, [BX + 5] Register + offset

Base Indexed MOV AL, [BX + SI] Base + index

Base + index +
Base Relative + Indexed MOV AL, [BX + SI + 10]
displacement

You might also like