01 Introduction v1.2
01 Introduction v1.2
INTRODUCTION TO COMPUTER
SYSTESM
Computing Machines
Ubiquitous ( = everywhere)
• General purpose: servers, desktops, laptops, PDAs, etc.
• Special purpose: cash registers, ATMs, games, Mobile
Phones, etc.
• Embedded: cars, door locks, printers, digital players,
industrial machinery, medical equipment, etc.
Distinguishing Characteristics
• Speed
• Cost
• Ease of use, software support & interface
• Scalability
Computer
Hardware Software
Electronics circuit boards Program consists of
that provide sets of instructions
functionality of the that control the
system system
Inside the Computer
• Application software
• Written in high-level language
• System software
• Compiler: translates HLL code to machine
code
• Operating System: service code
• Handling input/output
• Managing memory and storage
• Scheduling tasks & sharing resources
• Hardware
• Processor, memory, I/O controllers
Abstraction Layers in Modern Systems
– Applications software
– Systems software Application
– Assembly Language Algorithm
– Machine Language
Programming Language
– Architectural Approaches:
Caches, Virtual Operating System/Virtual Machines
Memory, Instruction Set
Pipelining
– Sequential logic, finite state Architecture (ISA)
machines Microarchitecture
– Combinational logic, arithmetic Gates/Register-Transfer
circuits
Level (RTL)
– Boolean logic, 1s and 0s
– Transistors used to build logic Circuits
gates (e.g. CMOS) Devices
– Semiconductors/Silicon used to
Physics
build transistors
14
– Properties of atoms, electrons,
and quantum dynamics
Functions of a Computer
• Data processing
• Data storage
• Data movement
• Control
Function Units in a Computer
1
Irvine, Kip R. Assembly Language for Intel-Based
Computers, 2003.
7
1
Irvine, Kip R. Assembly Language for Intel-Based
Computers, 2003.
8
1
Irvine, Kip R. Assembly Language for Intel-Based
Computers, 2003.
9
20
21
22
23
A Programmer’s View of a Computer
Application Programs
Machine Language
Microprogram Control
Hardware
Levels of Program Code
• High-level language
• Level of abstraction
closer to problem
domain
• Provides productivity
and portability
• Assembly language
• Textual
representation of
instructions
• Hardware
representation
• Binary digits (bits)
• Encoded instructions
and data
Below the Program
Applications software
Systems software
Hardware
• System software
– Operating system – supervising program that interfaces
the user’s program with the hardware (e.g., Linux,
MacOS, 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
Below the Program
• High Level Language Program in C
void swap(int v[], int k)
{
int temp;
temp = v[k];
v[k] =
v[k+1];
v[k+1] =
temp;
}
• AssAssembly
sll $2, $5, 4
Languageadd
lw
$2, $4, $2
$15, 0($2)
Mips sw jr
$15, 4($2)
$31 0000000010100001
swap: 0…
0000000000011000
• Machine Language 0…
1000110001100010
0…
1000110011110010
0…
1010110011110010
0…
Advantages of HLLs
• Higher-level languages (HLLs)
Assemb
ler
0000 1001 1100 0110 1010 1111 0101 1000
1010 1111 0101 1000 0000 1001 1100 0110
Machine Language 1100 0110 1010 1111 0101 1000 0000 1001
Program 0101 1000 0000 1001 1100 0110 1010 1111
Machin
Control Signal
e ALUOP[0:3] <= InstReg[9:11] &
SpecificationInterpr MASK
° etation [i.e.high/low on control lines]
°
Execution Cycle
Instruction
Fetch Obtain instruction from program storage
Instruction
Determine required actions and instruction size
Decode
Result
Deposit results in storage for later use
Store
Next
Instruction Determine successor instruction
Program Performance
• Program performance is measured in terms of
time!
32
Clock, Clock Cycle Time
• Circuits in computers are “clocked”
• At each clock rising (or falling) edge, some specified actions are done,
usually within the next rising (or falling) edge
• Instructions typically require more than one cycle to execute
Function block
(made of
clock cycle
time
circuits)
cloc
k
33
Program Performance
• # of clock cycles =
(# of instructions executed)
(average cycles per instruction)
Moore’s Law
COMPUTER ARCHITECTURE
ISA Level
• Capabilities & Performance Characteristics of FUs & Interconnect
Principal Functional Units (e.g., Registers, ALU,
Shifters, Logic Units, ...)
• Ways in which these components are
interconnected
• Information flows between
components
• Logic and means by which such information
flow is controlled.
• Choreography of FUs to realize the ISA
• Register Transfer Level (RTL) Description
Organization of a Computer
• Five classic components of a computer – input, output, memory,
datapath, and control
Computer Organization
Organization of a Computer
Computer Organization
• Components:
– input (mouse, keyboard, camera, microphone...)
– output (display, printer, speakers....)
– memory (caches, DRAM, SRAM, hard disk drives, Flash....)
– network (both input and output)
• Our primary focus: the processor (datapath and control)
– implemented using billions of transistors
– Impossible to understand by looking at each transistor
– We need...abstraction!
bottleneck.
THE VON NEUMANN MODEL
15
THE VON NEUMANN MODEL
16
System Bus Architecture
17
18
Assembly Language
• How does assembly language (AL) relate to
machine language? One to one
• How do C++ and Java relate to AL? one-to-
many
• Is AL portable? no
• Why learn AL?
Assembly Level
Language 4
Operating
Level
System
3
Instruction
Set Level
Architecture 2
Microarchitect Level
ure 1
Digital
Level
Logic
0
(descriptions of individual
levels follow . . . )
software
hardware
ISA and Computer Architecture
Application
Operating
System
Compiler
Firmware
Instruction Set Architecture
• ISA Includes
– Organization of storage
– Data types
– Encoding and representing instructions
– Instruction Set (i.e. opcodes)
– Modes of addressing data items/instructions
– Program visible exception handling
• ISA together with OS interface specifies the requirements for binary compatibility
across implementations (ABI: application binary interface)
Instruction Set Architecture
• Instruction Categories
– Load/Store
– Computational
– Jump and Branch
– Floating Point
– Memory Management
– Special
Microarchitecture
• Level 1
• Interprets conventional
machine instructions (Level
2)
• Executed by digital
hardware (Level 0)
next: Data
Representatio
n
Irvine, Kip R. Assembly Language for Intel-Based 34
Computers, 2003.
35
Java Virtual Machine
Every binary
number is a
sum of
powers of 2
binary 00001001 =
decimal 9:
(1 23) + (1 20) = 9
Irvine, Kip R. Assembly Language for Intel-Based
Computers, 2003.
24
Translating Unsigned Decimal to Binary
• Repeatedly divide the decimal integer by
2. Each remainder is a binary digit in the
translated value:
37.6875 =
100101.1011
Irvine, Kip R. Assembly Language for Intel-Based
Computers, 2003.
Exercises
0 0 0 0 1 0 1 1 (11)
bit position: 7 6 5 4 3 2 1 0
Standard 1
8 word 6 3
sizes: doublewor 2
6
d 4
quadwor
d
21 / 16 = 1,
rem 5
16 + 5 = 21 – 7 = 14 = E
–1
C6
75
A2
47
24
Practice: The address of2E
var1 is 00400020. The address of
the next variable after var1 is 0040006A. How many bytes
are used by var1?
1 1 1 1 0 1 1 0
Negative
0 0 0 0 1 0 1 0
Positive
00001100 0000110
– 0000001 0
1 1
0101
0101
1100
1
01
• pure binary
• can be calculated
directly
• ASCII binary
• string of digits:
"01010101"
• ASCII decimal
• string of digits: "65"
• ASCII hexadecimal
• string of digits: "9C"
next:
Boolean
Operations
Irvine, Kip R. Assembly Language for Intel-Based 51
Computers, 2003.
ASCII
• In binary
❑ ±1.xxxxxxx2 × 2yyyy
• Types float and double
in C
Floating Point
Fraction) Bias)
• 2. Add significands
➢ 1.000 × 2–1 + –0.111 × 2–1 = 0.001 × 2–1
2 2 2
Step 1
Step 2
Step 3
Step 4
Floating-Point Multiplication