computerArchitecture
computerArchitecture
www.nand2tetris.org
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 5: Computer Architecture slide 1
Von Neumann machine (circa 1940)
CPU
Input
device
Memory Arithmetic Logic
Unit (ALU)
(data
+ Registers
instructions)
Output
Control device
Stored
program
concept!
John Von Neumann (and others) ... made it possible Andy Grove (and others) ... made it small and fast.
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 5: Computer Architecture slide 2
Processing logic: the instruction cycle
CPU
Input
device
Memory Arithmetic Logic
Unit (ALU)
(data
+ Registers
instructions)
Output
Control device
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 5: Computer Architecture slide 3
The Hack computer
A 16-bit Von Neumann platform
The instruction memory and the data memory are physically separate
Screen: 512 columns by 256 rows, black and white
Keyboard: standard
Designed to execute programs written in the Hack machine language
Can be easily built from the chip-set that we built so far in the course
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 5: Computer Architecture slide 4
Memory: conceptual / programmer’s view
Memory
Data
Screen
memory
map
Screen
Keyboard map
Keyboard
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 5: Computer Architecture slide 5
Memory: physical implementation
load The Memory chip is essentially a
Memory package that integrates the three chip-
parts RAM16K, Screen, and Keyboard
0 into a single, contiguous address space.
in
This packaging effects the
RAM16K
16 programmer’s view of the memory, as
(16K mem. chip) out well as the necessary I/O side-effects.
16383 16
Keyboard
Access logic:
Access to any address from 0 to 16,383 results in accessing the RAM16K chip-part
Access to any address from 16,384 to 24,575 results in accessing the Screen chip-part
Access to address 24,576 results in accessing the keyboard chip-part
Access to any other address is invalid.
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 5: Computer Architecture slide 6
CPU
from
data memory inM
16 outM
16
to data
writeM
CPU
from memory
instruction instruction 1
memory 16 addressM
15
pc to instruction
reset memory
a Hack machine language 15
instruction like M=D+M, 1
CPU internal components (invisible in this chip diagram): ALU and 3 registers: A, D, PC
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 5: Computer Architecture slide 7
The C-instruction revisited
binary: 1 1 1 a c1 c2 c3 c4 c5 c6 d1 d2 d3 j1 j2 j3
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 5: Computer Architecture slide 8
CPU implementation dest = comp; jump comp dest jump
binary: 1 1 1 a c1 c2 c3 c4 c5 c6 d1 d2 d3 j1 j2 j3
Chip diagram:
Includes most of the
ALU output
CPU’s execution logic
The CPU’s control logic is
hinted: each circled “c” C
C C
ALU
C
bar does not A
Mux
A
represent a instruction A/M
C
chip, but
Mux
rather indicates M
that the inM
C writeM
instruction bits
A
are decoded addressM
somehow. C
reset
A
PC pc
Pipelining
Caching
Efficiency
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 5: Computer Architecture slide 10
Perspective: some issues we haven’t discussed (among many)
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 5: Computer Architecture slide 11