0% found this document useful (0 votes)
2 views29 pages

Microprocessor 1 Week1

The document states that the training data is current up to October 2023. No additional details or context are provided. It emphasizes the cutoff date for the information available.

Uploaded by

semih sağlam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views29 pages

Microprocessor 1 Week1

The document states that the training data is current up to October 2023. No additional details or context are provided. It emphasizes the cutoff date for the information available.

Uploaded by

semih sağlam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 29

MİKRO İŞLEMCİLER

Dr. Öğr. Üyesi Bahattin


KARAKAYA
1. Week
Ders Müfredatı
• Dr. Öğr. Üyesi Bahattin KARAKAYA

• İ.Ü. – Cerrahpaşa Avcılar Kampüsü


Mühendislik Fakültesi B-Blok
Elektrik Elektronik Mühendisliği Bölümü
5. Kat, MF8 – 505 nolu oda

[email protected]
• 0 531 959 68 52
• 0 212 473 70 70 / 20 963

KAYNAK Kitaplar:
• Mazidi, Muhammad Ali - Chen, Shujen - Ghaemi, Eshragh -
STM32 Arm Programming for Embedded Systems-
MicroDigitalEd (2019)
• Muhammad Ali Mazidi, Sarmad Naimi, Sepehr Naimi, Janice
Mazidi - ARM Assembly Language_ Programming and
Architecture (2013)
• Muhammad Ali Mazidi, Janice Gillispie-Mazidi - 80X86 IBM PC
and Compatible Computers Assembly Language, Design,
and Interfacing Volumes I & II-Prentice Hall (2002)
Numbering and Coding Systems
Converting from decimal to binary
• Divide the decimal number by 2 repeatedly, keeping track
of the remainders.
• This process continues until the quotient becomes zero.
• The remainders are then written in reverse order to obtain
the binary number.
Numbering and Coding Systems
Converting from binary to decimal

• The weight of numbers in the


base 10 system
• Similarly, each digit position in a
number in base 2 has a weight
associated with it
Numbering and Coding Systems
Converting from binary to decimal
Numbering and Coding Systems
Hexadecimal system
• In computer literature, Base16 or
hexadecimal system is used as a
convenient representation of
binary numbers.
• For example, it is much easier for
a human being to represent a
string of 0s and 1s such as:
100010010110 as its hexadecimal
equivalent of 896 H.

Converting between binary and hex


• To represent a binary number as its
equivalent hexadecimal number.
– start from the right and group 4 bits at a time
– replacing each 4-bit binary number with its hex
equivalent shown in Table 0-1.

100010010110
8 9 6
Numbering and Coding Systems
Converting between binary and hex
Numbering and Coding Systems
Converting from decimal to hex
Could be approached in two ways:

1. Convert to binary first and then convert to hex.

2. Convert directly from decimal to hex by the method of


repeated division, keeping track of the remainders.
Numbering and Coding Systems
Converting from decimal to hex
Numbering and Coding Systems
Converting from hex to decimal
can also be approached in two ways:
1. Convert from hex to binary and then to decimal.
2. Convert directly from hex to decimal by summing the
weight of all digits.
Numbering and Coding Systems
Counting in bases 10, 2, and 16
Numbering and Coding Systems
Addition of binary and hex numbers

Note: all computers use the addition process to implement subtraction.


Although computers have adder circuitry, there is no separate circuitry for
subtractors. Instead, adders are used in conjunction with 2 s complement
circuitry to perform subtraction. In other words, to implement "x - y", the
computer takes the 2's complement of y and adds it to x.
Numbering and Coding Systems
2's complement
To get the 2's complement of a binary number, invert all the
bits and then add 1 to the result. Inverting the bits is simply a
matter of changing all 0 s to 1 s and 1 s to 0 s. This is called
the 1 s complement.
Numbering and Coding Systems
Addition of hex numbers
Starting with the least significant digits, the digits are added
together. If the result is less than 16, write that digit as the
sum for that position. If it is greater than 16, subtract 16 from
it to get the digit and carry 1 to the next digit.
Numbering and Coding Systems
Subtraction of hex numbers
if the second digit is greater than the first, borrow 16 from the
preceding digit.
Numbering and Coding Systems
ASCII Code
In the 1960s a standard representation called ASCII
(American Standard Code for Information Interchange) was
established. The ASCII code assigns binary patterns for
• numbers 0 to 9,
• all the letters of the English alphabet, both uppercase
(capital) and lowercase,
• many control codes and punctuation marks.
The ASCII code is a binary code used to represent
alphanumeric data internally in the computer. It is frequently
used in peripheral devices for input and/or output.
The ASCII system uses a total of 7 bits to represent each
code.
For example,
100 0001 is assigned to the uppercase letter "A"
and
110 0001 is for the lowercase "a''.
Often, a zero is placed in the most significant bit position to
make it an 8-bit code.
Numbering and Coding Systems
ASCII Code
Numbering and Coding Systems
Review Questions
1. Why do computers use the binary number
system instead of the decimal system?
2. Convert to binary and hex.
3. Convert to hex and decimal.
4. Perform binary addition: 101100 + 101.
5. Convert to its 2's complement
representation.
6. Add 36BH + F6H.
7. Subtract 36BH - F6H.
8. Write "80x86 CPUs" in its ASCII code (in
hex form).
Inside the Computer
Some important terminology
Bit 0
Nibble 0000
Byte 0000 0000
Word / Half Word 0000 0000 0000 0000
(for x86) / (for ARM)

Word (for ARM)


0000 0000 0000 0000 0000 0000 0000 0000

1 Kbyte = bytes = 1024 bytes


1 megabyte = bytes = 1.048.576 bytes
1 gigabyte = bytes = more than bytes
1 terabyte = bytes = more than bytes
Inside the Computer
Internal Organization of the Computers

CPU (central processing unit), execute (process) information stored in


memory
Memory temporary or permanent storage of data.
• RAM
• ROM
I/O (input/output) devices : Allow the computer to input information for
processing and then output the results. I/O devices also known as
computer peripherals.
Bus (strips of wire): inside a computer carries information from place to
place just as a street bus carries people from place to place
• Data bus ▪ Address bus ▪ Control bus
Inside the Computer
Internal Organization of the Computers
The integrated Circuit (IC) chip containing the CPU is called the
microprocessor

and the entire computer including the microprocessor, memory and


I/O is called a microcomputer or a microcontroller.
Inside the Computer
Internal Organization of the Computers

In every computer there are three types of busses:


1. Address Bus: The address bus is used to identify the memory location
or I/O device the processor intends to communicate with. The width of the
Address Bus ranges from 20 bits (8086) to 36 bits for (Pentium II).
2. Data Bus: Data bus is used by the CPU to get data from / to send data
to the memory or the I/O devices. The width of a microprocessor is used to
classify the microprocessor. The size of data bus of Intel microprocessors
vary between 8-bit (8085) to 64-bit (Pentium).
3. Control Bus: How can we tell if the address on the bus is memory
address or an I/O device address? This where the control bus comes in.
Each time the processor outputs an address it also activates one of the
four control bus signals: Memory Read, Memory Write, I/O Read and I/O
Write.
 The address and control bus contains output lines only, therefore it is
unidirectional, but the data bus is bidirectional.
Inside the Computer
Internal Organization of the Computers

There two types of memory used in microcomputers:


♦ RAM (Random Access Memory/ Read-Write memory) is used by
the computer for the temporary storage of the programs that is
running. Data is lost when the computer is turned off. So known as
volatile memory.
♦ ROM (Read Only Memory) the information in ROM is permanent
and not lost when the power is turned off. Therefore, it is called
nonvolatile memory.
Note that RAM is sometimes referred as primary storage, where
magnetic /optical disks are called secondary storage.
Inside the Computer
Inside the Computer
A step-by-step analysis of the process of a CPU
Adding three numbers
• An imaginary CPU has registers called A, B, C, and D
• It has an 8-bit data bus and a 16-bit address bus.
• Therefore, the CPU can access memory from
addresses 0000 to FFFFH (for a total of 10000H
locations).
Assume that
• the code for the CPU to move a value to register A is 1011 0000
(B0H)
and
• the code for adding a value to register A is 0000 0100 (04H).

The necessary steps and code to perform them are as follows :

Action Code Data


Move value 21 H into register A B0H 21H
Add value 42H to register A 04H 42H
Add value 12H to register A 04H 12H
A step-by-step analysis of the process of a CPU
Adding three numbers
• If the program to perform the actions listed above is stored in
memory locations starting at 1400H, the following would
represent the contents for each memory address location:

Memory
Address Contents of memory address

1400H B0H the code for moving a value to register A


1401H 21H the value to be moved

1402H 04H the code for adding a value to register A

1403H 42H the value to be added

1404H 04H the code for adding a value to register A


1405H 12H the value to be added

1406H F4H the code for halt


A step-by-step analysis of the process of a CPU
Adding three numbers
The program
The CPU program counter is updated
(instruction) to 1406H.
counter Memory Address Contents
Meanwhile
The
The
AfterCPU decodes
puts
completing the
1400H oneprogram
the instruction
on the B0H
address
instruction, counter
with the
the
From
Finally,
help of its
mustand be memory
the contents
instruction
set location
of value
toit decoder
the address 1402H
dictionary.1406
1400H, When areitit
becomes
bus
program sends1404,
counter the
out. address
The
points memory of the 1400H B0H
fetches
fetched
finds code
in
the definition
indicating and
the 04H.
address After
forexecuted.
that decoding,
instruction
of This
the itto theit
HALT
knows
first
B0H
circuitry
next finds
instruction. the location while the
address
instruction
must
CPU bring
knows
instruction
CPU
ofcode
into
activates
the
tells
register
that
tonext
the
the
beA
it of instruction
must CPU
the
executed.
READ
CPUadd to
the
After
signal, toto
bytebe
stop
in
the 1401H 21H
21H
the next 1404H
Address the isprogram
put
incrementing
executed,
contents
the program
indicating to
memory
of which
register
counter
memory inA on
location.
has
that the
been
it
the
counter
this byte
wants
address
Therefore,
case
loaded sitting
the isit
and
1402H 04H
commands
bus
asking and for itsthe
the controller
code next iscircuitry
fetched
instruction. to do into exactly
In the
the 04H
1402H.
with
at the
byte
that. the Address
address
at next
When location address
it brings of 1402
the
1400H. first
(1403).
in value is
This sent
instruction,
21H causes out
from memory on
CPU,
absence
the
the CPU
the
location decoded,
addressof
is ready
contents
1401,
the
bus
of
it makes toand
HALT,
to executed.
execute.
memory
sure
the
fetch
that
CPU
the
doors next
location
the This
would
of all
1403H 42H
42H
continue
code isupdating
again the program
adding a counter
value and
registers are closed
instruction.
1400H, which is B0, exceptto be register
put A. the to
onTherefore, 1404H 04H
04H
fetching
register
when instructions.
valueA. 21H comes into into the the CPU.
CPU it will go
data bus and brought
directly into register A. 1405H 12H
12H
1406H F4H
F4H
Address Bus
1402H
1400H
1401H
1404H
1405H
1406H
1403H

Memory
Memory READ
READ
Control Bus Memory write
63H
Data Bus
63H
75H
21H
Inside the Computer
Review Questions
1. How many bytes is 24 kilobytes ?
2. What does "RAM" stand for? How is it used in computer systems?
3. What does "ROM" stand for? How is it used in computer systems?
4. Why is RAM called volatile memory?
5. List the three major components of a computer system.
6. What does "CPU" stand for? Explain its function in a computer.
7. List the three types of buses found in computer systems and state
briefly the purpose of each type of bus.
8. State which of the following is unidirectional and which is
bidirectional.
(a) data bus (b) address bus
9. If an address bus for a given computer has 16 lines, then what is
the maximum amount of memory it can access?
10. What does "ALU" stand for? What is its purpose?
11. How are registers used in computer systems?
12. What is the purpose of the program counter?
13. What is the purpose of the instruction decoder?

You might also like