Chapter 1
Chapter 1
2
Microcomputer system
A microcomputer system consists of a system unit, a keyboard, a display
screen and a disk drivers
The system unit is often referred to as the computer as it houses the circuit
boards of the computer
I/O devices perform input/output operations
Peripheral devices or peripherals
ICs are used to construct a computer circuit
Contains thousands of transistors
Digital circuits operate on voltage signal level
High/low (1/0) voltage
3
Microcomputer system (1)
These symbols are called binary digits or bits
All information represented by strings of 0’s and 1’s
Functionally computer circuits consist of three parts:
Central Processing Unit (CPU)
Memory circuits
I/O circuits
4
The System Board
5
Memory
Information processed by the computer is stored in its memory.
A memory circuit element can store one bit of data.
The memory circuits are usually organized into groups that can store eight
bits of data.
A string of eight bits is called a byte.
Memory byte is identified by a number that is called its “address”
Data stored in a memory byte are called its contents
6
Memory (1)
7
Memory (2)
Example: Suppose a processor uses 20 bits for an address. How many
memory bytes can be accessed?
Solution: A bit can have two possible values, so in a 20-bits address there
can be 220 = 1,048,576 different values, with each value being the potential
address of a memory byte. In computer terminology, the number 220 is
called 1 mega. Thus, a 20-bit address can be used to address 1 megabyte or 1
MB.
8
Memory (3)
Bit position
Represents in a microcomputer as word and a byte.
Positions are numbered from right to left, starting with 0.
In a word, 0 to 7 form as low byte and from 8 to 15 form as high byte
9
Memory (4)
Memory operations: Processor can perform two operations on memory
Read (fetch) – the content of a location, processor gets a copy of the data
Write (store) – data at a location, the new contents of the location
There are two kinds of memory circuits
RAM
Locations can be read and written
Contents of RAM memory are lost when the machine is turned off
ROM
Location can only be read
ROM retains their values even when the power is off
10
Memory (5)
Buses
A set of wires or connections called buses that connect the different
components
There are three kind of buses:
Address bus
Data bus
Control bus
11
The CPU
Refers as the brain of the computer.
Controls the computer by executing programs stored in memory.
System program
An application program
Instructions performed by a CPU are called its instruction set
Intel 8086 microprocessor as an example of a CPU
There are two main components:
Execution unit
Bus interface unit
12
Intel 8086 Microprocessor Organization
13
The CPU (2)
Execution Unit (EU)
The purpose of the EU is to execute instructions.
Contains a circuit called the arithmetic and logic unit (ALU).
ALU can perform arithmetic (+, - , / , x) and logic (AND, OR, NOT)
operations.
Data for the operations are stored in circuits called registers.
A memory location except that normally refer to it by a name rather than a
number.
EU has eight registers for storing data;
EU contains temporary ' registers for holding operands for the ALU, and the
FLAGS register
14
The CPU (3)
Bus Interface Unit (BIU)
Facilitates communication between the EU and the memory or I/O circuits.
Responsible for transmitting addresses, data, and control signals on the
buses.
Registers hold addresses of memory locations.
Fetches up to six bytes of the next instruction and places them in the
instruction queue
Instruction prefetch
15
I/O Ports
I/O devices are connected to the computer through I/O circuits
Contains several registers called I/O ports
I/O ports have addresses and are connected to the bus system.
Allows the CPU to distinguish between an I/O port and a memory
location.
Serial and Parallel Ports
Data transfer between an I/O port and an I/O device can be 1 bit at a time
(serial), or 8 or 16 bits at a time (parallel)
16
Instruction execution
A machine instruction has two parts:
Opcode
Specifies the type of operation.
Operands
Provide memory addresses to the data to be operated on.
The CPU goes through the following steps to execute a machine
instruction
Fetch
Execute
17
Fetch and Execute
1. Fetch an instruction from memory.
2. Decode the Instruction to determine the operation.
3. Fetch data from memory if necessary.
4. Perform the operation on the data.
5. Store the result in memory if needed.
Fetch
Execute
18
Programming Language
Machine language
A CPU can only execute machine language instructions
Bit strings
19
Programming Language (1)
Assembly language
A more convenient language
Uses symbolic names to represent operations, registers, and memory
locations.
Converts to machine language before the CPU can execute it
Assembler
20
Programming Language (2)
High-Level Languages
FORTRAN, Pascal, C and others.
Different high-level languages are designed for different applications.
Compiler is needed to translate a high-level language program into machine
code.
Advantages of High-Level Languages
Closer to natural languages.
Easier to convert a natural language algorithm to a high-level language
program.
Easier to read and understand a high-level language program .
Program can be executed on any machine
21
Programming Language (3)
Advantages of Assembly Languages
Produces a faster, shorter machine language program.
Easy to read or write to specific memory locations and I/O ports.
Many high-level languages accept subprograms written in assembly language.
Gains a feeling for the way the computer "think” and why certain things
happen the way they do inside the computer.
22
Assembly language program
Model Segment
Stack Segment
an assembler directive
Temporary storage of
that specifies the size of
addresses and data
the program
A program's instructions
are placed in the code
Data Segment segment
Variables are declared in
the data segment
23