CS计算机代考程序代写 assembly mips cache assembler finance compiler algorithm Chapter 1

Chapter 1
Computer Abstractions and
Technology
1

Introduction
• This course is all about how computers work
• But what do we mean by a computer?
– Different types: desktop, servers, embedded devices – Different uses: automobiles, graphics, finance,
genomics…
– Different manufacturers: Intel, Apple, IBM, Microsoft,
Sun…
– Different underlying technologies and different costs!
2

Embedded systems
• control for a microwave, cell phones, automatic cars, etc….
3

The number of cell phones, personal computers, and televisions manufactured per year between 1997 and 2007.
4

What will we learn?
• How are programs in a high level languages translated into machine language? How does the machine execute the resulting program?
• What is the interface between Software/Hardware? How does Software instruct Hardware to perform needed functions?
• What determines the performance of a program and how
can we improve the performance?
• What techniques can be used by Hardware designers to
improve performance?
5

Hardware or software component
How this component affects performance
Where is this topic covered?
Algorithms
Determines both the number of source-level statements and the number of I/O operations executed
Other books
Programming language, compiler, and architecture
Determines the number of machine instructions for each source level statement
Chapters 2 and 3 Chapters 4, 5, and 7
Processor and memory system
Determines how fast instructions can be executed
I/O system (hardware and operating system)
Determines how fast I/O operations may be executed
Chapter 6 Chapter 1
Understand Program Performance
Assessing and understanding performance
6

Hardware/Software Interface
Systems Software
-Operating Systems (OS)
-Compilers
7

• Delving into the depths reveals more information
High-level language program (in C)
swap(int v[], int k) {int temp;
Abstraction
• An abstraction omits unneeded detail,
helps us cope with complexity
Assembly language program (for MIPS)
swap:
muli $2, $5,4
Binary machine language program
(for MIPS)
00000000101000010000000000011000 00000000000110000001100000100001 10001100011000100000000000000000 10001100111100100000000000000100 10101100111100100000000000000000 10101100011000100000000000000100 00000011111000000000000000001000
}
temp = v[k]; v[k] = v[k+1]; v[k+1] = temp;
Compiler
add $2, $4,$2 lw $15, 0($2) lw $16, 4($2) sw $16, 0($2) sw $15, 4($2) jr $31
Assembler
8
PAT01F04.eps

H igh-level language program (in C)
swap(int v[], int k) {int temp;
Assembly swap: language
program
(for MIPS)
muli
add $2, $4,$2 lw $15, 0($2) lw $16, 4($2) sw $16, 0($2) sw $15, 4($2) jr $31
Binary machine language program
(for MIPS)
00000000101000010000000000011000 00000000000110000001100000100001 10001100011000100000000000000000 10001100111100100000000000000100 10101100111100100000000000000000 10101100011000100000000000000100 00000011111000000000000000001000
}
temp = v[k]; v[k] = v[k+1]; v[k+1] = temp;
Compiler
Assembler
$2, $5,4
PAT01F04.eps 9

Real Programmers code in binary
10

Five classic components of a computer
1. Input: keyboard, mouse
2. Output: Screen
3. Memory: primary – RAM (DRAM, SRAM), cache memory Secondary – (magnetic) disks
4. Datapath: the component of the processor that performs
arithmetic operations
5. Control: the component of the processor that commands the datapath, memory, I/O devices
11

Control
Input
Datapath Processor
Output I/O
Memory

A desk top computer with a display, a mouse, a keyboard. The box contains a processor and I/O devices
13

Motherboard
Inside the personal computer
Power supply Fan with cover
DVD drive Zip drive
Hard drive
14

• The motherboard contains packages of integrated circuits or chips.
• Integrated circuit/chip
– a device combining dozens of millions of transistors.
• The motherboard is composed of:
– The piece connecting to the I/O devices
– The memory /cache
– The processor/CPU (central processor unit), containing
• Datapath • Control
15

Close-up of PC motherboard
16

Inside the processor chip
17

Memory
Primary/Main memory – RAM (DRAM), cache memory volatile (when it loses power, it forget)
Secondary memory – (magnetic) disk, slow and cheap non-volatile
-Magnetic hard drive
-Optical disks, including CD (compact disks) and
DVD (digital video disks)
-Magnetic tape – slow access, used for back-up
-FLASH – removable memory card typically attached by a USB (Universal Serial Bus)
-Floppy drives and Zip drives
18

Memory capacity
Growth of capacity per DRAM chip over time.

Moore’s Law
• The number of transistors on integrated circuits doubles approximately every two year
• It is the observation that over the history of computing hardware
20

21

The Chip Manufacturing Process
22