Hello World! An Invitation to Computer Science
Lecture Slides
Control and Memory Circuits
and the Von Neumann Architecture
Monday, March 3, 2008
- truth table can represent any (binary) function
need not model real world, or anything in particular
on the other hand, it can be effective
descriptive, not algorithmic
- can apply sum-of-products algorithm
- can then translate Boolean expressions to circuits
- but is this always practical?
Control circuits
- so far: circuits to do "sequential" operations
- now we need circuits for conditionals and iteratives
- same truth-table techniques apply
first we need to think of control as logic
Conditional as Boolean expression
if c then s else t
c s t out product terms
-----------------------------------------------
0 0 0 0
0 0 1 1 (NOT c) AND (NOT s) AND t
0 1 0 0
0 1 1 1 (NOT c) AND s AND t
1 0 0 0
1 0 1 0
1 1 0 1 c AND s AND (NOT t)
1 1 1 1 c AND s AND t
(c AND s) OR ((NOT c) AND t)
this is 1-bit multiplexor
this idea scales, as well
Binary → unary
decodertakes n-bit binary-coded input
and turns on exactly one of 2n lines
ins outs
a b c d e f
---- ----------
0 0 1 0 0 0 c = (NOT a) AND (NOT b)
0 1 0 1 0 0 d = (NOT a) AND b
1 0 0 0 1 0 e = a AND (NOT b)
1 1 0 0 0 1 f = a AND b
Iterative operations
- problem: we need to count
- we can build circuits to add and compare
- how do we remember what number we are at?
- we need memory
Strange loops
- idea: use a feedback loop
- essentially have circuit saying:
"I am on, I am on, I am on, ..."
- first attempt: feedback through OR:
- but how to turn it off?
Toggle flip-flop
input output
t old new
-------------
0 0 0
0 1 1
1 0 1
1 1 0
Just an XOR ... with feedback!
Abstraction hierarchy
- zooming in and out
- avoiding being overwhelmed by detail
- switches & wires → gates → integrated circuits
von Neumann architecture
- common among most computers, over 50+ years
- 5 components (focus on: ALU, memory, control)
- sequential execution of instructions:
fetch from memory, then execute
- stored-program concept
Memory
- RAM: constant-time access to any address
can be built as array of flip flops
- ROM v. general case
- bits-per-cell (memory width): standard 1 byte (8 bits)
- can use consecutive cells to represent larger quantities
- addresses v. data
accidental confusion can be source of bugs
but also gives stored-program concept its power
- load (nondestructive fetch) and store (destructive)
- von Neumann bottleneck and caches
Input and output
- like memory has notion of fetch and store
- volatile v. non-volatile memory
- disk drives:
sectors, tracks, heads
seek, latency, transfer times
- sequential devices
- displays, printers, keyboards, etc.
- I/O much slower than other operations
- buffers, controllers, and interrupts