Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

©Clark Guest 2008 ECE 30 Engineering Computation

Course Information
Instructor: Clark Guest
Office: EBU1-3407
Phone: 858-534-6549

The Basics
email: cguest@ucsd.edu (Put ECE 30 in subject line)
Office Hours: Tue & Thurs 3:30pm to 4:30pm

Text: Computer Organization & Design, 4th ed.


ECE 30 Chapter 1 Patterson and Hennessy

Website: http://cguest.pageout.net (Course notes)


Grading:
40% Weekly Quizzes
30% Programming Labs (MARS simulator on your own computer)
30% Final Exam

©Clark Guest 2008 ECE 30 Engineering Computation ©Clark Guest 2008 ECE 30 Engineering Computation

Course Outline The Basics


Week Topic Read What happens when you press a key
1 The Basics Ch.1,B.1-B.4 Layers of soft ware
2 The MIPS Architecture Refer to Ch.4 From text file to computer instructions
3-4 MIPS Assembly Language Ch.2, B.5, 6, 8, 10 How computer chips are made
5-6 Computer Arithmetic Ch. 3
7 Performance Ch. 1
8 MIPS Architecture-Revisited Ch. 4
9 Pipelining Ch. 4
10 Memory Caches Ch. 5
4
©Clark Guest 2008 ECE 30 Engineering Computation ©Clark Guest 2008 ECE 30 Engineering Computation

What Happens When You Press a Key What Happens When You Press a Key (2)
Embedded
Processor
Suppose you are using a word processing program.
You press the letter “A” on the keyboard. Then...
USB
Receiver
CPU

The key closes an electrical contact.


RAM
Keyboard

Buffer A microprocessor in the keyboard (an embedded


Word
Processing
processor) senses it is a contact in the first column,
Data
second row of an array of contacts.
Display

Display
Monitor
Data
The keyboard processor looks up in its own memory
that the code for that contact is 01000001.
Graphics
Controller The microprocessor sends that code, one bit at a
time (perhaps over USB) to the computer
motherboard.

©Clark Guest 2008 ECE 30 Engineering Computation ©Clark Guest 2008 ECE 30 Engineering Computation

What Happens When You Press a Key (3) What Happens When You Press a Key (4)
The USB receive processor sets a signal line high (an The word processing program continues on until it
interrupt). reaches a subroutine call to the OS. The OS call
The central processing unit (CPU) senses the checks to see if any events (keypresses,
interrupt. Instead of executing the next instruction mouseclicks, etc) have occurred. The OS call returns
in the word processing program, it jumps to a to the word processing program with a code for
“keypress” on the top of the system stack, and the
subroutine in the operating system (OS).
code 01000001 (which it has retrieved from the
The CPU reads from an address that the OS knows buffer) next on the stack.
for the USB receive processor, which places the
01000001 code in parallel on the CPU data bus. The word processing program jumps to a subroutine
to handle keypresses.
The OS first has the CPU read the code into one of
its registers, then it writes the contents of the The subroutine first stores the 01000001 code in
register to a memory location (a buffer). memory at the end of a string of other codes
The OS subroutine returns to the word processing representing the letters in the word processing
program. document.
7 8
©Clark Guest 2008 ECE 30 Engineering Computation ©Clark Guest 2008 ECE 30 Engineering Computation

What Happens When You Press a Key (5) What Happens When You Press a Key (6)
The subroutine then makes an OS subroutine call to A hardware graphics processor reads the memory
place the letter on the screen. It passes to the OS locations where the “A” pixels have been written. It
the 01000001 code, and a number identifying the converts the pixel information into electrical
font to use. signals (usually red, blue, and green signals).
The OS subroutine uses that information to look up At precisely the right instant, the electrical signals
from a table in memory the graphical pattern of turn on pixels in an LCD display to cause the letter
pixels that represents the letter “A” in that font. “A” to appear.
The OS subroutine copies that graphical pattern to
locations in memory that represent the pixels on
the display screen.
The OS subroutine returns to the word processor
keypress subroutine, which then returns to the
main word processor program
9 10

©Clark Guest 2008 ECE 30 Engineering Computation ©Clark Guest 2008 ECE 30 Engineering Computation

Layers of Soft ware Layers of Soft ware (2)


The organization of a computer is often
represented by a set of nested circles:
Applications API
The center circle is the hardware: the electronics,
the disk drives, the display, etc.
Kernel The next circle out has t wo pieces: the kernel and
Hardware the drivers. These are parts of the operating system
that must change when the hardware changes.
Drivers
The next circle out is the rest of the operating
system that is hardware independent.
Operating
System The next circle out (the final one) is the application
soft ware. The boundary bet ween this layer and the
OS layer is often called the API, application
programming interface. It is the set of subroutine
calls the application programs can make to the
operating system to affect the hardware. 12
©Clark Guest 2008 ECE 30 Engineering Computation ©Clark Guest 2008 ECE 30 Engineering Computation

From Text File to Computer Instructions From Text File to Computer Instructions (2)
Compiled Interpreted
Languages Languages

Program
Text File
Program
Text File
For compiled Languages: C, C++, Fortran...

COMPILER
Token
Binary File INTERPRETER
You create a program file using a text editor
Assembly Language
Text File TOKEN
The program file is input to a program called the
SUBROUTINES
compiler. It breaks complicated expressions into
ASSEMBLER assembly language instructions. Each assembly
Object Other Code
language instruction corresponds to one
Binary File and Library
Binary Files
fundamental operation the CPU can perform. The
LINKER
output of the compiler is the assembly language file.
Executable
Binary File
The assembly language file is also a text file; it can
be read by humans. Each line of the assembly
LOADER
language file is one assembly language instruction
Executing
and its arguments. Typical instructions are: add,
Program in
System
RAM
14

©Clark Guest 2008 ECE 30 Engineering Computation ©Clark Guest 2008 ECE 30 Engineering Computation

From Text File to Computer Instructions (3) From Text File to Computer Instructions (4)
A programmer also has the option of directly The object file is input to a program called the
creating an assembly language text file rather linker. It pulls together machine code for all the
than programming in a high level language. A good files that make up a program, including library
assembly language programmer can create code. It fills in the addresses of all the subroutines
programs that run faster and use less memory into the machine code subroutine calls. The output
than compiled programs. of the linker is the executable file.
The assembly language file is input to a program When you ask for your program to run, a program
called the assembler. The assembler converts the called the loader transfers the executable file from
assembly language instructions into corresponding disk into RAM memory locations. The loader may
binary codes. It also lays out a map of where also adjust address values in the executable
variables will be stored in memory. It also makes a according to where in memory it is loaded. When
table of subroutine calls to other files. The output the loader finishes, it starts the CPU executing at
of the assembler is the machine code, or object file. the first memory location of the loaded program.
It is not human readable.
15 16
©Clark Guest 2008 ECE 30 Engineering Computation ©Clark Guest 2008 ECE 30 Engineering Computation

From Text File to Computer Instructions (5) From Text File to Computer Instructions (6)
Often, modern programming systems hide this For interpreted Languages: Basic, Perl, Java,
complexity in an Integrated Development Python,...
Environment (IDE), so all the steps require a single
command from the user. You create a program file using a text editor.
When you ask for your program to run, your
program file is read from disk by a program called
the interpreter. The interpreter converts each word
in the program file into a code that is only one or
t wo bytes long. These codes are called tokens. The
interpreter may also rearrange the order of the
tokens for efficient execution. The interpreter
allocates locations in memory to store variables.

17 18

©Clark Guest 2008 ECE 30 Engineering Computation ©Clark Guest 2008 ECE 30 Engineering Computation

From Text File to Computer Instructions (7) Compiled vs Interpreted


The interpreter then reads the list of tokens one by Advantages of compiled languages
one. Each token tells the interpreter to execute a Execute faster: 1.5x to 100x
different subroutine. These subroutines are supplied
with the interpreter; they are not written by the Require less memory
user. Can perform any soft ware task.

After executing the program for the first time, the Advantages of interpreted languages
interpreter may also store the tokens to a file, so it xkcd.com
Faster edit-debug cycle
doesn’t have to repeat that process.
Should never crash the computer

Easier to port bet ween machines

19 20
©Clark Guest 2008 ECE 30 Engineering Computation ©Clark Guest 2008 ECE 30 Engineering Computation

How Computer Chips Are Made How Computer Chips Are Made (2)
Slice Wafers

A quantity of very pure silicon is melted.


A small single crystal of silicon is dipped into the
melt.
UV

Mask
The silicon crystal is slowly pulled out of the molten
Grow Boule
Photoresist
silicon, which is rotating to maintain uniformity.
Expose

Molten silicon adhering to the crystal cools and


crystalizes along the same pattern.
Develop

Eventually a single crystal of silicon, called a boule,


Process
is grown. It is the shape of a salami, eight or more
inches in diameter and many inches long.
Clean

22

©Clark Guest 2008 ECE 30 Engineering Computation ©Clark Guest 2008 ECE 30 Engineering Computation

How Computer Chips Are Made (3) How Computer Chips Are Made (4)
The boule is cut into slices less than a millimeter The wafer is placed in one of several processes. Only
thick. the exposed parts of the silicon are affected:
One surface of each slice is polished to atomic Growing oxide

smoothness. Etching away silicon

The slice (called a wafer) is coated with a thin layer Diffusing P-type impurities
of liquid plastic called photoresist, which hardens in Diffusing N-type impurities
air.
Depositing metal traces (wires)
The coated wafer is exposed to a pattern of
The wafer is placed in a chemical bath that
ultraviolet light.
dissolves away the rest of the photoresist.
The wafer is placed in a chemical bath. Photoresist
The process is repeated from the photoresist
that has been exposed to ultraviolet light is
coating step above. Many iterations are typically
dissolved away.
needed to complete a circuit fabrication.
23 24
©Clark Guest 2008 ECE 30 Engineering Computation ©Clark Guest 2008 ECE 30 Engineering Computation

How Computer Chips Are Made (5) Review: The Basics


The wafer is scribed and broken into individual The steps involved when you press a key on the
chips. keyboard
Each chip is tested with electrical probes. The steps involved in compiling a program
Working chips are mounted in a package and The steps involved in interpreting a program
electrical connections are made from the chip to
the package pins. The steps involved in fabricating a computer chip

25 26

You might also like