Professional Documents
Culture Documents
The Basics: Course Information
The Basics: Course Information
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
©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
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
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
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
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
Mask
The silicon crystal is slowly pulled out of the molten
Grow Boule
Photoresist
silicon, which is rotating to maintain uniformity.
Expose
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
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
25 26