Homework #4
http:/homepages.ius.edu/rwisman/C251/html/homework/hw4Solutions.htm
Homework #4
Total points 52 Extra credit 6 Section 3.1 - pp. 177 - 178 6 (4 pts)
Last Updated: 09/28/2009
Describe an algorithm that takes as input a list of n integers and fi
4/21/08
Review of Combinational Circuits
6.3 Sequential Circuits
Combinational circuits. Basic abstraction = switch. In principle, can build TOY computer with a combinational circuit. 255 16 = 4,080 inputs 24080 rows in truth table! no simple pattern each
4/23/08
The TOY Machine
6.5 TOY Machine Architecture
Combinational circuits. ALU. Sequential circuits. Memory. Machine architecture. Wire components together to make computer. TOY machine. 256 16-bit words of memory. 16 16-bit registers. 1 8-bit program c
Representing Information
0 1 1 0 1 1 0 0
- Representing information using bits - Number representations - Some other bits Chapter 2.3-2.4
Bit Juggling
Comp411 Fall 2009
8/31/2008
L02 Encoding Information 1
Motivations
Computers Process Information Inform
Homework #2
http:/homepages.ius.edu/rwisman/C251/html/homework/hw2Solutions.htm
Homework #2
33 points Section 1.5 What rule of inference is used in each of these arguments?
Last Updated: 09/07/2009
4 (5) a. b. c. d. e.
simplification disjunctive syllogism
Welcome to Comp 411!
I thought this course was called Computer Organization
David Macaulay
1) Course Mechanics 2) Course Objectives 3) What is Information? 4) Computer Abstractions
Comp411 Fall 2009
8/26/2009
L01 - Introduction 1
Meet the Crew
Instructor:
Name: xxxxxxxxxxxxxxxxxxxxxxxxx
Math 216 Discrete Structures (2) Homework: Logic II 50
1. (10) (1.6: 6) Use a direct proof to show that the product of two odd integers is odd. Let a, b be odd integers. Then we can write a = 2x + 1 and b = 2y + 1 for some
Computer Performance
He said, to speed things up we need to squeeze the clock
Comp 411 Fall 2009
10/26/2009
L12 Performance 1
Why Study Performance?
Helps us make intelligent design choices See through the marketing hype Key to understanding underlying co
Arithmetic Circuits
Didnt I learn how to do addition in the second grade? UNC courses arent what they used to be.
01011 +00101 10000
Finally; time to build some serious functional blocks
Well need a lot of boxes
Comp 411 Fall 2009
10/14/09
L9 Arithmetic C
Transistors and Logic
A
1) 2) 3) 4) 5) 6)
The digital contract Encoding bits with voltages Processing bits with transistors Gates Truth-table SOP Realizations Multiplexer Logic
B
Co
Bo p 41 x- o -Tr 1 ic k s
m
F=
A
xo rB
Comp 411 Fall 2009
9/30/09
L08 Tra
Assemblers and Compilers
Long, long, time ago, I can still remember How mnemonics used to make me smile. And I knew that with just the opcode names that I could play those assembly games and maybe hack some programs for a while. But Comp 411 made me shive
Stacks and Procedures
I forgot, am I the Caller or Callee? Dont know. But, if you PUSH again Im gonna POP you.
Support for High-Level Language constructs are an integral part of modern computer organization. In particular, support for subroutines, procedu
Adventures in Assembly Land
What is an Assembler ASM Directives ASM Syntax Intro to SPIM/MARS Simple examples
Comp 411 Fall 2009
9/16/09
L5 Simulator 1
A Simple Programming Task
Add the numbers 0 to 4 10 = 0 + 1 + 2 + 3 + 4 In C: int i, sum; main() cfw_
Name: xxxxxxxxxxxxxxxxxxxxxxxxx
Math 216, Fall 2009 Practice Exam 1 Logic, Sets, Relations and Functions
Set properties with multiple notation Let A, B be two sets Set complement Set Minus Ac = A A\B =AB
1. (20) Match the left hand sets (1-5) to their equ
Operands and Addressing Modes
Where is the data? Addresses as data Names and Values Indirection
Reading: Ch. 2.3
Comp 411 Fall 2009
9/9/09
L4 Addressing Modes 1
Just enough C
For our purposes C is almost identical to JAVA except: C has functions, JAVA ha
Concocting an Instruction Set
Nerd Chef at work.
move add add move rotate . flour,bowl milk,bowl egg,bowl bowl,mixer mixer
Read: Chapter 2.1-2.3, 2.5-2.7
Comp 411 Fall 2009 9/2/09 L03 Instruction Set 1
A General-Purpose Computer
The von Neumann Model
Many
4/14/08
Computer Architecture
6. Combinational Circuits
TOY lectures. von Neumann machine.
This lecture. Boolean circuits.
George Boole (1815 1864)
Claude Shannon (1916 2001)
Introduction to Computer Science Sedgewick and Wayne Copyright 2007 http:/www.cs
4/14/08
Properties of Algorithms
7.8 Intractability
Q. Which algorithms are useful in practice? A working definition. [von Neumann 1953, Gdel 1956, Cobham 1964, Edmonds 1965, Rabin 1966] Model of computation = deterministic Turing machine. Measure running
Fundamental Questions
Duality, Universality, and Computability
Q. What is a general-purpose computer? Q. Are there limits on the power of digital computers? Q. Are there limits on the power of machines we can build?
Pioneering work in the 1930s. Hilbert,
Overview
What is CS 101? Broad and technical introduction to programming and pertinent areas of Computer Science. Prerequisites: None - the course is intended to be accessible to all students
What is CS 101-E? Separate section of CS101 intended for stud
Why Programming?
1.1 Your First Program
Idealized computer. "Please simulate the motion of a system of N heavenly bodies, subject to Newton's laws of motion and gravity." Prepackaged software solutions. Great, if it does exactly what you need. Computer pr
Control Flow
1.3 Conditionals and Loops
Control flow. Sequence of statements that are actually executed in a program. Conditionals and loops: enable us to choreograph control flow.
boolean 1 statement 1 true statement 2 statement 1 statement 3
Copyright
Arrays
1.4 Arrays
This lecture. Store and manipulate huge quantities of data. Array. Indexed sequence of values of the same type. Examples. 52 playing cards in a deck. 14 thousand undergrads at UVa. 1 million characters in a book. 10 million audio samples
Input and Output
1.5 Input and Output
Input devices.
Keyboard
Mouse
Hard drive
Network
Digital camera
Microphone
Output devices.
Display
Speakers
Hard drive
Network
Printer
MP3 Player
Goal. Java programs that interact with the outside world.
2
Input and O
2.1 Functions
2.1 Functions
x y z
f
f (x, y, z)
Functions (Static Methods)
Java function. Takes zero or more input arguments. Returns one output value.
Anatomy of a Java Function
Java functions. Easy to write your own.
Applications. Scientists use mathe
Overview
2.3 Recursion
What is recursion? When one function calls itself directly or indirectly.
Why learn recursion? New mode of thinking. Powerful programming paradigm.
Many computations are naturally self-referential. Mergesort, FFT, gcd. Linked data
Overview
4.1 - 4.2 Analysis of Algorithms
Analysis of algorithms. Framework for comparing algorithms and predicting performance. Scientific method. Observe some feature of the universe. Hypothesize a model that is consistent with observation. Predict even
2/3/08
What is TOY?
5. The TOY Machine
An imaginary machine similar to: Ancient computers. Today's microprocessors.
Introduction to Computer Science Sedgewick and Wayne Copyright 2007 http:/www.cs.Princeton.EDU/IntroCS
2
Why Study TOY?
Machine language
2/3/08
What We've Learned About TOY
TOY II
Data representation. Binary and hex. TOY. Box with switches and lights. 16-bit memory locations, 16-bit registers, 8-bit pc. 4,328 bits = (255 16) + (15 16) + (8) = 541 bytes! von Neumann architecture.
TOY inst