Title: Lecture 2. How does the computer work?
1Lecture 2. How does the computer work?
CS 147
- Prof. Sin-Min Lee
- Department of Computer Science
2(No Transcript)
3- Practice, Practice, Practice!Use casette tape
recorder to listen, practiceTry videotapingSeek
feedback from friendsUse phrases, not
sentencesNotes separate from slides (dont read
slide)Pick appropriate font, size ( 24 point to
32 point)Estimate talk length 2 minutes per
slideUse extras as backup slides (Question and
Answer)Use color tastefully (graphs,
emphasis)Dont cover slidesUse overlays or
builds in powerpoint
4Computer of the day Jacquard loom late
1700s for weaving silk Program on punch
cards Microcode each hole lifts a set of
threads Or gate thread lifted if any
controlling hole punched
5- Card Punch
- Early programmers were well-paid (compared to
loom operators)
6Computer Architecture Instruction Set
Architecture Machine Organization
7(No Transcript)
8Instruction Set Architecture
- Instruction set architecture is the attributes of
a computing system as seen by the assembly
language programmer or compiler. This includes - Instruction Set (what operations can be
performed?) - Instruction Format (how are instructions
specified?) - Data storage (where is data located?)
- Addressing Modes (how is data accessed?)
- Exceptional Conditions (what happens if something
goes wrong?) - A good understanding of computer architecture is
important for compiler writers, operating system
designers, and general computer programmers.
9(No Transcript)
10(No Transcript)
11(No Transcript)
12 Understanding Computer Basics
13Computer Case- The part of a computer system that
houses the microprocessor, the RAM (Random
Access Memory), and the Motherboard. This case
also houses the disk drives. CPU (Central
Processing Unit) - A chip or circuit that
interprets and executes programs by processing a
list of machine instructions which perform binary
operations on data stored in memory. The portion
of hardware in a computer which interprets
instructions and then executes them. It is the
heart of any computer system.
14Memory- The internal component that the computer
uses to temporary store data and programs .
There are two kinds of computer memory RAM
(Random Access Memory) and ROM (Read-Only
Memory). RAM loses its data if the power is
turned off ROM retains its information whether
the computer has power or not. Users are unable
to erase ROM. Not to be confused with storage
devices such as hard drives, floppy disks, or
other such devices. Data is processed in RAM
memory it is stored on a storage device.
15Motherboard- The main circuit board in the
computer.Every device is connected to the
Motherboard. Also called planar, system board, or
backplane, depending on the architecture of the
board.
16Aug. 31, 2004, 1205AMBig gain in small
package Intel test chip boasts technology to add
to speed
Intel, the world's biggest semiconductor maker,
said Monday it built a test chip with a new
process that creates faster circuits by packing
10 million transistors into an area the size of
the tip of a ballpoint pen. Intel, based in Santa
Clara, Calif., has made the first working memory
chip that uses so-called 65-nanometer technology
to shrink the circuits inside chips, Intel
researcher Mark Bohr said during a conference
call.
17Video Card This card connects to the Motherboard
and the computer monitor connects to the
videocard. That is how images are interpreted and
displayed to the monitor.
18Network card- Device connected to the motherboard
which is used for communicating on a network to
other computers, printers and other electronic
devices (ex. Phones, cell phones ect)
19Network Card- Device connected to the motherboard
which is used for communicating on a network to
other computers, printers and other electronic
devices (ex. Phones, cell phones ect) Network
Card Driver- A program that instructs the device
on how to operate.
20Hard Drive- A device that is connected to the
motherboard and is used for storage of data
files. Usually this device is referred to as your
c\ drive. Storage capacity can be measured in
Kb, Mb, Gb and Tb.
21Floppy Drive- A device that is also connected to
the motherboard that allows you to use a portable
storage media called floppieswhich are used to
store data. The floppies come 5 ¼(which are no
longer popular) and 3 ½ sizes (which is still
the most widely used media up-to-date.). The
floppies storage capacity is no where near the
storage capacity of a harddrive. ( Ex. 1Gb
Harddrive can hold information that is on 695
floppies)Get the point?
22Bit
23so a k is...k in computing is short for kb or
kilobyte where kilo means the same as anywhere
else in our measurement system 1000 so a k is
1000 byteshow about Mb?b for byte again, and M
for mega megabyte big M for mega, small m means
milli, or one thousandth, 1/1000 as in mm,
thousandths of a metremega in our measurement
system means one million, 1 000 000 or a
thousand thousand, so a megabyte is a thousand
kilobytes or one million byteshow about GB?you
can now buy hard disk drives in Gb, gigabytes,
thousands of Mb or thousands of millions of
bytes, so a 5Gb HDD holds 5000 Mb of data with
some large computers storing up to Tb,
terabytes... yup, thousands of Gb... so one
terabyte (Tb) 1000 gigabytes (Gb) 1000 000
megabytes (Mb) 1000 000 000 kilobytes (kb) 1
000 000 000 000 bytes or one thousand billion
bytes of information
24(No Transcript)
25CD-ROM DRIVE- means Compact Disk - this drive
uses a laser to read (read-only) the information
in the tiny but complex pattern stamped
permanently onto computer compact disks. Read
Only Memory CD's are much tougher than floppies,
and hold more than 600Mb of information CD-writer
drives are now available,so people can burn their
own CDs, e.g. to backup files permanently
established computer shops or print shops now
have their own CD-writers, and will backup your
files by burning them.You can also record your
music CD.
26What is a Computer?
- Data
- Primitive Operations
- Sequence Control
- Data Access
- Storage Management
- Operating Environment
- May be actual hardware computer or
software-simulated computer. - Most computers a combination of the two.
27In mathematics you don't understand things. You
just get used to them.John von Neumann
28(No Transcript)
29(No Transcript)
30(No Transcript)
31Typical Machine Layout
- Two cycles
- Fetch cycle - get instruction
- Execute cycle - do operation
32(No Transcript)
33(No Transcript)
34Typical Machine Execution
- Typical fetch cycle (M(x) means contents of x)
- M(IC) ? MAR Memory Address register
- IC 1 ? IC Instruction Counter
- Read memory into MDR Memory Data Register
- MDR ? IR Instruction Register for decoding
35Typical Machine Execution (continued)
- Typical execute cycle (OP R,X, DISP is
instruction) - IR decoded into OP R, EA
- OP is operation code (e.g., 8 bits)
- R is register (e.g., 4 bits -- 16 registers)
- EA is effective address (e.g., 20 bits)
- M(X)DISP ? MAR (EA ? MAR)
- Read memory into MDR
- M(R) ? ALU M(MDR) ? ALU
- Do operation OP in ALU ALU ? R
- For 500 MHZ Each instruction 9-10 cycles (50
MIPS) - By overlapping fetch and execute cycles, get
60-70 MIPS
36Typical Machine Translation
Instruction format Opcode register, index,
offset load R1, R2, 24
- For example As we see later, memory for data in
blocks of storage pointed to by a register - X Y Z
- could be translated as
- load R1, R2, 28 Location of Y
- add R1, R2, 40 Location of Z
- store R1, R2, 24 Location of X
37Ways to Construct a Computer
- Hardware Realization
- Any precisely defined algorithm or data structure
may be realized in hardware. - Firmware Realization
- Microprogramming or emulation
- Virtual Machine
- Provided by a language environment
- Combination
38(No Transcript)
39(No Transcript)
40(No Transcript)
41(No Transcript)
42Von Neumann Model of Execution
Obtain instruction from program storage
Determine required actions and instruction size
Locate and obtain operand data
Almost all Modern Computers are Von
Neumann machines
Compute result value or status
Deposit results in storage for later use
Determine successor instruction
43(No Transcript)
44(No Transcript)
45(No Transcript)
46(No Transcript)
47(No Transcript)
48(No Transcript)
49(No Transcript)
50(No Transcript)
51(No Transcript)
52(No Transcript)
53(No Transcript)
54(No Transcript)
55Decimal system, base 10
- History -- we have 10 fingers
- 253 means 2100 510 31
- 1,10,100 (from R to L) are the weights
- 10 digits, values 0 through 9
- After 9 comes 10 (double digits)
- Grade school learn by rote 79 63
- Nothing magic -- we are trained on it
56Octal system, base 8
- Mickey Mouse has 8 fingers
- 253 means 264 58 31
- 1, 8, 64 are the weights
- 8 digits, values 0 through 7
- After 7 comes 10
- Used to display memory addresses in some
- older computers e.g., 177462
57Hexadecimal system, base16
- 16 digits, values 0 - 9 and A-F
- 3B6 means 3256 B16 61
- 1, 16, 256 are the weights
- After F comes 10
- Used to display memory addresses in most
- modern computers e.g., 3C0F 95EA
58Binary system, base 2
- 2 digits, values 0 and 1
- 1011 means 18 04 12 11
- 1, 2, 4, 8 are the weights
- After 1 comes 10
- Count 0 1 10 11 100 101 110 111 1000
59Binary system, base 2
- Used to do calculations in all computers
- Used to store values in memory and on disk
- Not practical for people
- 100101011101 4701
60Best way to use number systems
- Binary system inside the computer
- (storage and calculations reduce to simple
- logic, the main subject of Comp 120)
- Input-Output done in decimal for user
- Software translates in both directions
61Convert Binary to Decimal
- Binary Value 10101
- 116 08 14 02 11 21
- Convert these
- 1100 ?
- 1001 ?
- 0111 ?
62 Convert Decimal to Binary Given decimal
value 53 53 21 5
1 64 32 16 8 4
2 1 1 1 0 1
0 1 18 ? 31 ?
63Decimal notation with fractions
- 72.53 means
- 710 21 5.1 3.01
- The . is the decimal point
- Weights are 100 10 1 . .1 .01 .001
- This is not scientific notation
- This is not floating point storage
64Binary notation with fractions
- 110.10 binary means
- 14 12 01 1.5 0.25 6.5 dec
- The . is the binary point
- Weights are 8 4 2 1 . 1/2 1/4 1/8
- This is not scientific notation
- This is not floating point storage
- 11.11 binary ? decimal
65Memorize dec, hex, binary counts
0 0 000 8 8 1000 1 1 001 9 9 1001 2 2 010
10 A 1010 3 3 011 11 B 1011 4 4 100 12 C 1100
5 5 101 13 D 1101 6 6 110 14 E 1110 7 7 111
15 F 1111
66Convert Binary to Power 2 base
- Very easy -- convert digit-by-digit
- A27F ltgt 1010 0010 0111 1111 (Hex-Bin)
- 327 ltgt 011 010 111 (Octal-Binary)
- B4C5 ?
- 1010 0110 1001 ?