Digital Computersand Information
Chapter 1
Mano and Kime
Digital Computersand Information
• Digital Computers
• Number Systems
• Arithmetic Operations
• Decimal Codes
• Alphanumeric Codes
Block Diagram of Computer
Memory
• ROMs and PROMs
• EPROMs, EEPROMs and Flash Memory
• Static RAMs and Dynamic RAMs
ROMs and PROMs
• ROM– Read-Only Memory
• PROM– Programmable Read-Only Memory
EPROMs, EEPROMs and Flash Memory
• EPROM– Erasable Programmable Read-Only Memory– Erase with ultraviolet light
• EEPROM– Electrically-Erasable Programmable Read-Only
Memory
• Flash Memory– Electrically-Erasable in bulk
RAMs• RAM
– Random-Access Memory– Read-Write Memory
• Static RAM– Needs 4 transistors per bit to make a latch– Data lost when power is turned off
• Dynamic RAM– One transistor per bit– Data stored as charge on a capacitor– Data must be continually refreshed
W8XMicrocontroller
mux4g
F C R M
Reg_Array
(mux2g)
ALU
N1
(stack8x16)rpoprpushReturn Stack
(mux2g)
(mux2g)
P reg
I Reg
Controller(w8x_control)
ProgramROM
P mux
R muxT mux
(reg)
(incrg)
R
M
TN
T
p_in
t_in
alu_out mux_out
alu_sel mux_sel
I
T
P
P1
iload
ploadpinc
tsel
rsel
psel
r_in
M
cregCout
C
M
T
sel0sel1sel2sel3
load
clr
clk
clk
clr
clr
clk
clk
clr
plus1P1
clr clkcload
Control UnitDatapath
The W8Z Microprocessor
reg_stack
Funit
TN2 N1N3
d0
y1cout
clr
clk
Rcode(3:0)
Fcode(4:0)
msel(5:0)
Wcontrol
Wrom
WPC
clk
clr
inc
M(15:8)M(7:0)
P
d1
ReturnStack
R
Pmux
Rmux
dual_mux8g
add2
sub1
ROM
RAM
T
T N1
y2
SW(1:8)
rsel(1:0)
psel
BTN(1:4)
rpush
rload
pselrsel
pload
DigReg
LDreg
dig3 dig1dig4 dig2
LD(1:8)
T
TN1
clrclk
rpush
rpop
pload
clrclk
rload
rdecclkclr
we
rpoprdec
ldloadclkclr
clk
clr digload
P1
R
R1
RM1
p_in
r_in
T
T
Mmuxcnt1
clk clr
tog
c1
instr
tog
inc
ldload we
Digital Computerand Information
• Digital Computers
• Number Systems
• Arithmetic Operations
• Decimal Codes
• Alphanumeric Codes
Powers of 2
Numbers with Different Bases
Number Systems
N = ...P3P2P1P0 . P-1P-2P-3...
= ... + P3b3 + P2b2 + P1b1 + P0b0
+ P-1b-1 + P-2b-2 + P-3b-3 + ...
375.1710 = 3 x 102 + 7 x 101 + 5 x 100
+ 1 x 10-1 + 7 x 10-2 = 300 + 70 + 5 + 0.1 + 0.07= 375.17
Number Systems
N = ...P3P2P1P0 . P-1P-2P-3...
= ... + P3b3 + P2b2 + P1b1 + P0b0
+ P-1b-1 + P-2b-2 + P-3b-3 + ...
1101.112 = 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20 + 1 x 2-1 + 1 x 2-2
= 8 + 2 + 0 + 1 + 1/2 + 1/4= 11.7510
Binary
Number Systems
N = ...P3P2P1P0 . P-1P-2P-3...
= ... + P3b3 + P2b2 + P1b1 + P0b0
+ P-1b-1 + P-2b-2 + P-3b-3 + ...
1AB.616 = 1 x 162 + A x 161 + B x 160
+ 6 x 16-1 = 1 x 256 + 10 x 16 + 11 x 1 + 6/16 = 256 + 160 + 11 + 0.375 = 427.37510
Hex
Number Systems
N = ...P3P2P1P0 . P-1P-2P-3...
= ... + P3b3 + P2b2 + P1b1 + P0b0
+ P-1b-1 + P-2b-2 + P-3b-3 + ...
173.258 = 1 x 82 + 7 x 81 + 3 x 80
+ 2 x 8-1 + 5 x 8-2
= 1 x 64 + 7 x 8 + 3 x 1+ 2/8 + 5/64
= 64 + 56 + 3 + 0.25 + 0.078125= 123.32812510
Octal
Problem 1-4
Convert the following binary numbers to decimal:
1101001
10001011.011
10011010
Digital Computerand Information
• Digital Computers
• Number Systems
• Arithmetic Operations
• Decimal Codes
• Alphanumeric Codes
Recall Full Adder Truth Table
0 0 0 0 00 0 1 1 00 1 0 1 00 1 1 0 11 0 0 1 01 0 1 0 11 1 0 0 11 1 1 1 1
Ci Ai Bi Si Ci+1
00 1 0 10 1 1 1
A
B
0
1
0
1
1
1
1
C
Final carry = 0
Binary Addition
0 0 1 1 0 1 0 10 0 0 1 1 0 0 1 0111
0
0
1
0
53+25 78
35+19 4E
Dec Hex
Binary
1001
1
0
0
Recall Full Subtractor Truth Table
0 0 0 0 00 0 1 1 10 1 0 1 00 1 1 0 01 0 0 1 11 0 1 0 11 1 0 0 01 1 1 1 1
Ci Ai Bi Di Ci+1
00 1 0 10 1 1 1
A
B
0
0
1
1
1
1
1
C
Final borrow = 1
5- 7 E
Hex
Binary Subtraction
1 0 1 1 0 1 0 10 1 1 0 1 1 1 1 0110
1
0
0
0
181- 111 70
B5 - 6F 46
Dec Hex
Binary
0110
1
1
0Final borrow = 0
Number System Conversions
• Hex, Binary, and Octal to Decimal
• Binary Hex
• Binary Octal
• Hex Octal
• Decimal to Hex, Octal, and Binary
Hex to Decimal8 7 C 9
x 16 128 + 7 135 x 16 2,160 + 12 2,172 x 1634,752 + 934,761
Binary Hex
0110 1010 1000 . 1111 0101 1100
6 A 8 . F 5 C
Binary Octal
011 010 101 000 . 111 101 011 100
3 2 5 0 . 7 5 3 4
Hex OctalGo through Binary
0110 1010 1000 . 1111 0101 1100
6 A 8 . F 5 C
011 010 101 000 . 111 101 011 100
3 2 5 0 . 7 5 3 4
Convert Decimal to any BaseInteger Part: Divide by the base,keep track of the remainder, and read up.
16 34,761 16 2,172 rem 9 16 135 rem 12 = C 16 8 rem 7 0 rem 8
Read up
34,76110 = 87C916
Convert Decimal to any Base
Fractional Part: Multiply by the base, keep track of the integer part, and read down.
0.78125 x 16 = 12.5 int = 12 = C
0.5 x 16 = 8.0 int = 8
Readdown
0.7812510 = 0.C816
Convert Decimal to any Base
Fractional Part: Multiply by the base, keep track of the integer part, and read down.0.1 x 2 = 0.2 int = 00.2 x 2 = 0.4 int = 00.4 x 2 = 0.8 int = 00.8 x 2 = 1.6 int = 10.6 x 2 = 1.2 int = 10.2 x 2 = 0.4 int = 00.4 x 2 = 0.8 int = 0
Readdown
0.110 = 0.000112
Problem 1-7Convert the following numbers from the given base to the other three bases listed in the table:
Decimal Binary Octal Hex
369.3125 ? ? ?
? 10111101.101 ? ?
? ? 326.5 ?
? ? ? F3C7.A
Digital Computerand Information
• Digital Computers
• Number Systems
• Arithmetic Operations
• Decimal Codes
• Alphanumeric Codes
Binary Coded Decimal
Code decimal numbers using the binary digits, 0 - 9.That is, 0000 - 1001.Can NOT use the hex digits A - F.For example, the DECIMAL number 3582 wouldbe coded in BCD as
0011 0101 1000 0010While this looks like the HEX number 3582Hin BCD we interpret it as the DECIMAL number 3582.
BCD Addition
Binary
35H 00110101+47H 01000111 7CH 01111100
Decimal (BCD)
35H 00110101+47H 01000111 82H 10000010
0000 B0 35 MOV AL,35H ;AL = 35H0002 04 47 ADD AL,47H ;AL = AL+47H0004 27 DAA ;Decimal adjust
Digital Computerand Information
• Digital Computers
• Number Systems
• Arithmetic Operations
• Decimal Codes
• Alphanumeric Codes
American Standard Code for Information Interchange (ASCII)
American Standard Code for Information Interchange (ASCII)
First 256 Codes for Unicode (Unicode, Inc. The Unicode Standard:Worldwide Character Encoding, Version 1.0 © 1990, 1991 by Unicode, Inc. Reprinted with permission of Addison- Wesley Publishing Company, Inc.)