Lec02 ISA Intro
Lec02 ISA Intro
2024 Spring
Organization – First Glance
What is a Computer?
Components
• processor (datapath, control)
• input (mouse, keyboard)
• output (display, printer)
• memory (cache, main memory, disk drive, CD/DVD)
• network
Our primary focus: the processor (datapath and control) and its interaction with
memory systems
• Implemented using tens/hundreds of millions of transistors
• Impossible to understand by looking at each transistor
• We need abstraction!
3/33
Which one is not a component of a computer?
• A: processor
• B: I/O
• C: memory
• D: fan
4/33
Major Components of a Computer
5/33
Computer System
File Device
Kernel
Systems Drivers
User API
Security System Call
GUI
Operation System
Data
CPU Memory
Storage
Network User I/O
Display
Adapter Devices
Hardware
6/33
Machine Organization
7/33
Processor Organization
8/33
System Software
Applications software
Systems software
Hardware
Operating System
• Supervising program that interfaces the user’s program with the hardware (e.g.,
Linux, iOS, Windows)
• Handles basic input and output operations
• Allocates storage and memory
• Provides for protected sharing among multiple applications
Compiler
• Translate programs written in a high-level language (e.g., C, Java) into instructions
that the hardware can execute 9/33
Which one is not a task of an operating system?
• A: output images to the screen
• B: create files
• C: translate C program to assembly language
• D: switch the processes that run on the processor
10/33
Advantages of Higher-Level Languages ?
• Allow the programmer to think in a more natural language and for their intended
use (Fortran for scientific computation, Cobol for business programming, Lisp for
symbol manipulation, Java for web programming, ...)
• Improve programmer productivity – more understandable code that is easier to
debug and validate
• Improve program maintainability
• Allow programs to be independent of the computer on which they are developed
(compilers and assemblers can translate high-level language programs to the binary
instructions of any machine)
• Emergence of optimizing compilers that produce very efficient assembly code
optimized for the target machine
11/33
Traditional Compilation Flow
C program
Compiler
Assembler
Linker
Loader
Memory 12/33
Below the Program
13/33
Below the Program
Max # of operations?
13/33
Input Device Inputs Object Code
Processor Devices
Network
Control Memory Input
Datapath Output
14/33
Object Code Stored in Memory
15/33
Object Code Stored in Memory
15/33
Decode & Excute Codes
Processor Devices
Network
Control
000000 00100 00010 0001000000100000
Memory
Input
Datapath
Output
16/33
Decode & Excute Codes
Processor Devices
Network
Control
000000 00100 00010 0001000000100000
Memory
Input
Datapath
contents Reg #4 ADD contents Reg #2
results put in Reg #2 Output
16/33
What Happens Next?
17/33
Output Device Outputs Data
Processor Devices
Network
Control Memory Input
Datapath Output
00000100010100000000000000000000
00000000010011110000000000000100
00000011111000000000000000001000
18/33
ISA
ISA – Bridge between Hardware & Software
Software
Applications
Operation System
Hardware
20/33
Connection
C program
Web Misc.
Games Assembly language program
Browsers Utilities
Applications
Assembler
Software
File Device Machine language Library routine
Kernel Applications
Systems Drivers
Operation System
Instruction Set Architecture Executable: Machine language
Data Hardware
CPU Memory Loader
Storage
Network User I/O
Display Memory
Adapter Devices
Hardware
21/33
Instruction Set Architecture (ISA)
The interface description separating the software and hardware
software
hardware
22/33
Instruction Set Architecture (ISA)
• ISA, or simply architecture – the abstract interface between the hardware and the
lowest level software that includes all the information necessary to write a machine
language program, including instructions, registers, memory access, I/O, ...
• Enables implementations of varying cost and performance to run identical software
• The combination of the basic instruction set (the ISA) and the operating system
interface is called the application binary interface (ABI)
• ABI: The user portion of the instruction set plus the operating system interfaces used
by application programmers. Defines a standard for binary portability across
computers.
23/33
Two Key Principles of Machine Design
1 Instructions are represented as numbers and, as such, are indistinguishable from data
2 Programs are stored in alterable memory (that can be read or written to) just like data
Memory
Accounting prg
(machine code)
Stored-Program Concept
C compiler
• Programs can be shipped as files of binary numbers – binary (machine code)
compatibility
• Computers can inherit ready-made software provided they are Payroll
compatible with an existing ISA – leads industry to align data
around a small number of ISAs
Source code in
C for Acct prg
24/33
Assembly Language Instructions
Design Goals
Maximize performance, minimize cost, reduce design time (time-to-market), minimize
memory space (embedded systems), minimize power consumption (mobile systems)
25/33
RISC-V
CISC vs. RISC
• Intel x86
• RISC-V, LC-3b, MIPS, ARM, Sun SPARC, HP PA-RISC, IBM PowerPC ...
27/33
History of MIPS (cont.)
28/33
Welcome to RISC-V
RISC-V
• An open standard instruction set architecture (ISA)
• A clean break from the earlier MIPS-inspired designs
• Modular ISA organization
• Open standards, numerous proprietary and open-source cores
• Managed by RISC-V Foundation
29/33
The RISC-V ISA I
Instruction Categories
4 Base Instruction Formats: all 32 bits wide
• Load and Store instructions
• Bitwise instructions
• Arithmetic instructions
• Control transfer instructions
• Pseudo instructions
30/33
Which one is not a part of ISA?
• A: load/store instructions
• B: arithmetic operations
• C: printf function
• D: control tranfer instructions
31/33
Which one is not a part of ISA?
• A: load/store instructions
• B: arithmetic operations
• C: printf function
• D: control tranfer instructions
Ans: C
31/33
Register names and descriptions
32/33
Which register cannot we store an operand when we call “max(a, b)”?
• A: x0 (zero)
• B: x3 (gp)
• C: x9 (s1)
• D: x11 (a1)
33/33
Which register cannot we store an operand when we call “max(a, b)”?
• A: x0 (zero)
• B: x3 (gp)
• C: x9 (s1)
• D: x11 (a1)
Ans: A
33/33