0% found this document useful (0 votes)
5 views33 pages

Week 10 Notes

The document covers an overview of x86-64 architecture and machine-level floating-point representation. It explains the advantages and features of x86-64, including 64-bit processing and large memory support, while also detailing the IEEE 754 standard for floating-point numbers. Additionally, it introduces processor architecture, its importance, main functions, and distinguishes between CISC and RISC architectures.

Uploaded by

igcsamundari
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)
5 views33 pages

Week 10 Notes

The document covers an overview of x86-64 architecture and machine-level floating-point representation. It explains the advantages and features of x86-64, including 64-bit processing and large memory support, while also detailing the IEEE 754 standard for floating-point numbers. Additionally, it introduces processor architecture, its importance, main functions, and distinguishes between CISC and RISC architectures.

Uploaded by

igcsamundari
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

Week 10 Notes

Course: Computer Organization / Computer


Systems
Topics:
1. x86-64 Architecture Overview
2. Machine-Level Floating-Point Representation

Topic 1: x86-64 Architecture Overview


Introduction
The x86-64 architecture (also called x64 or AMD64) is a 64-bit version of the x86
architecture. It was introduced by Advanced Micro Devices (AMD) and later adopted by Intel.

It is used in most modern computers because it can process 64-bit data, support more memory,
and execute programs much faster than 32-bit systems.

Definition
x86-64 Architecture is a 64-bit processor architecture that defines how a CPU executes
instructions, stores data, communicates with memory, and manages hardware resources.

Why x86-64 Was Introduced


The older 32-bit architecture had several limitations:

• Maximum memory was 4 GB RAM


• Smaller registers
• Slower processing for large applications
The x86-64 architecture solved these problems by providing:

• 64-bit registers
• Larger memory support
• Better performance
• Improved security
• Faster execution

Main Features of x86-64 Architecture


1. 64-bit Processing
The CPU processes 64 bits of data at one time.

Advantages:

• Faster calculations
• Better performance
• Large integer support

2. Large Memory Support


32-bit System

Maximum memory:

2³² = 4 GB

64-bit System

Theoretical memory:

2⁶⁴ bytes

This is approximately 16 Exabytes (EB).

Modern processors support less than this in practice, but still far more than 32-bit systems.
3. More Registers
Registers are very small storage locations inside the CPU.

Common registers:

Register Purpose
RAX Accumulator
RBX Base Register
RCX Counter
RDX Data Register
RSI Source Index
RDI Destination Index
RSP Stack Pointer
RBP Base Pointer
RIP Instruction Pointer

These registers are 64 bits wide.

4. General Purpose Registers


Older x86 processors had 8 general-purpose registers.

x86-64 increased this to 16 general-purpose registers.

New registers include:

• R8
• R9
• R10
• R11
• R12
• R13
• R14
• R15

More registers mean:

• Faster execution
• Fewer memory accesses
• Better compiler optimization
5. Instruction Pointer (RIP)
RIP stores the address of the next instruction that the CPU will execute.

Example:

If the CPU finishes instruction at address 1000, RIP points to 1004 (depending on instruction
length).

6. Stack Pointer (RSP)


RSP points to the top of the stack.

The stack stores:

• Function calls
• Local variables
• Return addresses
• Temporary data

7. Base Pointer (RBP)


RBP helps access:

• Local variables
• Function parameters

It provides a stable reference inside a function.

Memory Organization
Memory consists of bytes.

Each byte has a unique address.

Example:
Address Data
1000 25
1001 40
1002 55
1003 90

The CPU accesses data using these addresses.

Instruction Cycle
The CPU works in three main steps:

1. Fetch

The CPU fetches the instruction from memory.

2. Decode

The instruction is interpreted.

3. Execute

The CPU performs the required operation.

Example:

ADD RAX, RBX

Meaning:

RAX = RAX + RBX

Addressing Modes
Immediate Addressing

Value is written directly.

Example:
MOV RAX, 10

Register Addressing

Data comes from another register.

Example:

MOV RAX, RBX

Memory Addressing

Data comes from memory.

Example:

MOV RAX, [1000]

Advantages of x86-64
• Supports 64-bit computing
• Supports huge memory
• Faster processing
• More registers
• Better multitasking
• Improved performance
• Better security features

Disadvantages
• Requires a 64-bit operating system for full benefits
• Some old 16-bit software is not supported directly
• Slightly higher memory usage

Real-Life Uses
• Desktop computers
• Laptops
• Servers
• Gaming PCs
• Software development
• Artificial Intelligence
• Virtual Machines

Key Points (Exam)


• x86-64 is a 64-bit architecture.
• Introduced by AMD.
• Supports more than 4 GB RAM.
• Has 16 general-purpose registers.
• Uses RIP, RSP, and RBP.
• Executes instructions using Fetch–Decode–Execute.

Topic 2: Machine-Level Floating-Point


Representation
Introduction
Computers cannot store decimal numbers exactly as humans write them.

Instead, they use a special format called Floating-Point Representation.

Examples:

• 3.14
• 0.25
• 12.75
• -45.89

These numbers are called floating-point numbers.

Definition
A Floating-Point Number is a method of representing real numbers (numbers with decimal
points) in binary using a standard format.

Why Floating-Point Representation Is


Needed
Integers store only whole numbers.

Examples:

• 5
• 10
• 100

But many applications require decimal values.

Examples:

• Temperature
• Distance
• Scientific calculations
• Graphics
• Finance (often with special care due to rounding)

Floating-point representation makes these calculations possible.

Scientific Notation
Humans write:

4500

as

4.5 × 10³

Computers use binary:

1.001 × 2⁵
This is the basic idea behind floating-point representation.

IEEE 754 Standard


Most computers follow the IEEE 754 standard.

A floating-point number has three parts:

1. Sign Bit

Determines whether the number is positive or negative.

Sign Bit Meaning


0 Positive
1 Negative

2. Exponent

Stores the power of 2.

It determines how large or small the number is.

3. Fraction (Mantissa)

Stores the significant digits (precision).

Single Precision (32-bit)


Part Bits
Sign 1
Exponent 8
Fraction 23

Total:
1 + 8 + 23 = 32 bits

Double Precision (64-bit)


Part Bits
Sign 1
Exponent 11
Fraction 52

Total:

1 + 11 + 52 = 64 bits

Double precision provides:

• Higher accuracy
• Greater precision
• Larger range

Example
Number:

13.25

Binary:

1101.01

Normalized form:

1.10101 × 2³

Stored as:

• Sign = 0
• Exponent = 3 (stored with a bias in IEEE 754)
• Fraction = 10101...
Floating-Point Operations
The CPU performs:

• Addition
• Subtraction
• Multiplication
• Division

These operations are more complex than integer arithmetic because exponents may need to be
aligned and results normalized.

Advantages
• Represents very large numbers
• Represents very small numbers
• Good precision
• Used in scientific calculations
• Essential for graphics and engineering

Disadvantages
• Some decimal values cannot be represented exactly in binary.
• Rounding errors may occur.
• Floating-point calculations are generally slower than integer calculations.

Applications
• Scientific computing
• Computer graphics
• Machine learning
• Physics simulations
• Weather forecasting
• Engineering software
• Games
Difference Between Integer and Floating-
Point
Integer Floating Point
Whole numbers only Decimal numbers
Exact values May have rounding errors
Simple arithmetic More complex arithmetic
Less memory Usually more memory
Faster Usually slower

Important Exam Points


• Floating-point stores decimal (real) numbers.
• IEEE 754 is the standard representation.
• Three parts: Sign, Exponent, Fraction (Mantissa).
• Single Precision = 32 bits.
• Double Precision = 64 bits.
• Used for scientific and engineering calculations.
• Floating-point values may experience rounding errors.

Quick Revision
x86-64 Architecture

• 64-bit processor architecture.


• Introduced by AMD.
• Supports large memory.
• Has 16 general-purpose registers.
• Key registers: RAX, RBX, RCX, RDX, RSP, RBP, RIP.
• Uses the Fetch–Decode–Execute cycle.

Machine-Level Floating-Point Representation

• Represents real (decimal) numbers in binary.


• Uses the IEEE 754 standard.
• Consists of Sign, Exponent, and Fraction (Mantissa).
• Single Precision = 32 bits.
• Double Precision = 64 bits.
• Widely used in scientific, graphics, and engineering applications.

• Fetch: Retrieves the instruction from memory (RAM) using the RIP (Instruction Pointer).
• Decode: The Control Unit (CU) interprets the instruction and identifies the required
operation.
• Execute: The ALU or another CPU unit performs the operation and stores the result.
• This cycle repeats continuously for every instruction in a program

Week 11 – Processor Architecture


Topic 1: Introduction to Processor
Architecture
Definition
Processor Architecture is the design and organization of a computer's processor (CPU). It
defines how the processor works, executes instructions, communicates with memory, and
controls all hardware components of the computer.

The processor is often called the "brain of the computer" because it performs all calculations,
logical operations, and controls the execution of programs.

In simple words,

Processor Architecture is the internal structure and working mechanism of a CPU.

It explains:

• How instructions are executed.


• How data is stored and transferred.
• How different CPU components work together.
• How the processor communicates with memory and input/output devices.

Why Processor Architecture is Important


Processor architecture is important because it determines the performance, speed, efficiency, and
capabilities of a computer.

A good processor architecture can:

• Execute billions of instructions every second.


• Reduce power consumption.
• Increase system performance.
• Improve multitasking.
• Support larger memory.
• Handle complex programs efficiently.

Without processor architecture, the CPU would not know how to process instructions or
communicate with other hardware.

Main Functions of a Processor


The processor performs several important functions:

1. Fetch Instructions

The processor first retrieves (fetches) instructions from the main memory (RAM).

Example:

If a program contains

A = B + C

the processor first fetches this instruction from memory.

2. Decode Instructions

After fetching the instruction, the processor interprets its meaning.

For example,

ADD R1, R2

The processor understands that it has to perform an addition operation.


3. Execute Instructions

After decoding, the CPU performs the required operation.

For example,

5 + 10 = 15

The ALU performs this calculation.

4. Store the Result

After execution, the processor stores the result in:

• Register
• Cache
• RAM

depending on the instruction.

Basic Components of Processor Architecture


The CPU contains several important components.

1. Control Unit (CU)


The Control Unit controls the entire processor.

Its responsibilities are:

• Fetch instructions
• Decode instructions
• Send control signals
• Coordinate hardware components
• Manage execution sequence

Think of the Control Unit as the manager of the CPU.


2. Arithmetic Logic Unit (ALU)
The ALU performs mathematical and logical operations.

Arithmetic Operations

• Addition
• Subtraction
• Multiplication
• Division

Example:

20 + 15 = 35

Logical Operations

• AND
• OR
• NOT
• XOR
• Comparison

Example:

10 > 5

Output:

TRUE

3. Registers
Registers are very small and very fast memory locations inside the processor.

They temporarily store:

• Instructions
• Addresses
• Data
• Results

Registers are much faster than RAM.


Examples:

• Program Counter (PC)


• Instruction Register (IR)
• Accumulator
• General Purpose Registers

4. Cache Memory
Cache memory stores frequently used data.

Purpose:

• Reduce memory access time


• Increase processor speed

Levels of cache:

• L1 Cache (Fastest)
• L2 Cache
• L3 Cache (Largest)

5. System Bus
The bus transfers information between CPU and memory.

Three types:

Data Bus

Transfers data.

Example:

10101010

Address Bus

Transfers memory addresses.


Example:

Address = 2000H

Control Bus

Transfers control signals.

Examples:

• Read
• Write
• Interrupt

Processor Organization
The processor consists of:

+-----------------------+
| CPU |
| |
| +---------------+ |
| | Control Unit | |
| +---------------+ |
| | |
| +---------------+ |
| | ALU | |
| +---------------+ |
| | |
| +---------------+ |
| | Registers | |
| +---------------+ |
+-----------------------+
|
|
Main Memory (RAM)

Characteristics of Processor Architecture


A good processor architecture should have:

High Speed
The processor should execute instructions quickly.

High Performance

It should handle multiple tasks efficiently.

Reliability

The processor should produce correct results consistently.

Scalability

It should support future upgrades, such as larger memory or more cores.

Low Power Consumption

Modern processors are designed to consume less power, especially in laptops and mobile
devices.

Types of Processor Architecture


1. CISC (Complex Instruction Set Computer)
Characteristics:

• Large instruction set


• Complex instructions
• Fewer lines of assembly code
• More hardware complexity

Example:

• Intel x86
• AMD processors
Advantages:

• Easier programming
• Powerful instructions

Disadvantages:

• Higher power consumption


• More complex hardware

2. RISC (Reduced Instruction Set Computer)


Characteristics:

• Small instruction set


• Simple instructions
• Faster execution
• Better pipelining

Examples:

• ARM
• MIPS
• RISC-V

Advantages:

• Faster processing
• Lower power consumption
• Simpler hardware

Disadvantages:

• More instructions may be needed to perform complex tasks

Real-Life Example
Imagine you want to calculate:

25 + 15
Step 1: Fetch

The processor fetches the instruction:

ADD R1, R2

Step 2: Decode

The Control Unit recognizes that it is an addition operation.

Step 3: Execute

The ALU adds:

25 + 15 = 40

Step 4: Store

The result (40) is stored in a register or memory.

Advantages of Good Processor Architecture


• Faster execution
• Efficient multitasking
• Lower power consumption
• Better system performance
• Supports modern software
• Improves overall computer efficiency

Key Points for Exams


• Processor Architecture defines the internal design of the CPU.
• CPU is called the brain of the computer.
• The CPU performs four basic operations: Fetch, Decode, Execute, and Store.
• The main components of a processor are the Control Unit (CU), Arithmetic Logic Unit
(ALU), Registers, Cache Memory, and System Bus.
• CISC uses complex instructions, while RISC uses simple instructions.
Short Questions

1. Define Processor Architecture.


2. Why is Processor Architecture important?
3. What are the four basic functions of a processor?
4. What is the role of the Control Unit?
5. What is the function of the ALU?
6. What are registers?
7. What is cache memory?
8. What is the difference between the Data Bus and Address Bus?
9. Name the main components of a CPU.
10. Differentiate between RISC and CISC.

Long Questions

1. Explain Processor Architecture in detail with a neat diagram.


2. Describe the main components of a processor and their functions.
3. Explain the working of a processor using the Fetch–Decode–Execute cycle.
4. Compare RISC and CISC architectures with advantages and disadvantages

Topic: Y86 Instruction Set

1. Introduction to Y86
The Y86 Instruction Set is a simplified version of the x86 Instruction Set Architecture (ISA).
It was developed only for educational purposes to help students understand how processors work
without dealing with the complexity of the real x86 architecture.

The Y86 architecture was introduced in the textbook Computer Systems: A Programmer's
Perspective (CS:APP) by Randal E. Bryant and David R. O'Hallaron.

Unlike x86, Y86 contains only a small number of instructions, making it easier to learn processor
design, machine language, and assembly programming.

Definition:
Y86 is a simple Instruction Set Architecture (ISA) designed for teaching computer
architecture concepts such as instruction execution, memory organization, registers, and
pipelining.

2. What is an Instruction Set?


An Instruction Set is a collection of machine-language commands that a processor understands
and executes.

Every processor has its own instruction set.

Examples include:

• x86
• ARM
• MIPS
• RISC-V
• Y86

Examples of instructions:

ADD
SUB
MOV
PUSH
POP
CALL
RET
JMP

These instructions tell the processor exactly what operation to perform.

3. Why was Y86 Designed?


The real x86 processor has hundreds of instructions, many addressing modes, and complex
hardware, making it difficult for beginners.

To solve this problem, computer scientists created Y86.

Purposes of Y86

• To simplify processor architecture.


• To teach assembly language programming.
• To understand instruction execution.
• To learn pipelining.
• To study processor design.
• To simulate CPU operations.

Y86 allows students to focus on fundamental concepts instead of unnecessary complexity.

4. Features of Y86
The main features of the Y86 instruction set are:

1. Simple Architecture

Y86 contains only the basic instructions needed for learning.

2. Small Instruction Set

Compared with x86, Y86 has very few instructions.

Example:

irmovq
rrmovq
mrmovq
rmmovq
addq
subq
andq
xorq
pushq
popq
call
ret
jmp

3. Easy to Understand

The instruction format is simple.

Students can easily trace each instruction.


4. 64-bit Architecture

Y86 is based on the 64-bit version of x86.

Therefore:

• Registers are 64 bits.


• Memory addresses are 64 bits.

5. Supports Assembly Language

Programs are written using simple assembly instructions.

Example:

irmovq $20,%rax
irmovq $10,%rbx
addq %rbx,%rax

Result:

RAX = 30

5. Y86 Processor Architecture


The Y86 processor contains several hardware components.

+----------------------+
| Memory |
+----------+-----------+
|
Address/Data Bus
|
+---------------------------------------+
| CPU |
| |
| +-------------+ +---------------+ |
| | Registers | | Control Unit | |
| +-------------+ +---------------+ |
| | | |
| +-------+-------+ |
| | |
| +-------+ |
| | ALU | |
| +-------+ |
+---------------------------------------+

6. Components of Y86
The processor consists of the following parts.

1. Register File
Registers temporarily store data.

Examples:

%rax
%rbx
%rcx
%rdx
%rsp
%rbp
%rsi
%rdi

Registers are much faster than RAM.

2. ALU (Arithmetic Logic Unit)


The ALU performs calculations.

Examples:

Addition

20 + 10 = 30

Subtraction

40 - 15 = 25

Logical AND

1001
1100
----
1000
3. Control Unit
The Control Unit controls every operation.

Functions:

• Fetch instruction
• Decode instruction
• Generate control signals
• Execute instructions

4. Memory
Memory stores:

• Instructions
• Variables
• Program data
• Stack

7. Y86 Registers
Y86 has 15 general-purpose registers, each 64 bits wide.

Some important registers are:

Register Purpose
%rax Return value and arithmetic
%rbx General-purpose register
%rcx Counter register
%rdx Data register
%rsp Stack Pointer
%rbp Base Pointer
%rsi Source Index
%rdi Destination Index

Example
irmovq $50,%rax

Meaning:

Store 50 into register RAX.

After execution:

RAX = 50

8. Condition Codes
Condition codes store information about the result of an operation.

There are three condition codes.

Zero Flag (ZF)


Set to 1 when the result is zero.

Example:

20 - 20 = 0

ZF = 1

Sign Flag (SF)


Indicates whether the result is negative.

Example:

5 - 10 = -5

SF = 1

Overflow Flag (OF)


Indicates arithmetic overflow.

Example:
Adding two very large numbers that exceed the register size.

9. Memory Organization
Memory stores both instructions and data.

Example:

Address Data
100 Instruction
108 Instruction
116 Variable
124 Stack Data

The processor accesses memory using addresses.

10. Instruction Format


Each Y86 instruction contains:

• Opcode
• Register IDs (if required)
• Constant value (optional)

General format:

Opcode
Register
Immediate Value

Example:

irmovq $100,%rax

Opcode = irmovq

Constant = 100

Destination Register = RAX


11. Types of Instructions
A. Data Movement Instructions

These instructions move data.

Examples:

irmovq
rrmovq
mrmovq
rmmovq

Example:

irmovq $50,%rax

Moves 50 into RAX.

B. Arithmetic Instructions

Used for calculations.

Examples:

addq
subq

Example:

addq %rbx,%rax

Meaning:

RAX = RAX + RBX

C. Logical Instructions

Perform logical operations.

Examples:
andq
xorq

Example:

xorq %rax,%rax

Result:

RAX = 0

D. Control Instructions

Used for changing program flow.

Examples:

jmp
je
jne
call
ret

Example:

jmp Loop

The processor jumps directly to the instruction labeled Loop.

E. Stack Instructions

Used to manage the stack.

Examples:

pushq
popq

Example:

pushq %rax

Stores the value of RAX onto the stack.


12. Procedure Call and Return
The call instruction transfers control to a function.

call Sum

The processor:

1. Saves the return address on the stack.


2. Jumps to the function Sum.

The ret instruction:

1. Retrieves the return address from the stack.


2. Returns execution to the calling function.

13. Example Y86 Program


irmovq $10,%rax
irmovq $20,%rbx
addq %rbx,%rax
halt

Execution Steps

1. Load 10 into %rax.


2. Load 20 into %rbx.
3. Add %rbx to %rax.
4. Stop the program.

Final result:

RAX = 30
RBX = 20

14. Difference Between Y86 and x86-64


Y86 x86-64
Simplified architecture Complex architecture
Educational purpose Commercial processors
Y86 x86-64
Few instructions Hundreds of instructions
Easy to learn Difficult to learn
Limited addressing modes Many addressing modes
Used in classrooms Used in real computers

15. Advantages of Y86


• Easy to learn.
• Helps understand processor architecture.
• Simplifies assembly programming.
• Useful for studying pipelining.
• Ideal for educational purposes.
• Reduces hardware complexity.

16. Limitations of Y86


• Not used in real-world computers.
• Limited instruction set.
• Fewer registers and addressing modes.
• Cannot run modern operating systems.
• Designed only for learning and simulation.

You might also like