Week 02

Today’s lecture outline
Information Science 1
!Basic'Concepts'of'Computers:'
Opera4on,'Architecture,'Memory!'
Recall the previous class
!  What is a computer
!  What is the structure of a computer
and its basic parts
! 
 Main memory and how data is stored in a
computer
 Central Processing Unit
 The Input and Output
 Computer bus
Week$02$
College of Information Science and Engineering
! 
Quiz
Ritsumeikan University
Week 01 vocabulary
Roberto LOPEZ (CC514, consultations
Thru, Fri 15:00-16:20)
!  Course structure
!  Information Science
!  Test, quiz
!  Academic integrity
!  Handouts, slides
!  Self-preparation assignments
!  Feedback
!  Solve problems
! 
What is a computer?
A computer is a digital system that stores,
transforms, and communicates data in
digital form
!  In a computer, all data is represented by a
fixed number of discrete (non-continuous)
symbols, called digits
!  First modern computer – the Manchester
Small Scale Electronic Machine, built by
Frederic Williams, Tom Kilburn and Geoff
Tootill, began operating on 21 June 1948
! 
What is data?
Data is the information which a computer
processes
!  Individual data values may represent
! 
 numbers,
 alphabetic characters, and
 any other coded information (music, picture,
etc.)
! 
How about instructions of computer
programs? Are they data?
Data representation
!  In
a computer, all data is stored and
processed in the binary form, that is,
as a series of 0s and 1s
– e.g. 01010011000110111101
!  Each
binary digit is called a bit –
binary digit, the smallest unit of
information which can be stored in the
computer
 yes
Why binary?
! 
Binary data units
Advantages
00111100010110001010011000110111101
Bit count
–  Binary signals are very reliable: easy to
detect and correct any errors
–  The basic decision-making processes are
binary, e.g. “yes/no,” “true/false,” or “1/0”
–  Binary devices are easy to design
! 
! 
Bits are grouped into larger units known
as bytes to hold more meaningful data:
1 Byte = 8 bits
! 
For every byte, we have:
00111100010110001010011000110111101
Disadvantages
Most significant bit, msb
–  We are more familiar
with decimal numbers
–  Binary numbers are
longer
! 
Least significant bit, lsb
Another data unit is a computer word that
defines the number of bits stored in a single
memory cell of a particular computer
More on data units
Bit
Byte
Kilobyte
Megabyte
Gigabyte
Terabyte
1
“is
8 bits
210 Bytes
210 kilobytes
210 Megabytes
210 Gigabytes
Counting in binary
exactly equal to”
What is the decimal analog of 10011001?
= 1,024 B ≈ 103 B
≈ 106 B
≈ 109 B
≈ 1012 B
1
0
0
1
1
0
0
1
27
26
25
24
23
22
21
20
1*27+0*26 + 0*25+1*24+ 1*23+0*22+0*21+1*20 =
153 in base 10 (decimal)
“is approximately equal to”
What is (decimal) 127 in 14-bit memory?
00000001111111 ← 0*213 + 0*212
e.g. 256kB of memory have 256*1024=262,144 bytes
+0*211+0*210+0*29 + 0*28
Remember that the length of a computer
word can be different on different computers
127= +0*27 +1*26 +1*25 + 1*24
15= +1*23 +1*22 +1*21 + 1*20 ← 127
Writing in binary?
! 
! 
Characters are represented using ASCII or
Unicode standards
For example, in ASCII (that stands for American
Standard Code for Information Interchange),
each character is represented with 7 bits:
H
E
L
O
! 
→0
→0
→0
→0
1
1
1
1
0
0
0
0
0
0
0
0
1
0
1
1
0
1
1
1
0
0
0
1
0
1
0
1
Ascii Table
0 C-@
1 C-a
2 C-b
3 C-c
4 C-d
13
14
15
16
17
RET
C-n
C-o
C-p
C-q
26
27
28
29
30
C-z
ESC
C-\
C-]
C-^
39
40
41
42
43
'
(
)
*
+
52
53
54
55
56
4
5
6
7
8
5
6
7
8
9
10
11
12
18
19
20
21
22
23
24
25
C-r
C-s
C-t
C-u
C-v
C-w
C-x
C-y
31 C-_
32 SPC
33
!
34
"
35
#
36
$
37
%
38
&
44
45
46
47
48
49
50
51
,
.
/
0
1
2
3
57
58
59
60
61
62
63
64
9
:
;
<
=
>
?
@
C-e
C-f
C-g
C-h
TAB
C-j
C-k
C-l
65
66
67
68
69
70
71
72
73
74
75
76
77
A
B
C
D
E
F
G
H
I
J
K
L
M
78
79
80
81
82
83
84
85
86
87
88
89
90
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
91
92
93
94
95
96
97
98
99
100
101
102
103
[
\
]
^
_
`
a
b
c
d
e
f
g
104
105
106
107
108
109
110
111
112
113
114
115
116
h 117
u
i 118
v
j 119
w
k 120
x
l 121
y
m 122
z
n 123
{
o 124
|
p 125
}
q 126
~
r 127 DEL
s
t
HELLO in ASCII is, therefore, stored as
01001000 01000101 01001100 01001100 01001111
Computer structure
Computer structure: Memory
!  The
CPU"
primary (main, physical) memory
of a computer is usually called RAM
RAM"
 RAM stands for Random Access Memory
 It stores all the binary data
 The computers Central Processing Unit
(CPU) can access RAM
PCI Bus
SCSI Bus!
USB Bus
…011111
data cell’s
address
PCI-E Bus
data
cells – computer words
…100001
Facts about RAM
! 
Cell size = computer word
! 
If word = 8 bits, then cell size = 1 Byte.
Maximum value that can be stored in a byte
is 11111111 = 255, too small
! 
! 
Numbers much greater than 255 have to
be stored in computers. For that reason,
modern computers have word sizes of 32,
64, or even 128 bits
In RAM, if the computer word is composed
of N bits, the maximum address is 2N-1.
The RAM size is, however, 2N
More facts about RAM
! 
! 
! 
! 
! 
Random Access Memory is a form of computer data
storage. There can also be other forms, such as
HDD, ROM, NOR-Flash, etc
RAM physically is a set of circuits allowing the stored
data to be accessed in any order (i.e. at random)
In RAM, any piece of data can be returned in a
constant time, regardless of its address and whether
or not it is related to the previous piece of data
Read/Write capability and high access speed are
characteristics of RAM in modern computers
RAM is usually volatile, which means the data is lost
when the power is turned off
Computer structure: CPU
! 
A Central Processing Unit (CPU) or processor is an
electronic circuit that can execute computer programs
! 
Every CPU has two parts:
  Control Unit (CU) that controls and coordinates the
computers operations.
CU locates the appropriate instructions at each time
step, loads the instructions to CPU from RAM, controls
their sequencing, and executes them
  Arithmetic and Logic Unit (ALU) that performs all
arithmetic computations (such as addition,
multiplication, etc) and logic operations (such as value
comparison, logical addition, etc)
! 
The CPU has special memory cells – registers – to hold
data and results of the calculations
CPU: How it works
CPU reads
program
instructions
from RAM and
executes one
instruction at a
time until
completion,
according to the
Machine Cycle
algorithm:
Instruction
Fetch
Obtain an instruction from
RAM
Instruction
Decode
Determine required actions
and instruction size
Operand
Fetch
Locate and obtain
instruction data
Execute
Compute result
Result
Store
Next
Instruction
Store result in memory for
later use
Determine the next
instruction
CPU registers and operation
Memory Address Register (MAR):
holds main memory addresses
when fetching instructions
or data
CPU registers (cont-d)
Memory Data Register (MDR):
stores instruction and data
just fetched, and also
data to be written to RAM.
Sometimes called MB(buffer)R
CPU registers (cont-d)
Instruction Register (IR):
contains the instruction
currently being
executed
CPU operation (cont-d)
Control Unit (CU):
generates signals
that cause the
execution or the
fetch of an instruction
CPU operation (cont-d)
Arithmetic-Logic Unit (ALU):
calculations and logical
comparisons
take place here
CPU registers (cont-d)
General Purpose Registers (GPR):
these are special memory
cells for temporary
storage of data inside
CPU
CPU registers (cont-d)
Program Counter (PC):
contains the address
of the next
instruction
to be executed
CPU registers (cont-d)
Processor Status Register (PSR):
contains information about
the current state of
the CPU
The Machine Cycle: Revisited
! 
Defines how instructions are retrieved and
executed inside the computer
The Machine Cycle:Revisited
| 4. Execute Instruction(s)
| 2. Decode the Instruction
! 
! 
| 1. Fetch an
Instruction
Sometimes also called the Instruction
Cycle, “Fetch-Execute” Cycle, or Automatic
Sequence Control
| 6. Fetch next
Instruction
Major steps are:
–  Fetch the instruction from memory to IR
–  Increment the PC
| 3. Fetch operands
–  Execute the instruction in IR
| 5. Store the result(s)
–  Repeat the previous steps until termination
Computer structure: I/O
Computer structure: Bus
! 
Input and Output devices (I/O) allow humans to
interact with computers
! 
A computer bus is a collection of wires used to
transfer data between the computer’s parts
! 
I/O gives computers long-term memory
! 
! 
I/O lets computers control and communicate with
other systems
Examples: Device Behavior
Partner
In a computer, there are usually more than just
one bus; for example:
! 
Keyboard
Mouse
Sound card
HDD
Printer
CD, DVD drive
Network card
Display
and and and and usually Human
Human
Human
Computer
Human
Computer
Computer
Human
CPU"
RAM"
PCI Bus
SCSI Bus!
USB Bus
PCI-E Bus
Review
! 
!  Download
slides for the next
lecture and read them before
going to the class
!  Download self-preparation
assignments and study them
thoroughly
!  Learn the vocabulary
!  Consult, when necessary, the
textbook materials
What is a computer?
 a digital system that handles binary data
! 
What are the main parts of a computer?
 RAM
 CPU (CU, ALU, and CPU registers)
 I/O
 bus
! 
How does a computer operate?
 according to the Machine Cycle
Next class
!  Representation
Homework
of data in memory
(1)
 Units of computer memory and the binary
signal. Decimal, binary, octal, and
hexadecimal numerical representation
systems