Computer Organization and Assembly Language
Computer Organization and Assembly Language
Assembly Language
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
that provide of sets of instructions
functionality of the system that control the 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
Functions of a Computer
• Data processing
• Data storage
• Data movement
• Control
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
Computer Organization and Architecture
COMPUTER ORGANIZATION
COMPUTER ARCHITECTURE
• Anything that can be done with software can also be done with
hardware, and anything that can be done with hardware can also be
done with software
• Modern computers are implementations of algorithms that execute
other algorithms
Semantic Gap
• Suppression of detail
• Outline structure
• Division of responsibility
• Subdivision of system into smaller subsystems
Abstraction and Computer Systems
“I really don’t think that you can write a book for serious
computer programmers unless you are able to discuss
low-level details.”
Donald E. Knuth
The Art of Computer Programming
http://en.wikipedia.org/wiki/Donald_Knuth
Abstraction and Computer Systems
Machine-independent
• Text uses the following labels to describe
levels of abstraction in a computer system:
App7
Machine-specific
HOL6
Asmb5
OS4
ISA3
Mc2
LG1
Machine-independent
Level : APP7
Machine-specific
• An application may have some sort of
programming language associated with it
(macros or shortcuts, e.g.)
• Ideally, end users need not be concerned
with the actions and language(s)
associated with lower levels in the
abstraction hierarchy
Abstraction and Computer Systems
Machine-independent
Level : HOL6
Machine-specific
• Applications are typically written in high
order languages
• High order languages are characterized by:
• Portability across platforms
• Relative ease of use
• Relatively high level of abstraction, requiring
translation of program code prior to execution
Abstraction and Computer Systems
Machine-independent
Level : ASMB5
Machine-specific
particular processor
• Programs at the HOL6 level are usually
compiled to level Asmb5, then translated
(assembled) to machine language
• Source code can also be written in
assembly language
Abstraction and Computer Systems
Machine-independent
Level : OS4
Machine-specific
• Process synchronization
• Device management
• Operating systems were originally developed
for multiuser systems, but even most single
user systems utilize an operating system
• Compilers and assemblers are also
considered systems software
Abstraction and Computer Systems
Machine-independent
Level : ISA3
Machine-specific
particular hardware platform
• Instructions at this level are directly
executable without any translation
Abstraction and Computer Systems
Machine-independent
Level : MC2
Machine-specific
and out of the processor
• The processor’s control unit interprets
machine language instructions, causing
required actions to take place
Abstraction and Computer Systems
Machine-independent
Level : LG1
Machine-specific
wires
• Boolean algebra and truth tables can be
used to describe the operations at this
level
Anatomy of a Computer
Historical Development
23
Historical Development
24
Historical Development
25
Historical Development
– IBM 650
(1955)
– Phased out
in 1969.
27
Historical Development
28
Historical Development
29
Historical Development
30
Computer: Functional View
Data
Storage
Facility
Data
Control
Movement
Apparatus
Mechanism
Data
Processing
Facility
Computer: Operation
Data Movement
Data
Storage
Facility
Data
Control
Movement
Apparatus
Mechanism
Data
Processing
Facility
Computer: Operation..
Storage
Data
Storage
Facility
Data
Control
Movement
Apparatus
Mechanism
Data
Processing
Facility
Computer: Operation….
Data
Storage
Facility
Data
Control
Movemen
Mechanism
t
Apparatus
Data
Processing
Facility
Computer: Operation…...
Data
Storage
Facility
Data
Control
Movemen
Mechanism
t
Apparatus
Data
Processing
Facility
Anatomy of a Computer: Block Diagram
Anatomy of a Computer: Detailed Block Diagram
Anatomy of a Computer: Detailed Block Diagram
..
Detailed Anatomy of a Computer
Processor (CPU)
Datapath
Arithmetic
Logic Unit
(ALU)
Registers
Memory
Output
Program Input Units
Units
Storage
Data Storage
Anatomy of a Computer: CPU
The brain of a Computer System
Processor (CPU)
•Decodes and monitors the execution of instructions.
•Controls flow of information in CPU, memory, I/O
Control Unit devices:
Datapath •System clock (Intel® Core™ I7-720QM Processor
(1.6GHz, turbo up to 2.8GHz, 6MB L3 Cache))
•Maintains a register called program counter(PC)
Arithmetic
Logic Unit
(ALU) •ALU: performs all arithmetic computations & logic
Registers evaluations.
•Registers: storage location in CPU, used to hold data
or a memory address during the execution of an
instruction..
Anatomy of a Computer: Common Bus
Memory
Program
Storage
Data Storage
Components of memory
• A memory in Microprocessor stores data in binary format. To retrieve an information, the
Microprocessor assigns addresses to the location. Each location stores 1 byte of data.
• If a value of hex A0 is stored in the location of $2001, show the content of the memory
on $2001.
Anatomy of a Computer: I/O Devices
Input devices
Allow computer user to enter data & programs into the computer
Anatomy of a Computer: I/O Devices
Output device
• On the ENIAC
(1946-1955), all
programming
was done at the
digital logic
level.
• Programming
the computer
involved moving
plugs and wires.
46
The von Neumann Model
47
The von Neumann Model
48
The von Neumann Model
• This is a general
depiction of a von
Neumann system:
• These computers
employ a fetch-
decode-execute
cycle to run
programs as
follows . . .
49
The von Neumann Model
50
The von Neumann Model
51
The von Neumann Model
52
The von Neumann Model
53
The Modified von Neumann Architecture
(adding a system bus)
54
The System Bus Model
• A refinement of the von Neumann model, the system bus model has a CPU (ALU and
control), memory, and an input/output unit.
Application Programs
Machine Language
Microprogram Control
Hardware
Assembly and Machine Language
• Machine language
• Native to a processor: executed directly by hardware
• Instructions consist of binary code: 1s and 0s
• Assembly language
• A programming language that uses symbolic names to represent
operations, registers and memory locations.
• Slightly higher-level language
• Readability of instructions is better than machine language
• One-to-one correspondence with machine language instructions
High-Level Language: D = A * B + 10
• HLL programs are machine independent. They are easy to learn and
easy to use.
Source Object
File Assembler File