Lec_02 Introduction to Computer
Lec_02 Introduction to Computer
Course
ME4162: Microprocessor Introduction
Semester 1, 2023 Number Representation
Lecturer: Dr. Duong Van Lac Dr. Duong Van Lac
Department of Mechatronics, HUST
Email: [email protected]
• Binary: 0,1
• 1011010 = 1x26 + 0x25 + 1x24 + 1x23 + 0x22 + 1x2 + 0x1 = 64 + 16
+ 8 + 2 = 90
1
9/25/2023
2
9/25/2023
Solutions Problems
1. Perform binary addition: 0b1101 + 0b1001. Check
against their decimal equivalents
2. Perform hex addition: 23D9 + 94BE
3. Perform hex subtraction: 59F – 2B8.
4. Convert hex 29B to binary.
Solutions Chapter 1
Introduction
Computer Architecture
Dr. Duong Van Lac
Department of Mechatronics, HUST
3
9/25/2023
128 locations
1
2
4 bits each
…
• Access time 127
4
9/25/2023
Problems Solutions
1. A given memory chip has 12 address pins and 4
data pins. Find:
(a) the organization, and (b) the capacity.
5
9/25/2023
2764
6
9/25/2023
• Erased in a Flash
• the entire device is erased at once • ROM RAM •
– Mask ROM )Static RAM( SRAM –
– PROM (Programmable )Dynamic RAM( DRAM –
ROM) Nonvolatile ( NV-RAM –
– EPROM (Erasable )RAM
PROM)
– EEPROM (Electronic
Erasable PROM)
– Flash EPROM
7
9/25/2023
8
- A0–An-1 are for address inputs D0-D7
- WE (write enable) is for writing data into memory (active low).
- OE (output enable) is for reading data out of memory (active low). CPU n
A0-An-1
8
9/25/2023
Mouse
Address bus
Data bus
Write
Network
CPU Keyboard
Control bus Read
CPU
I/O 0 I/O 1 I/O 2 I/O n
Sound Card
Graphic Card
Connecting I/Os and Memory to CPU Connecting I/Os and memory to CPU using bus
Address bus
VCC
0
1
Data bus How could we manage it? 2
3
A0-An-1
Write
GND
D0-D7
Control bus Read
WE
OE
CS
0
Address bus
Data bus
CPU I/O 0 I/O 1 I/O 2 I/O n
Write
Control bus Read
VCC
n
GND VCC
CPU
A0-An-1
8
D0-D7
OE
CS
9
9/25/2023
Connecting I/Os and Memory to CPU using bus Connecting I/Os and Memory to CPU using bus
(Peripheral I/O) (Memory Mapped I/O)
The logic circuit
VCC
0
VCC
0
1
1 enables CS
.. How could we make the logic ..
when address is
15
A0-An-1
GND
D0-D7
63 circuit? between 0 and
A0-An-1
GND
D0-D7
WE
OE
CS
15
WE
OE
CS
Logic circuit
Address bus
Address bus
Data bus
Solution
Data bus
Control 1.
bus Write
Write the address range in binary
Write Read
Control bus Read 2. Separate the fixed part of address
IO/MEM
3. Using a NAND, design a logic circuit whose output
CPU CPU
activates when the fixed address is given to it.
a7 a6 a5 a4 a3 a2 a1 a0
From address 0 ➔ 0 0 0 0 0 0 0 0 a4
Data
Bus
...
D7 0000H–1FFFH RAM 0
Solution D7 ... D0 D7 ... D0 D7 ... D0 D7 ... D0
2000H–3FFFH RAM 1
MEMR
OE
MEMR MEMR
OE
MEMR 4000H–5FFFH RAM 2
OE OE
MEMW WR MEMW WR MEMW WR MEMW WR 6000H–7FFFH RAM 3
1. Write the address range in binary
8Kx8 RAM2
8Kx8 RAM0
8Kx8 RAM3
8Kx8 RAM1
CPU
A13 A13 A13 A13
A0 A0 A0 A0 A0 A0 A0 A0
a8 a7 a6 a5 a4 a3 a2 a1 a0
a11 a10 a9 a8 a8 A0
a9
From address 300H ➔ 0 0 1 1 0 0 0 0 0 0 0 0 a10 CS
Address Bus
a11
To address 3FFH ➔ 001111111111 A12
A13
A14
A15
MEMR
Control
Bus
MEMW
designing
10
9/25/2023
.
..
D7 ... D0 D7 ... D0 D7 ... D0 D7 ... D0
• Registers
8Kx8 8Kx8 OE 8Kx8 8Kx8
•
OE OE OE
CPU RAM0 WR
RAM1 RAM2 WR
RAM3
CS A12 ... A0 CS A12 ... A0 CS A12 ... A0 CS A12 ... A0
A12 A0 A12 A0 A12 A0 A12 A0
A0
Address Bus
A12
A13
A14
A15
PC A
Control
MEMR
Bus
MEMW
IOR
IOW A13 Y0
ALU B
A
A14 B Y1
74LS138
A15 C Y2
Y3
VCC
Y4
CPU
G1
Y5
G2A Y6
G2B Y7
C
D
Instruction decoder
registers
VCC
3 81h AA+B 3 81h AA+B
4 EAh
[7]A 4 EAh
[7]A
5 0h 5 0h
A0-An-1
A0-An-1
GND
GND
D0-D7
D0-D7
6 5h 6 5h
WE
WE
OE
OE
CS
CS
7 7
ALU
CPU A
B ALU
CPU A
B
PC: 10 C PC: 1 C 9
31
11
9/25/2023
VCC
VCC
3 81h AA+B 3 81h
81 AA+B
4 EAh
[7]A 4 EA
EAh [7]A
5 0h 5 0h
A0-An-1
A0-An-1
GND
GND
55h 5h
D0-D7
D0-D7
6 6
WE
WE
OE
OE
7
CS
CS
7
ALU
CPU 9
A
B
+
ALU
E CPU A
9
B
E
5
PC: 1
2
3 C PC: 4
35 C
D I/O 16 I/O 17 I/O 18 I/O n D I/O 16 I/O 17 I/O 18 I/O n
Inst. Dec. registers
Inst. Dec. registers
12
9/25/2023
13