05-Lecture-ISA-X86
05-Lecture-ISA-X86
ARCHITECTURE
Rashid Mehmood
Basic Microcomputer Design
DESIGN OF INSTRUCTIONS SET
Designing an Instruction Set Architecture (ISA) for a small-level processor involves
several key steps. Here’s a structured approach:
Input / Output Operations: Define how the processor will handle I/O operations.
DESIGN OF INSTRUCTIONS SET
5. Define Registers:
General-Purpose Registers: Decide on the number and size.
Special-Purpose Registers: Include program counter (PC), stack pointer (SP),
and status registers
6. Design the Execution Model:
Pipeline Stages: Define if and how pipelining will be implemented
Instruction Execution: Specify how instructions will be decoded and executed.
• A machine language instruction format has one or more number of fields associated with it.
• The first field is called as operation code field or op-code field, which indicates the type of operation to be
performed by the CPU
• The instruction format also contains other fields known as operand fields
• The CPU executes the instruction using the information which reside in these fields
• The length of an instruction may vary from 1 byte to 6 bytes. The instruction formats are described as
follows
For multiple-byte words stored in Main Memory there are two different conventions:
– Little Endian
• Little Endian byte order puts the byte whose address is "x...x00" at the least
significant position in the word (the little end)
• In Little Endian, the address of a datum is the address of the least significant byte (LSB
– Big Endian
• Big Endian byte order puts the byte whose address is "x...x00" at the most significant
position in the is "x...x00" at the most significant position in the word (the big end)
• In Big Endian addressing, the address of a datum is the address of the most significant byte
(MSB)
X86 - ISA-16
• generally refers to the 16-bit instruction set architecture
used in early x86 processors
Segmented Memory: Utilizes a segmented memory model, dividing memory into segments
(code, data, stack) to extend the addressable space beyond 64KB (the limit for a 16-bit
address).
Registers: Includes several general-purpose registers (AX, BX, CX, DX), segment registers
(CS, DS, SS, ES), and pointer/index registers (SP, BP, SI, DI).
Instruction Set: Supports a variety of instructions for arithmetic, logic, control, and data
movement. Notable instructions include ADD, SUB, MOV, and JMP.
Operating Modes: Primarily runs in real mode, allowing direct access to hardware and
memory but with limited protection.
Compatibility: The ISA-16 is compatible with subsequent x86 architectures, allowing 16-
bit applications to run on later 32-bit and 64-bit processors.
Types of ISA-16 Instructions:
2. Immediate to Register
MOV r1, immediate : Load an immediate value into a register (e.g., MOV AX, 5).
3. Memory to Register
MOV r1, [address] : Move data from memory into a register (e.g., MOV AX, [1234h]).
4. Register to Memory
MOV [address], r1 : Move data from a register to a memory location (e.g., MOV [1234h], AX).
5. Immediate to Memory
MOV [address], immediate : Load an immediate value into a memory location (e.g., MOV [1234h], 5).
Flat Memory Model: Unlike the segmented model in ISA-16, ISA-32 introduces a flat memory model,
simplifying addressing and allowing direct access to up to 4GB of memory.
Extended Register Set: Introduces additional general-purpose registers (EAX, EBX, ECX, EDX) that are 32 bits
wide, along with the extended versions of existing registers (e.g., ESI, EDI, EBP, ESP).
Enhanced Instruction Set: ISA-32 includes a broader range of instructions and improved support for complex
data types and operations.
Protected Mode: Introduces protected mode, allowing for better memory management, multitasking, and access
control, which is critical for modern operating systems.
Support for Virtual Memory: Enhances the architecture's ability to manage virtual memory, enabling more
efficient use of RAM.
Instruction Extensions: Includes additional instruction sets such as MMX, SSE, and later extensions that
enhance multimedia processing and floating-point operations.
Instruction Categories
ISA-32 instructions similar to ISA-16 categorized into:
MMX (MultiMedia Extensions) is an instruction set extension to the x86 architecture, introduced by Intel in
1996 with the Pentium MMX processor. It was designed to accelerate multimedia and signal processing
applications by allowing parallel processing of multiple data points.
Packed Data Types: MMX allows operations on packed integers, enabling the simultaneous processing of
multiple data elements. For instance, it can handle multiple 8-bit or 16-bit integers in a single instruction.
Registers: MMX introduces a set of eight 64-bit registers (MM0 to MM7) that are used specifically for
MMX operations. These registers can hold packed data types.
Integer Operations: MMX primarily focuses on integer arithmetic and logical operations rather than
floating-point calculations.
Backward Compatibility: MMX instructions are designed to be backward compatible with existing x86
code, allowing applications to run without modification.
MMX (MultiMedia Extensions)
Instruction Count MMX includes approximately 57 instructions, covering a range of operations like:
MMX was a significant step towards enhancing multimedia processing capabilities in processors and
set the stage for later SIMD (Single Instruction, Multiple Data) extensions like SSE (Streaming SIMD
Extensions), which further expanded the range and type of operations that could be performed in
parallel
SSE (Streaming SIMD Extensions)
SSE (Streaming SIMD Extensions) is a set of instructions introduced by Intel starting with the Pentium III processor in
1999. It enhances the x86 instruction set for performing SIMD (Single Instruction, Multiple Data) operations, primarily
aimed at improving the performance of multimedia applications, 3D graphics, and scientific computations.
Packed Data Types: SSE supports operations on packed data types, allowing for parallel processing of multiple data
elements in a single instruction.
128-Bit Registers: SSE introduces a new set of 128-bit registers (XMM0 to XMM7) for holding packed data, allowing
for more efficient processing of data.
Data Types Supported: SSE works with various data types, including:
Packed single-precision floating-point (32 bits)
Packed double-precision floating-point (64 bits)
Packed integers (various sizes)
Floating-Point Operations: SSE enhances floating-point computation capabilities, making it suitable for a range of
applications like graphics and scientific calculations.
Instruction Categories
Arithmetic Operations ADDPS: Add packed single-precision floating-point values.
SUBPS: Subtract packed single-precision floating-point values.
MULPS: Multiply packed single-precision floating-point values.
SSE2
SSE3
SSE4
AVX
AVX2
AVX 512