Professional Documents
Culture Documents
ECE344L - Microprocessors
Slide: 1
Overview
Basic Architecture of Computer
Number system
ECE344L - Microprocessors
Slide: 2
ECE344L - Microprocessors
Slide: 3
IR
Decode/
Control
ECE344L - Microprocessors
Memory
Functional
Activities
of
CPU
(ALU)
Input/
Output
Functions
General
Purpose
Regs
Special
Purpose
Regs
Slide: 4
PC
MAR
IR
Decode/
Control
ECE344L - Microprocessors
Memory
Functional
Activities
of
CPU
(ALU)
Input/
Output
Functions
General
Purpose
Regs
Special
Purpose
Regs
Slide: 5
IR
Decode/
Control
ECE344L - Microprocessors
MAR
Memory
Functional
Activities
of
CPU
(ALU)
Input/
Output
Functions
General
Purpose
Regs
Special
Purpose
Regs
Slide: 6
Instruction from
memory is stored
in IR
ECE344L - Microprocessors
IR
Decode/
Control
Memory
Functional
Activities
of
CPU
(ALU)
Input/
Output
Functions
General
Purpose
Regs
Special
Purpose
Regs
Slide: 7
IR
Instruction stored
in IR is decoded
ECE344L - Microprocessors
Decode/
Control
Memory
Functional
Activities
of
CPU
(ALU)
Input/
Output
Functions
General
Purpose
Regs
Special
Purpose
Regs
Slide: 8
IR
Decode/
Control
ECE344L - Microprocessors
Memory
Functional
Activities
of
CPU
(ALU)
Input/
Output
Functions
General
Purpose
Regs
Special
Purpose
Regs
Slide: 9
Fetch Example
PC
201
MAR
IR
201
cmp 0,r2,0x00
202
lbz r2,0(r1)
203
lbz r3,0(r1)
204
205
ECE344L - Microprocessors
Slide: 10
Fetch Example
PC
202
MAR
IR
201
cmp 0,r2,0x00
202
lbz r2,0(r1)
203
lbz r3,0(r1)
204
205
ECE344L - Microprocessors
Slide: 11
Fetch Example
PC
MAR
202
202
IR
201
cmp 0,r2,0x00
202
lbz r2,0(r1)
203
lbz r3,0(r1)
204
205
ECE344L - Microprocessors
Slide: 12
Fetch Example
PC
202
MAR
202
IR
lbz r2,0(r1)
201
cmp 0,r2,0x00
202
lbz r2,0(r1)
203
lbz r3,0(r1)
204
205
ECE344L - Microprocessors
Slide: 13
MAR PC
IR M [ MAR ]
PC PC + ??
- decode -
execute:
ECE344L - Microprocessors
Slide: 14
ECE344L - Microprocessors
Slide: 15
ECE344L - Microprocessors
Slide: 16
Registers in MIPS/PIC32
Rn General Purpose registers
32 bit values (64 bit values)
32 registers total
Special assignment of function
R0 = 0
Control Registers
32 bit values
Variety of functions (SFR)
ECE344L - Microprocessors
Slide: 17
Instruction Types
Work: add, subtract, mult, div, AND, OR,
EXOR
Movement: reg to reg, reg to mem, mem
to reg
Program control: jump, jump to subroutine,
return from subroutine, conditional jump
System control: set control bits, modify
control registers, interrupt system
ECE344L - Microprocessors
Slide: 18
Language
Programming Language analogy:
Each computer has a native machine language (language L0)
that runs directly on its hardware
A more human-friendly language is usually constructed above
machine language, called Language L1
ECE344L - Microprocessors
Slide: 19
Translating Languages
English: Display the sum of A times B plus C.
Assembly Language:
mov eax,A
mul B
add eax,C
call WriteInt
ECE344L - Microprocessors
Slide: 20
ECE344L - Microprocessors
Slide: 21
High-Level Language
Level 4
Application-oriented languages
C++, Java, Pascal, Visual Basic . . .
ECE344L - Microprocessors
Slide: 22
Assembly Language
Level 3
Instruction mnemonics that have
a one-to-one correspondence to
machine language
Programs are translated into
Instruction Set Architecture
Level - machine language (Level
2)
ECE344L - Microprocessors
Slide: 23
ECE344L - Microprocessors
Slide: 24
Digital Logic
Level 1
CPU, constructed from digital
logic gates
System bus
Memory
Implemented using bipolar
transistors
next: Data Representation
ECE344L - Microprocessors
Slide: 25
Data Representation
Binary Numbers
Translating between binary and decimal
Binary Addition
Integer Storage Sizes
Hexadecimal Integers
Translating between decimal and
hexadecimal
Hexadecimal subtraction
Signed Integers
Binary subtraction
Character Storage
ECE344L - Microprocessors
Slide: 26
Binary Numbers
Digits are 1 and 0
1 = true
0 = false
MSB
LSB
1011001010011100
15
Bit numbering:
ECE344L - Microprocessors
Slide: 27
Binary Numbers
Each digit (bit) is either 1 or 0
Each bit represents a power of 2:
27
26
25
24
23
22
21
20
Every binary
number is a
sum of powers
of 2
ECE344L - Microprocessors
Slide: 28
(1 23) + (1 20) = 9
ECE344L - Microprocessors
Slide: 29
37 = 100101
ECE344L - Microprocessors
Slide: 30
Binary Addition
Starting with the LSB, add each pair of
digits, include the carry if present.
bit position:
ECE344L - Microprocessors
carry:
(4)
(7)
(11)
Slide: 31
Standard sizes:
word
doubleword
quadword
8
16
32
64
ECE344L - Microprocessors
Slide: 32
Hexadecimal Integers
Binary values are represented in hexadecimal.
ECE344L - Microprocessors
Slide: 33
ECE344L - Microprocessors
Slide: 34
ECE344L - Microprocessors
Slide: 35
Powers of 16
Used when calculating hexadecimal values up to 8 digits
long:
ECE344L - Microprocessors
Slide: 36
ECE344L - Microprocessors
Slide: 37
Hexadecimal Addition
Divide the sum of two digits by the number base (16). The quotient
becomes the carry value, and the remainder is the sum digit.
36
42
78
28
45
6D
28
58
80
6A
4B
B5
21 / 16 = 1, rem 5
ECE344L - Microprocessors
Slide: 38
Hexadecimal Subtraction
When a borrow is required from the digit to the left, add 16
(decimal) to the current digit's value:
16 + 5 = 21
-1
C6
A2
24
75
47
2E
ECE344L - Microprocessors
Slide: 39
Signed Integers
The highest bit indicates the sign. 1 =
negative,
sign bit
0 = positive
1
Negative
Positive
ECE344L - Microprocessors
Slide: 40
ECE344L - Microprocessors
Slide: 41
Binary Subtraction
When subtracting A B, convert B to its
two's complement
Add A to (B)
00001100
00000011
00001100
11111101
00001001
ECE344L - Microprocessors
Slide: 42
ECE344L - Microprocessors
Slide: 43
Practice: What is the largest positive value that may be stored in 20 bits?
ECE344L - Microprocessors
Slide: 44
Character Storage
Character sets
Standard ASCII (0 127)
Extended ASCII (0 255)
ANSI (0 255)
Unicode (0 65,535)
Null-terminated String
Array of characters followed by a
null byte
Slide: 45
ASCII binary
string of digits: "01010101"
ASCII decimal
string of digits: "65"
ASCII hexadecimal
string of digits: "9C"
ECE344L - Microprocessors
Slide: 46
ECE344L - Microprocessors
Slide: 47
ECE344L - Microprocessors
Slide: 48
Boolean Operations
NOT
AND
OR
Operator Precedence
Truth Tables
ECE344L - Microprocessors
Slide: 49
Boolean Algebra
Based on symbolic logic, designed by
George Boole
Boolean expressions created from:
NOT, AND, OR
ECE344L - Microprocessors
Slide: 50
NOT
Inverts (reverses) a boolean
value
One operand
If operator is T, than T, if F, than
F
Truth table for Boolean NOT
Digital gate diagram for NOT:
operator:
NOT
ECE344L - Microprocessors
Slide: 51
AND
Two operands
Both must be T for T, otherwise F
Truth table for Boolean AND operator:
AND
ECE344L - Microprocessors
Slide: 52
OR
Two operands
Both must be F for F, otherwise T
Truth table for Boolean OR operator:
OR
ECE344L - Microprocessors
Slide: 53
NAND
Two operands
Both T = F, otherwise T
Truth table for Boolean NAND operator:
X
Y X NAND Y
ECE344L - Microprocessors
NAND
Slide: 54
NOR
Two operands
Any T = F, otherwise T
Truth table for Boolean NOR operator:
X
Y X NOR Y
ECE344L - Microprocessors
NOR
Slide: 55