Topic 1: Overview of Computer
Organization and Systems
Programming
CSE 30: Computer Organization and Systems Programming
Summer 2014
Diba Mirza
Dept. of Computer Science and Engineering
University of California, San Diego
Information about the Instructor/TAs
v Instructor: Diba Mirza
v Education: Ph.D. (ECE, UCSD)
v Office: 2124 EBU3B
v Email: dimirza@eng.ucsd.edu
v Office hours:
v Tu, Fri10:00am-10:50am
v Or by appointment
v TAs: Riley Yeakle, Ning Liu
v Tutors: Alex Rosengarten, Martin Gao, Ben Martin, Junjie Luo
Goals of the course
1. Hone your C, learn the language of the machine: ARM
Assembly
2. Become better programmers
v Go beyond black box programming
v Explore your bugs
3. Understand how a computer works
v Look under the hood of high-level programs
v Learn big ideas that have shaped computing: interesting!
v Understand the limits of a computer
3
What we will learn
1. What the programmer writes?
v A high level language: Specifically C
2. How the program is converted to the language of h/w?
v Assembly Language: Specifically ARM
3. How the machine executes the program?
v The main components of the computer
v Peek into the processor
v Interaction of the processor with other components of the
computer (Memory, I/O)
4. What are the causes for errors in our high-level code?
5. Why do programs go slow?
4
Logistics: Course Components
HW/PA Assignments 30%
Midterm 25% (1.5 hrs)
Final 35% (3 hrs )
Class participation 10%
(Clickers)
Grading structure and policy
v What do I need to get an A- or better?
v >90% overall
v What do I need to pass (C or better)?
v > 50% overall AND
v Must appear on Final exam
Logistics: Resources
v All
information about the class is on the class
website
v Approx Syllabus
v Schedule
v Readings
v Assignments
v Grading policy
v Forum (Piazza)
I will assume that you check these daily
v Grades will be posted on Gradesource
7
Logistics: References
v Main references:
1. ARM Assembly Language: Fundamentals and
Techniques, William Hohl
2. The C Programming Language, Kernighan and
Ritchie, 2nd edition
Other suggested reading on course website
PAs: Raspberry Pi!
Why Pi?
PAs: Raspberry Pi!
v Practice programming for an ARM based embedded
platform!
v Collect your Pi from Riley and Ning during discussion-
TODAY!
v Collateral returned at the end of the course if the board is
in working condition.
v Get your own and we’ll put an image for you!
In class we will use Clickers!
v Lets you vote on multiple choice questions in
real time.
11
Lecture: Peer Instruction
v I will pose carefully designed questions. You will
v Solo vote: Think for yourself and select answer
v Discuss: Analyze problem in teams of three
v Practice analyzing, talking about challenging concepts
v Reach consensus
v If you have questions, raise your hand and I will come over
v Group vote: Everyone in group votes
v You must all vote the same to get your point
v Class wide discussion:
v Ledby YOU (students) – tell us what you talked about in
discussion that everyone should know!
Why Peer Instruction?
v You get to make sure you are following the
lecture.
v I get feedback as to what you understand.
v It’s less boring!
v Research shows it promotes more learning than
standard lecture.
Take a minute to introduce yourself to your group
13
Working out Logistics
v Doyou have your own Raspberry Pi or plan to
buy one soon?
A. Yes
B. No
Familiarity with C
v How familiar are you with C?
A. I know C pretty well and have a lot of programming
experience
B. Reasonably well, lots of gaps
C. I don’t know what a pointer in C is
D. All I know is that it is a programming language that
follows B.
Course Problems…Cheating
vWhat is cheating?
vStudying together in groups is encouraged
vTurned-in work must be completely your own.
vCommon examples of cheating: running out of time on a
assignment and then pick up output, take homework from box
and copy, person asks to borrow solution “just to take a look”,
copying an exam question, …
vBoth “giver” and “receiver” are equally culpable
vCheating on PA and HW/ exams; In most cases, F in the course.
vAny instance of cheating will be referred to Academic Integrity
Office
Email Policy
v Please use the forum as much as possible!
v Your classmates benefit from your questions
v Your classmates can answer your questions
v I will check the forum daily
v I
will attempt to respond to emails within 24
hours
17
Let’s look at the evolution of the modern digital
computer ….
The Evolution of Computing
Pascaline
Schickard’s Machine
2400 BC 17th Century
Big Idea behind early ‘computers’
Fixed Program Model
Specific (computation) Problem
Circuit to solve it
• The ‘program’ was wired into the computing device
The Evolution of Computing
Automated textile looms
Pascaline
Schickard’s Machine Jacquard’s Loom Analytical Engine
2400 BC 17th Century 1804 1822
Next big idea…The stored program model
• Key Ideas: Problem
• Computer divided into two
components: Processor and
Memory
• Program and data stored in Recipe/ Program
the same place: memory (Set of instructions)
• Consequences
• Programs easily fed into the
computer Memory
Processor (Program)
• Avoid clumsy methods of
programming
Stored Program Model
proposed by Jon Von Neumann
Stored Program: Big Idea!
We can do a lot of complex computation by:
• Designing a minimal set of instructions that the
machine can understand
• Writing programs in terms of these instructions
Have a new problem?
• Don’t change the machine
• Change the recipe
The Von Neumann Architecture
Memory
(data and programs)
Buses
Input Control Unit Arithmetic Output
Logic Unit
4 Basic Components of a Computer:
1. Memory: a long but finite sequence of cells (1D)
• Each cell has a distinct address
• Data in each cell: instruction, data or the address of another cell
2. Control Unit: Fetches instructions from memory and decodes them
3. Arithmetic Logic Unit: Does simple math operations on data
4. Input/Output: The connections with the outside world
The Evolution of Computing
Revolution:
1st Large Scale, General Purpose Electronic Computer
ENIAC
v More complex electronic circuits
v Solved more general problems
v Programming involved configuring
external switches or feeding instructions
through punched cards
WWII The stored program model
The Evolution of Computing
Revolution: Integrated Circuit:
Many digital operations on the same material
Vacuum tubes
Exponential Growth
of Computation
(1.6 x 11.1 mm)
ENIAC Stored Integrated Circuit Moore’s Law
Program
Model
WWII 1949 1965
Technology Trends:
Microprocessor Complexity
Gordon Moore
Intel Cofounder
In 1965, Gordon Moore
predicted that the number of
transistors per chip would
double every 18 months (1.5
years)
Exponential growth in computing
Side effects of Moore’s Law
Side effects of Moore’s Law
Number of transistors shipped per year
Side effects of Moore’s Law
Average transistor price per year
Side effects of Moore’s Law
World-wide semiconductor revenues
Computer Technology - Dramatic Change!
vMemory
vDRAM capacity: 2x / 2 years (since ‘96);
64x size improvement in last decade.
vProcessor
vSpeed 2x / 1.5 years (since ‘85);
100X performance in last decade.
vDisk
vCapacity: 2x / 1 year (since ‘97)
250X size in last decade.
Current State of Computing
v Computers are cheap, embedded
everywhere
v Transition from how to we build computers
to how to we use computers
The Next REvolution
Ecological Monitoring Financial Computation
Biotechnology
Robotics
“The use of [these embedded computers] throughout society could
well dwarf previous milestones in the information revolution.”
Existing
Sensors
“Flipper Net”
ADCP
Thermistor
CTD
Wave - Tide Pressure Sensor ADP
Drifters
v Autonomous Underwater Explorers:
Self organizing drifters
v Dynamic, spatiotemporal 3D sampling
v Track water motions or mimic
migration behavior of organisms
v Buoyancy control can follow ocean
surface
v Acoustic modem for 3D localization
amongst drifters
v 25 cm diameter
v Under development by Curt Schurgers
(ECE), Jules Jaffe, Peter Franks (SIO),
Raymond de Callafon (MAE)
National Geographic Engineers for Exploration
Happening at UCSD now:
http://ngs.ucsd.edu/
Computing Systems
v Increasinglysmaller
v Higher performance
v More memory
v Lower power
v Embedded
v Everywhere
v …but extremely complex
How do we handle complexity?
Algos: CSE 100, 101
Application (ex: browser)
CSE 131 CSE 120 Operating
Compiler System
CSE 30
Software Assembler (Mac OSX)
Instruction Set
Hardware Processor Memory I/O system Architecture
CSE 140
Datapath & Control
Digital Design
Circuit Design
Transistors
v Big idea: Coordination of many levels of abstraction
Dan Garcia!
Levels of Representation
temp = v[k];
High Level Language v[k] = v[k+1];
Program (e.g., C)
v[k+1] = temp;
Compiler
ldr " r0, [r2]"
Assembly Language ldr " r1, [r2, #4]"
Program (e.g.,ARM) str " r1, [r2]"
str " r0, [r2, #4]"
Assembler
0000 1001 1100 0110 1010 1111 0101 1000
Machine Language
1010 1111 0101 1000 0000 1001 1100 0110
Program (ARM)
1100 0110 1010 1111 0101 1000 0000 1001
0101 1000 0000 1001 1100 0110 1010 1111
Machine
Interpretation
Hardware Architecture Description
(e.g., block diagrams)
Architecture
Implementation
Logic Circuit Description
(Circuit Schematic Diagrams)
Dan Garcia!
Abstraction is good – but …
v We still need to understand the system!
v As a programmer you will be manipulating data.
v Data can be anything: numbers (integers, floating
points), text, pictures, video !
v Writing efficient code involves understanding
how “data” and programs are actually represented
in memory
v Take a break and lets talk bits and bytes:
Number representation
Reading Assignment
v ARM 1.4, 1.5.1, 1.5.3