Welcome Aboard – Chapter 1COMP 2610
Dr. James Money COMP 2610
1
• Computer: electronic genius?▫NO! Electronic idiot!▫Does exactly what we tell it to, nothing more.
• Goal of the course:▫You will be able to write programs in C
and understand what’s going on underneath.
• Approach:▫Build understanding from the bottom up.▫Bits Gates Processor Instructions C
Programming
How We Will Get There
2
Dr. James MoneyCOMP 2610
•Abstraction▫Allows us to be more productive
Can drive a car without knowing how the internal combustion engine works.
▫…until something goes wrong! Where’s the dipstick? What’s a spark plug? Do you understand how a car works?
▫Important to understand the components and how they work together.
Two Recurring Themes
3
Dr. James MoneyCOMP 2610
•Hardware vs. Software▫Most people refer to themselves as one who
specializes in hardware or software, but not both
▫You should take the opposite approach – it is good to know both and sometimes essential Hardware engineers added MMX instructions for video when this did not exist yet
Sorting can be dependent on the underlying hardware
▫You are seen as more versatile if you know both
Two Recurring Themes
4
Dr. James MoneyCOMP 2610
Computer Systems
5
Dr. James MoneyCOMP 2610
ca 1980It took 10 of these boards to
make a Central Processing Unit
ca 2000You can see why they called this CPU a microprocessor!
•When we mention computer systems, most people do not only think of the CPU.
•It usually includes the keyboard, mouse, monitor, video card, hard drive, and so on
•We focus on the CPU and how it does what we want it to do
Computer Systems
6
Dr. James MoneyCOMP 2610
1. All computers, given enough time and memory,are capable of computing exactly the same things. They are Universal Computing Devices
Two important concepts
7
Dr. James MoneyCOMP 2610
= =PDA
WorkstationSupercomputer
2.Problem Transformation▫The ultimate objective is to transform a problem expressed in natural language into electrons running around a circuit!
Two important concepts
8
Dr. James MoneyCOMP 2610
•Mathematical model of a device that can performany computation – Alan Turing (1937)▫ability to read/write symbols on an infinite
“tape”▫state transitions, based on current state
and symbol
•Every computation can be performed by some Turing machine. (Turing’s thesis)
Computers as Universal Computing Devices
9
Dr. James MoneyCOMP 2610
Turing Machines
10
Dr. James MoneyCOMP 2610
Tadda,b a+b
Turing machine that adds
Tmula,b ab
Turing machine that multiplies
For more info about Turing machines, seehttp://www.wikipedia.org/wiki/Turing_machine/
For more about Alan Turing, seehttp://www.turing.org.uk/turing/
• Also known as a Universal Computational Device: a theoretical device that accepts both input data and instructions as to how to operate on the data
Universal Turing Machine
11
Dr. James MoneyCOMP 2610
•U is programmable – just like a computer!• instructions are the input data•a computer can emulate a Universal
Turing Machine
•A computer is a universal computing device.
Computers as Universal Computing Devices
12
Dr. James MoneyCOMP 2610
•In theory, computer can compute anything that’s possible to compute given enough memory and time
•In practice, solving problems involves computing under constraints.▫time
weather forecast, next frame of animation, etc▫cost
cell phone, automotive engine controller, etc▫power
cell phone, handheld video game, etc
From Theory to Practice
13
Dr. James MoneyCOMP 2610
Transformations between layers
14
Dr. James MoneyCOMP 2610
Problems
Language
Microarchitecture
Circuits
Devices
Algorithms
Instruction Set Architecture
•We describe the problem initially in natural language
•This is inefficient▫There are ambiguities in the description
normally▫“Stir until soup is thick” has multiple
meanings to different people•We cannot have this ambiguity in
computer programs•We need precision
Statement of Problem
15
Dr. James MoneyCOMP 2610
•In order to make the problem precise, we turn it into an algorithm
•This process is called software design▫We choose algorithms and data structures
•An algorithm is a step by step procedure that is guaranteed to terminate such that each step is precisely stated and can be carried out by a computer.
•There are three terms for these properties.
Algorithm
16
Dr. James MoneyCOMP 2610
•Definiteness – each step is precisely stated
•Effective Computability – each step can be carried out by a computer. For example, you cannot ask a computer to find the largest prime number.
•Finiteness – the algorithm terminates.
Algorithm
17
Dr. James MoneyCOMP 2610
•There are many algorithms for each problems.
•There may be one with the fewest steps
•Others may allow concurrent computations
Algorithm
18
Dr. James MoneyCOMP 2610
•We now using programming to convert the algorithm to a program
•Programming languages are precise and invented to specify a sequence of instructions to the computer
•Over 1000 languages•There are two types of languages:
▫High level – C,C++,Pascal, Java▫Low Level – Assembly, one language for
each computer type
Program
19
Dr. James MoneyCOMP 2610
• Next, by compiling, we convert the programming language into the instruct set of the computer, called the ISA
• The ISA specifies what instructions the computer can perform, what values it needs, and it’s results
• We use the term operand to describe the values the instruction needs
• The ISA specifies acceptable representations for operands called data types
• The ISA also specifies where the operands are located called the addressing modes
Instruction Set Architecture(ISA)
20
Dr. James MoneyCOMP 2610
•Processor design results in the microarchitecture that runs the ISA
•The microarchitecture is the detailed particular implementations of the ISA
•There are many microarchitectures for each ISA▫Intel, AMD for x86▫Different models of Intel chips
Microarchitecture
21
Dr. James MoneyCOMP 2610
•We now implement the microarchitecture using simple logic circuits
•Here there is a cost tradeoff between cost and performance▫NOT gates are cheaper than regular ones
•Many choices just for a simple case of addition
•This is called the logic circuit design phase
Logic Circuit
22
Dr. James MoneyCOMP 2610
•Finally, process engineering and fabrication results in the devices used to build the logic circuits
•There might be CMOS, NMOS, and other types of circuits.
Devices
23
Dr. James MoneyCOMP 2610
Putting it together
24
Dr. James MoneyCOMP 2610
Solve a system of equations
Gaussian elimination
Jacobiiteration
Red-black SOR Multigrid
FORTRAN C C++ Java
Intel x86PowerPC Atmel AVR
Centrino Pentium 4 Xeon
Ripple-carry adder Carry-lookahead adder
CMOS Bipolar GaAs
Tradeoffs:costperformancepower(etc.)
• Bits and Bytes▫ How do we represent information using electrical signals?
• Digital Logic▫ How do we build circuits to process information?
• Processor and Instruction Set▫ How do we build a processor out of logic elements?▫ What operations (instructions) will we implement?
• Assembly Language Programming▫ How do we use processor instructions to implement algorithms?▫ How do we write modular, reusable code? (subroutines)
• I/O, Traps, and Interrupts▫ How does processor communicate with outside world?
• C Programming▫ How do we write programs in C?▫ How do we implement high-level programming constructs?
Course Outline
25
Dr. James MoneyCOMP 2610