0% found this document useful (0 votes)
51 views

Basic Concepts: Microprocessor & Assembly Language Programming

The document discusses the goals and background needed for a lecture on basic concepts in computer organization and assembly language programming. The lecture aims to cover the basic organization of computer systems, processor architecture, writing assembly language programs, and how programs interact with hardware and operating systems. Students should already know how to program in a high-level language like Java or C.

Uploaded by

Ali Raza Haider
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views

Basic Concepts: Microprocessor & Assembly Language Programming

The document discusses the goals and background needed for a lecture on basic concepts in computer organization and assembly language programming. The lecture aims to cover the basic organization of computer systems, processor architecture, writing assembly language programs, and how programs interact with hardware and operating systems. Students should already know how to program in a high-level language like Java or C.

Uploaded by

Ali Raza Haider
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 24

Lecture 1

Basic Concepts
Microprocessor
&
Assembly Language Programming
Goals and Required Background
 Goals: broaden student’s interest and knowledge in …
 Basic organization of a computer system
 Intel IA-16 and IA-32 processor architecture
 How to write assembly language programs
 How high-level languages translate into assembly language
 Interaction between the assembly language programs, libraries,
the operating system, and the hardware
 How interrupts, system calls, and handlers work

 Required Background
 The student should already be able to program confidently in at
least one high-level programming language, such as Java or C.
Basic Concepts Computer Organization and Assembly Language
slide 2/43
Hardware

 Hardware is the machine itself and its various individual


equipment.
 It includes all mechanical, electronic and magnetic
devices such as monitor, printer, electronic circuit, floppy
and hard disk.

Basic Concepts Computer Organization and Assembly Language


slide 3/43
3
SOFTWARE

 Software refers to the set of computer programs, which


are used in applications and operating systems.

 It is the collection of programs, which increase the


capabilities of the hardware.

 Software guides the computer at every step where to


start and stop during a particular job.

 The process of software development is called


programming.

Basic Concepts Computer Organization and Assembly Language


slide 4/43
4
SOFTWARE TYPES

 Application Software :

 useful for word processing, accounting, application


Software is a set of programs for a specific application.

 Application software is reducing statistical report,


Graphics, Excel and Data Base.

 programming languages COBOL, FORTRAN, C++, VB,


VC, Java

Basic Concepts Computer Organization and Assembly Language


slide 5/43 5
 System Software:

 When you switch on the computer the programs written in


ROM is executed which activates different units of your
computer and makes it ready for you to work.

 This set of programs can be called system software.

 System software are general programs designed for


performing tasks such as controlling all operations required to
move data into and out of the computer

 System Software allows application packages to be run on the


computer.

Basic Concepts Computer Organization and Assembly Language


slide 6/43 6
 Computer manufactures build and supply this
system software with the computer system.

 DOS, UNIX and WINDOWS are some of the


widely used operating system software.

 Out of these UNIX is a multi-user operating


system whereas DOS and WINDOWS are PC-
based.

Basic Concepts Computer Organization and Assembly Language 7


slide 7/43
A Hierarchy of Languages

Basic Concepts Computer Organization and Assembly Language


slide 8/43
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
 Assemblers translate assembly to machine code
 Compilers translate high-level programs to machine code
 Either directly, or
 Indirectly via an assembler
Basic Concepts Computer Organization and Assembly Language
slide 9/43
Compiler and Assembler

Basic Concepts Computer Organization and Assembly Language


slide 10/43
Instructions and Machine Language
 Each command of a program is called an instruction (it
instructs the computer what to do).

 Computers only deal with binary data, hence the


instructions must be in binary format (0s and 1s) .

 The set of all instructions (in binary form) makes up the


computer's machine language. This is also referred to as
the instruction set.

Basic Concepts Computer Organization and Assembly Language


slide 11/43
Instruction Fields
 Machine language instructions usually are made up of
several fields. Each field specifies different information
for the computer. The major two fields are:
 Opcode field which stands for operation code and it
specifies the particular operation that is to be performed.
 Each operation has its unique opcode.
 Operands fields which specify where to get the source
and destination operands for the operation specified by
the opcode.
 The source/destination of operands can be a constant, the
memory or one of the general-purpose registers.

Basic Concepts Computer Organization and Assembly Language


slide 12/43
Assembly vs. Machine Code

Flash Movie

Basic Concepts Computer Organization and Assembly Language


slide 13/43
Translating Languages
English: D is assigned the sum of A times B plus 10.

High-Level Language: D = A * B + 10

A statement in a high-level language is translated


typically into several machine-level instructions

Intel Assembly Language: Intel Machine Language:


mov eax, A A1 00404000
mul B F7 25 00404004
add eax, 10 83 C0 0A
mov D, eax A3 00404008

Basic Concepts Computer Organization and Assembly Language


slide 14/43
Address, Data and Control Bus
 To inform memory whether processor wants to read or
write – control bus
 To inform memory the precise element processor is
interested in – address bus
 To transfer the data element from memory to processor
– data bus
Address Bus

Data Bus
MEMORY
PROCESSOR
Control Bus

I/O DEVICES

Basic Concepts Computer Organization and Assembly Language


slide 15/43
Address, Data and Control Bus
 Memory cell is an n-bit location to store data
 Cell width along with number of cells define the memory
completely
 Width of all the buses

Basic Concepts Computer Organization and Assembly Language


slide 16/43
Registers
 Only one address bus so only one operand can be
brought from memory.
 Other operand must be in the registers
 Types of registers
 Accumulator
 Pointer, Index or Base Address
 Flag Register or Program Status Word
 Program Counter or Instruction Pointer

Basic Concepts Computer Organization and Assembly Language


slide 17/43
Instruction Groups
 Data Movement Instruction
 Arithmetic and Logic Instructions
 Program Control Instructions
 Special Instructions

Basic Concepts Computer Organization and Assembly Language


slide 18/43
Basic Computer Organization
 Since the 1940's, computers have 3 classic components:
 Processor, called also the CPU (Central Processing Unit)
 Memory and Storage Devices
 I/O Devices
 Interconnected with one or more buses
 Bus consists of data bus

 Data Bus registers

 Address Bus Processor Memory


I/O I/O
Device Device
(CPU)
 Control Bus #1 #2

ALU CU clock

control bus

address bus

Basic Concepts Computer Organization and Assembly Language


slide 19/43
Processor (CPU)
 Processor consists of
 Datapath
Flash Movie
 ALU
 Registers
 Control unit
 ALU Flash Movie

 Performs arithmetic
and logic instructions
 Control unit (CU)
 Generates the control signals required to execute instructions
 Implementation varies from one processor to another

Basic Concepts Computer Organization and Assembly Language


slide 20/43
Memory
 Ordered sequence of bytes
 The sequence number is called the memory address

 Byte addressable memory


 Each byte has a unique address
 Supported by almost all processors

 Physical address space


 Determined by the address bus width
 Pentium has a 32-bit address bus
 Physical address space = 4GB = 232 bytes
 Itanium with a 64-bit address bus can support
 Up to 264 bytes of physical address space
Basic Concepts Computer Organization and Assembly Language
slide 21/43
Address Space

Address Space is
the set of memory
locations (bytes) that
can be addressed

Basic Concepts Computer Organization and Assembly Language


slide 22/43
CPU Memory Interface
 Address Bus
 Memory address is put on address bus
 If memory address = m bits then 2m locations are addressed
 Data Bus: b-bit bi-directional bus
 Data can be transferred in both directions on the data bus
 Note that b is not necessary equal to w or s. So data transfers
might take more than a single cycle (if w > b) .
 Control Bus
 Signals control
transfer of data
 Read request
 Write request
 Complete transfer
Basic Concepts Computer Organization and Assembly Language
slide 23/43
Typical Memory Hierarchy
 Registers are at the top of the hierarchy
 Typical size < 1 KB
 Access time < 0.5 ns
 Level 1 Cache (8 – 64 KB) Microprocessor

 Access time: 0.5 – 1 ns Registers

 L2 Cache (512KB – 8MB) L1 Cache

 Access time: 2 – 10 ns L2 Cache

Bigger
 Main Memory (1 – 2 GB) Faster Memory Bus

 Access time: 50 – 70 ns Memory

I/O Bus
 Disk Storage (> 200 GB)
Disk, Tape, etc
 Access time: milliseconds
Basic Concepts Computer Organization and Assembly Language
slide 24/43

You might also like