SlideShare une entreprise Scribd logo
1  sur  24
Télécharger pour lire hors ligne
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 1
www.nand2tetris.org
Building a Modern Computer From First Principles
Introduction:
From Nand to Tetris
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 2
Usage and Copyright Notice:
Copyright © Noam Nisan and Shimon Schocken
This presentation accompanies the textbook “The Elements of Computing Systems”
by Noam Nisan & Shimon Schocken, MIT Press, 2005.
We provide 13 such presentations.
Each presentation is designed to support about 3 hours of classroom or self-study instruction.
You are welcome to use or edit this presentation as you see fit for instructional and non-
commercial purposes.
If you use our book and course materials, please include a reference to www.nand2tetris.org
If you have any questions or comments, please write us at nand2tetris@gmail.com
This work is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 3
Course theme and structure
Assembler
Chapter 6
H.L. Language
&
Operating Sys.
abstract interface
Compiler
Chapters 10 - 11
VM Translator
Chapters 7 - 8
Computer
Architecture
Chapters 4 - 5
Gate Logic
Chapters 1 - 3 Electrical
Engineering
Physics
Virtual
Machine
abstract interface
Software
hierarchy
Assembly
Language
abstract interface
Hardware
hierarchy
Machine
Language
abstract interface
Hardware
Platform
abstract interface
Chips &
Logic Gates
abstract interface
Human
Thought
Abstract design
Chapters 9, 12
(Abstraction–implementation paradigm)
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 4
Application level: Pong (example app)
Ball
abstraction
Bat
abstraction
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 5
The big picture
Assembler
Chapter 6
H.L. Language
&
Operating Sys.
abstract interface
Compiler
Chapters 10 - 11
VM Translator
Chapters 7 - 8
Computer
Architecture
Chapters 4 - 5
Gate Logic
Chapters 1 - 3 Electrical
Engineering
Physics
Virtual
Machine
abstract interface
Software
hierarchy
Assembly
Language
abstract interface
Hardware
hierarchy
Machine
Language
abstract interface
Hardware
Platform
abstract interface
Chips &
Logic Gates
abstract interface
Human
Thought
Abstract design
Chapters 9, 12
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 6
High-level programming (our very own Jack language)
/** A Graphic Bat for a Pong Game */
class Bat {
field int x, y; // screen location of the bat's top-left corner
field int width, height; // bat's width & height
// The class constructor and most of the class methods are omitted
/** Draws (color=true) or erases (color=false) the bat */
method void draw(boolean color) {
do Screen.setColor(color);
do Screen.drawRectangle(x,y,x+width,y+height);
return;
}
/** Moves the bat one step (4 pixels) to the right. */
method void moveR() {
do draw(false); // erase the bat at the current location
let x = x + 4; // change the bat's X-location
// but don't go beyond the screen's right border
if ((x + width) > 511) {
let x = 511 - width;
}
do draw(true); // re-draw the bat in the new location
return;
}
}
Ball
abstraction
Bat
abstraction
Typical call to
an OS method
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 7
Operating system level (our very own Jack OS)
/** An OS-level screen driver that abstracts the computer's physical screen */
class Screen {
static boolean currentColor; // the current color
// The Screen class is a collection of methods, each implementing one
// abstract screen-oriented operation. Most of this code is omitted.
/** Draws a rectangle in the current color. */
// the rectangle's top left corner is anchored at screen location (x0,y0)
// and its width and length are x1 and y1, respectively.
function void drawRectangle(int x0, int y0, int x1, int y1) {
var int x, y;
let x = x0;
while (x < x1) {
let y = y0;
while(y < y1) {
do Screen.drawPixel(x,y);
let y = y+1;
}
let x = x+1;
}
}
}
Ball
abstraction
Bat
abstraction
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 8
The big picture
Assembler
Chapter 6
H.L. Language
&
Operating Sys.
abstract interface
Compiler
Chapters 10 - 11
VM Translator
Chapters 7 - 8
Computer
Architecture
Chapters 4 - 5
Gate Logic
Chapters 1 - 3 Electrical
Engineering
Physics
Virtual
Machine
abstract interface
Software
hierarchy
Assembly
Language
abstract interface
Hardware
hierarchy
Machine
Language
abstract interface
Hardware
Platform
abstract interface
Chips &
Logic Gates
abstract interface
Human
Thought
Abstract design
Chapters 9, 12
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 9
A modern compilation model
. . .
RISC
machine
VM language
other digital platforms, each equipped
with its VM implementation
RISC
machine
language
Hack
computer
Hack
machine
language
CISC
machine
language
CISC
machine
. . .
Projects
10-11
written in
a high-level
language
Any
computer
. . .
VM
implementation
over CISC
platforms
VM imp.
over RISC
platforms
VM imp.
over the Hack
platform
VM
emulator
Some Other
language
Jack
language
Some
compiler Some Other
compiler
Jack
compiler
. . .
Projects
7-8
Some
language
. . .
Projects
1-6
Proj. 9: building an app.
Proj. 12: building the OS
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 10
Compilation 101
Observations:
Modularity
Abstraction / implementation interplay
The implementation uses abstract services from the level below.
parsing
Code
generation
Source code
(x + width) > 511
Abstraction
push x
push width
add
push 511
gt
Intermediate code
ImplementationSyntax
Analysis
widthx
+ 511
>
Parse
Tree
Semantic
Synthesis
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 11
The Virtual Machine (our very own VM, modeled after Java’s JVM)
// VM implementation
push x // s1
push width // s2
add // s3
push 511 // s4
gt // s5
if-goto L1 // s6
goto L2 // s7
L1:
push 511 // s8
push width // s9
sub // s10
pop x // s11
L2:
...
if ((x+width)>511) {
let x=511-width;
}
75
450
sp
s2memory (before)
450
...
x
width
75
...
...
525
511
sp
1
sp
511
450
sp
s4 s5 s9
61
sp
s10
450
...
x
width
61
...
...
memory (after)
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 12
The big picture
Assembler
Chapter 6
H.L. Language
&
Operating Sys.
abstract interface
Compiler
Chapters 10 - 11
VM Translator
Chapters 7 - 8
Computer
Architecture
Chapters 4 - 5
Gate Logic
Chapters 1 - 3 Electrical
Engineering
Physics
Virtual
Machine
abstract interface
Software
hierarchy
Assembly
Language
abstract interface
Hardware
hierarchy
Machine
Language
abstract interface
Hardware
Platform
abstract interface
Chips &
Logic Gates
abstract interface
Human
Thought
Abstract design
Chapters 9, 12
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 13
Low-level programming (on the Hack computer)
...
push x
push width
add
push 511
gt
if-goto L1
goto L2
L1:
push 511
push width
sub
pop x
L2:
...
Virtual machine program
For now,
ignore all
details!
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 14
...
push x
push width
add
push 511
gt
if-goto L1
goto L2
L1:
push 511
push width
sub
pop x
L2:
...
// push 511
@511
D=A // D=511
@SP
A=M
M=D // *SP=D
@SP
M=M+1 // SP++
Virtual machine program
Assembly programVM translator
push 511
Low-level programming (on the Hack computer) For now,
ignore all
details!
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 15
...
push x
push width
add
push 511
gt
if-goto L1
goto L2
L1:
push 511
push width
sub
pop x
L2:
...
// push 511
@511
D=A // D=511
@SP
A=M
M=D // *SP=D
@SP
M=M+1 // SP++
Virtual machine program
Assembly program
0000000000000000
1110110010001000
Executable
VM
translator
Assembler
push 511
@SP
M=M+1 // SP++
Low-level programming (on the Hack computer) For now,
ignore all
details!
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 16
The big picture
Assembler
Chapter 6
H.L. Language
&
Operating Sys.
abstract interface
Compiler
Chapters 10 - 11
VM Translator
Chapters 7 - 8
Computer
Architecture
Chapters 4 - 5
Gate Logic
Chapters 1 - 3 Electrical
Engineering
Physics
Virtual
Machine
abstract interface
Software
hierarchy
Assembly
Language
abstract interface
Hardware
hierarchy
Machine
Language
abstract interface
Hardware
Platform
abstract interface
Chips &
Logic Gates
abstract interface
Human
Thought
Abstract design
Chapters 9, 12
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 17
Machine language semantics (our very own Hack platform)
Code syntax
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 0 0 1 0 0 01 1 1 0 1 1 1
Instruction code
(0=“address” inst.)
Address
ALU
operation code
(M-1)
Destination
Code
(M)
Jump
Code
(no jump)
Code semantics, as interpreted by the Hack hardware platform
Instruction code
(1=“compute” inst.)
0000000000000000
1111110111001000
@0
M=M-1
We need a hardware architecture that realizes this semantics
The hardware platform should be designed to:
o Parse instructions, and
o Execute them.
For now,
ignore all
details!
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 18
Computer architecture (Hack platform, approx.)
A typical Von Neumann machine
Data
Memory
(M)
ALU
Instruction
Memory
instruction
A
D
M
Program
Counter
address of next
instruction
data in
data out
RAM(A)
For now,
ignore all
details!
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 19
The big picture
Assembler
Chapter 6
H.L. Language
&
Operating Sys.
abstract interface
Compiler
Chapters 10 - 11
VM Translator
Chapters 7 - 8
Computer
Architecture
Chapters 4 - 5
Gate Logic
Chapters 1 - 3 Electrical
Engineering
Physics
Virtual
Machine
abstract interface
Software
hierarchy
Assembly
Language
abstract interface
Hardware
hierarchy
Machine
Language
abstract interface
Hardware
Platform
abstract interface
Chips &
Logic Gates
abstract interface
Human
Thought
Abstract design
Chapters 9, 12
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 20
Logic design
Combinational logic (leading to an ALU)
Sequential logic (leading to a RAM)
Putting the whole thing together (leading to a Computer)
Using … gate logic.
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 21
Gate logic
Xor
a
b
out
0 0 0
0 1 1
1 0 1
1 1 0
a b out
Interface
And
And
Not
Or out
a
b
Not
Implementation
Hardware platform = inter-connected set of chips
Chips are made of simpler chips, all the way down to elemantary logic gates
Logic gate = hardware element that implements a certain Boolean function
Every chip and gate has an interface, specifying WHAT it is doing, and an
implementation, specifying HOW it is doing it.
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 22
Hardware Description Language (HDL)
And
And
Not
Or out
a
b
Not
CHIP Xor {
IN a,b;
OUT out;
PARTS:
Not(in=a,out=Nota);
Not(in=b,out=Notb);
And(a=a,b=Notb,out=w1);
And(a=Nota,b=b,out=w2);
Or(a=w1,b=w2,out=out);
}
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 23
The tour ends:
0 0 1
0 1 1
1 0 1
1 1 0
a b out
out
a
b
Nand
Interface One implementation option (CMOS)
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 24
The tour map, revisited
Assembler
Chapter 6
H.L. Language
&
Operating Sys.
abstract interface
Compiler
Chapters 10 - 11
VM Translator
Chapters 7 - 8
Computer
Architecture
Chapters 4 - 5
Gate Logic
Chapters 1 - 3 Electrical
Engineering
Physics
Virtual
Machine
abstract interface
Software
hierarchy
Assembly
Language
abstract interface
Hardware
hierarchy
Machine
Language
abstract interface
Hardware
Platform
abstract interface
Chips &
Logic Gates
abstract interface
Human
Thought
Abstract design
Chapters 9, 12
Course overview:
Building this world,
from the ground up

Contenu connexe

Tendances

Lecture 09 high level language
Lecture 09 high level languageLecture 09 high level language
Lecture 09 high level language鍾誠 陳鍾誠
 
nand2tetris 舊版投影片 -- 第三章 循序邏輯
nand2tetris 舊版投影片 -- 第三章 循序邏輯nand2tetris 舊版投影片 -- 第三章 循序邏輯
nand2tetris 舊版投影片 -- 第三章 循序邏輯鍾誠 陳鍾誠
 
Lecture 08 virtual machine ii
Lecture 08 virtual machine iiLecture 08 virtual machine ii
Lecture 08 virtual machine ii鍾誠 陳鍾誠
 
nand2tetris 舊版投影片 -- 第四章 機器語言
nand2tetris 舊版投影片 -- 第四章 機器語言nand2tetris 舊版投影片 -- 第四章 機器語言
nand2tetris 舊版投影片 -- 第四章 機器語言鍾誠 陳鍾誠
 
Lecture 07 virtual machine i
Lecture 07 virtual machine iLecture 07 virtual machine i
Lecture 07 virtual machine i鍾誠 陳鍾誠
 
Mutual Exclusion
Mutual ExclusionMutual Exclusion
Mutual ExclusionDavid Evans
 
Redo midterm
Redo midtermRedo midterm
Redo midtermIIUM
 
GUESS FUNDAMENTAL PAPER FOE CCAT Feb 2014
GUESS FUNDAMENTAL PAPER FOE CCAT Feb 2014GUESS FUNDAMENTAL PAPER FOE CCAT Feb 2014
GUESS FUNDAMENTAL PAPER FOE CCAT Feb 2014prabhatjon
 
Cryptographic algorithms
Cryptographic algorithmsCryptographic algorithms
Cryptographic algorithmsAnamika Singh
 
Tic Tac Toe using Mini Max Algorithm
Tic Tac Toe using Mini Max AlgorithmTic Tac Toe using Mini Max Algorithm
Tic Tac Toe using Mini Max AlgorithmUjjawal Poudel
 
FLASHBRAIN report
FLASHBRAIN reportFLASHBRAIN report
FLASHBRAIN reportDaniel Han
 
Chapter 03 arithmetic for computers
Chapter 03   arithmetic for computersChapter 03   arithmetic for computers
Chapter 03 arithmetic for computersBảo Hoang
 

Tendances (20)

Lecture 09 high level language
Lecture 09 high level languageLecture 09 high level language
Lecture 09 high level language
 
Lecture 10 compiler i
Lecture 10 compiler iLecture 10 compiler i
Lecture 10 compiler i
 
nand2tetris 舊版投影片 -- 第三章 循序邏輯
nand2tetris 舊版投影片 -- 第三章 循序邏輯nand2tetris 舊版投影片 -- 第三章 循序邏輯
nand2tetris 舊版投影片 -- 第三章 循序邏輯
 
Lecture 08 virtual machine ii
Lecture 08 virtual machine iiLecture 08 virtual machine ii
Lecture 08 virtual machine ii
 
nand2tetris 舊版投影片 -- 第四章 機器語言
nand2tetris 舊版投影片 -- 第四章 機器語言nand2tetris 舊版投影片 -- 第四章 機器語言
nand2tetris 舊版投影片 -- 第四章 機器語言
 
Lecture 07 virtual machine i
Lecture 07 virtual machine iLecture 07 virtual machine i
Lecture 07 virtual machine i
 
Lecture 06 assembler
Lecture 06 assemblerLecture 06 assembler
Lecture 06 assembler
 
Machine language
Machine languageMachine language
Machine language
 
Mutual Exclusion
Mutual ExclusionMutual Exclusion
Mutual Exclusion
 
Matlab workshop
Matlab workshopMatlab workshop
Matlab workshop
 
Redo midterm
Redo midtermRedo midterm
Redo midterm
 
Vb.net ii
Vb.net iiVb.net ii
Vb.net ii
 
GUESS FUNDAMENTAL PAPER FOE CCAT Feb 2014
GUESS FUNDAMENTAL PAPER FOE CCAT Feb 2014GUESS FUNDAMENTAL PAPER FOE CCAT Feb 2014
GUESS FUNDAMENTAL PAPER FOE CCAT Feb 2014
 
Cryptographic algorithms
Cryptographic algorithmsCryptographic algorithms
Cryptographic algorithms
 
Chapter#4
Chapter#4Chapter#4
Chapter#4
 
Python for Beginners(v2)
Python for Beginners(v2)Python for Beginners(v2)
Python for Beginners(v2)
 
Tic Tac Toe using Mini Max Algorithm
Tic Tac Toe using Mini Max AlgorithmTic Tac Toe using Mini Max Algorithm
Tic Tac Toe using Mini Max Algorithm
 
Core java
Core javaCore java
Core java
 
FLASHBRAIN report
FLASHBRAIN reportFLASHBRAIN report
FLASHBRAIN report
 
Chapter 03 arithmetic for computers
Chapter 03   arithmetic for computersChapter 03   arithmetic for computers
Chapter 03 arithmetic for computers
 

Similaire à Introduction

Gdc09 Minigames
Gdc09 MinigamesGdc09 Minigames
Gdc09 MinigamesSusan Gold
 
Advance Computer Architecture
Advance Computer ArchitectureAdvance Computer Architecture
Advance Computer ArchitectureVrushali Lanjewar
 
My summary for cs001x computer science for beginners
My summary for cs001x computer science for beginnersMy summary for cs001x computer science for beginners
My summary for cs001x computer science for beginnersIbrahim Omar
 
Vagrant boxes with x, export display, chrome headless
Vagrant boxes with x, export display, chrome headlessVagrant boxes with x, export display, chrome headless
Vagrant boxes with x, export display, chrome headlessFederico Panini
 
ma project
ma projectma project
ma projectAisu
 
Design the implementation of Robotic Simulator: Goalkeeper.
Design the implementation of Robotic Simulator: Goalkeeper.Design the implementation of Robotic Simulator: Goalkeeper.
Design the implementation of Robotic Simulator: Goalkeeper.Ankita Tiwari
 
01 first
01 first01 first
01 firstscythus
 
First fare 2010 lab-view creating custom dashboards
First fare 2010 lab-view creating custom dashboardsFirst fare 2010 lab-view creating custom dashboards
First fare 2010 lab-view creating custom dashboardsOregon FIRST Robotics
 
Hacking the Kinect with GAFFTA Day 1
Hacking the Kinect with GAFFTA Day 1Hacking the Kinect with GAFFTA Day 1
Hacking the Kinect with GAFFTA Day 1benDesigning
 
Lab: Installation of Xilkernel on Xilinx Spartan 3E Starter board
Lab: Installation of Xilkernel on Xilinx Spartan 3E Starter boardLab: Installation of Xilkernel on Xilinx Spartan 3E Starter board
Lab: Installation of Xilkernel on Xilinx Spartan 3E Starter boardVincent Claes
 
Designing A Project Using Java Programming
Designing A Project Using Java ProgrammingDesigning A Project Using Java Programming
Designing A Project Using Java ProgrammingKaty Allen
 
Mini Max Algorithm Proposal Document
Mini Max Algorithm Proposal DocumentMini Max Algorithm Proposal Document
Mini Max Algorithm Proposal DocumentUjjawal Poudel
 
arduino
arduinoarduino
arduinomurbz
 
React Native custom components
React Native custom componentsReact Native custom components
React Native custom componentsJeremy Grancher
 
School For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine BasicsSchool For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine BasicsNick Pruehs
 
4th ARM Developer Day Presenters info
4th ARM Developer Day Presenters info4th ARM Developer Day Presenters info
4th ARM Developer Day Presenters infoAntonio Mondragon
 
Data analysis in R
Data analysis in RData analysis in R
Data analysis in RAndrew Lowe
 
Scratch for intermediates course
Scratch for intermediates courseScratch for intermediates course
Scratch for intermediates courseMatthew Parry
 

Similaire à Introduction (20)

Gdc09 Minigames
Gdc09 MinigamesGdc09 Minigames
Gdc09 Minigames
 
Advance Computer Architecture
Advance Computer ArchitectureAdvance Computer Architecture
Advance Computer Architecture
 
My summary for cs001x computer science for beginners
My summary for cs001x computer science for beginnersMy summary for cs001x computer science for beginners
My summary for cs001x computer science for beginners
 
Vagrant boxes with x, export display, chrome headless
Vagrant boxes with x, export display, chrome headlessVagrant boxes with x, export display, chrome headless
Vagrant boxes with x, export display, chrome headless
 
ma project
ma projectma project
ma project
 
Design the implementation of Robotic Simulator: Goalkeeper.
Design the implementation of Robotic Simulator: Goalkeeper.Design the implementation of Robotic Simulator: Goalkeeper.
Design the implementation of Robotic Simulator: Goalkeeper.
 
01 first
01 first01 first
01 first
 
First fare 2010 lab-view creating custom dashboards
First fare 2010 lab-view creating custom dashboardsFirst fare 2010 lab-view creating custom dashboards
First fare 2010 lab-view creating custom dashboards
 
cv-guegant-jean
cv-guegant-jeancv-guegant-jean
cv-guegant-jean
 
Hacking the Kinect with GAFFTA Day 1
Hacking the Kinect with GAFFTA Day 1Hacking the Kinect with GAFFTA Day 1
Hacking the Kinect with GAFFTA Day 1
 
Lab: Installation of Xilkernel on Xilinx Spartan 3E Starter board
Lab: Installation of Xilkernel on Xilinx Spartan 3E Starter boardLab: Installation of Xilkernel on Xilinx Spartan 3E Starter board
Lab: Installation of Xilkernel on Xilinx Spartan 3E Starter board
 
Designing A Project Using Java Programming
Designing A Project Using Java ProgrammingDesigning A Project Using Java Programming
Designing A Project Using Java Programming
 
Mini Max Algorithm Proposal Document
Mini Max Algorithm Proposal DocumentMini Max Algorithm Proposal Document
Mini Max Algorithm Proposal Document
 
arduino
arduinoarduino
arduino
 
Tutorial flash
Tutorial flashTutorial flash
Tutorial flash
 
React Native custom components
React Native custom componentsReact Native custom components
React Native custom components
 
School For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine BasicsSchool For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine Basics
 
4th ARM Developer Day Presenters info
4th ARM Developer Day Presenters info4th ARM Developer Day Presenters info
4th ARM Developer Day Presenters info
 
Data analysis in R
Data analysis in RData analysis in R
Data analysis in R
 
Scratch for intermediates course
Scratch for intermediates courseScratch for intermediates course
Scratch for intermediates course
 

Plus de 鍾誠 陳鍾誠

用十分鐘瞭解 新竹科學園區的發展史
用十分鐘瞭解  新竹科學園區的發展史用十分鐘瞭解  新竹科學園區的發展史
用十分鐘瞭解 新竹科學園區的發展史鍾誠 陳鍾誠
 
用十分鐘搞懂 λ-Calculus
用十分鐘搞懂 λ-Calculus用十分鐘搞懂 λ-Calculus
用十分鐘搞懂 λ-Calculus鍾誠 陳鍾誠
 
交⼤資訊⼯程學系備審資料 ⾱詠祥
交⼤資訊⼯程學系備審資料 ⾱詠祥交⼤資訊⼯程學系備審資料 ⾱詠祥
交⼤資訊⼯程學系備審資料 ⾱詠祥鍾誠 陳鍾誠
 
smallpt: Global Illumination in 99 lines of C++
smallpt:  Global Illumination in 99 lines of C++smallpt:  Global Illumination in 99 lines of C++
smallpt: Global Illumination in 99 lines of C++鍾誠 陳鍾誠
 
西洋史 (你或許不知道但卻影響現代教育的那些事)
西洋史  (你或許不知道但卻影響現代教育的那些事)西洋史  (你或許不知道但卻影響現代教育的那些事)
西洋史 (你或許不知道但卻影響現代教育的那些事)鍾誠 陳鍾誠
 
區塊鏈 (比特幣背後的關鍵技術) -- 十分鐘系列
區塊鏈  (比特幣背後的關鍵技術)   -- 十分鐘系列區塊鏈  (比特幣背後的關鍵技術)   -- 十分鐘系列
區塊鏈 (比特幣背後的關鍵技術) -- 十分鐘系列鍾誠 陳鍾誠
 
區塊鏈 (比特幣背後的關鍵技術) -- 十分鐘系列
區塊鏈  (比特幣背後的關鍵技術)   -- 十分鐘系列區塊鏈  (比特幣背後的關鍵技術)   -- 十分鐘系列
區塊鏈 (比特幣背後的關鍵技術) -- 十分鐘系列鍾誠 陳鍾誠
 
梯度下降法 (隱藏在深度學習背後的演算法) -- 十分鐘系列
梯度下降法  (隱藏在深度學習背後的演算法) -- 十分鐘系列梯度下降法  (隱藏在深度學習背後的演算法) -- 十分鐘系列
梯度下降法 (隱藏在深度學習背後的演算法) -- 十分鐘系列鍾誠 陳鍾誠
 
用十分鐘理解 《微分方程》
用十分鐘理解  《微分方程》用十分鐘理解  《微分方程》
用十分鐘理解 《微分方程》鍾誠 陳鍾誠
 
系統程式 -- 第 12 章 系統軟體實作
系統程式 -- 第 12 章 系統軟體實作系統程式 -- 第 12 章 系統軟體實作
系統程式 -- 第 12 章 系統軟體實作鍾誠 陳鍾誠
 
系統程式 -- 第 11 章 嵌入式系統
系統程式 -- 第 11 章 嵌入式系統系統程式 -- 第 11 章 嵌入式系統
系統程式 -- 第 11 章 嵌入式系統鍾誠 陳鍾誠
 
系統程式 -- 第 10 章 作業系統
系統程式 -- 第 10 章 作業系統系統程式 -- 第 10 章 作業系統
系統程式 -- 第 10 章 作業系統鍾誠 陳鍾誠
 
系統程式 -- 第 9 章 虛擬機器
系統程式 -- 第 9 章 虛擬機器系統程式 -- 第 9 章 虛擬機器
系統程式 -- 第 9 章 虛擬機器鍾誠 陳鍾誠
 
系統程式 -- 第 8 章 編譯器
系統程式 -- 第 8 章 編譯器系統程式 -- 第 8 章 編譯器
系統程式 -- 第 8 章 編譯器鍾誠 陳鍾誠
 
系統程式 -- 第 7 章 高階語言
系統程式 -- 第 7 章 高階語言系統程式 -- 第 7 章 高階語言
系統程式 -- 第 7 章 高階語言鍾誠 陳鍾誠
 
系統程式 -- 第 6 章 巨集處理器
系統程式 -- 第 6 章 巨集處理器系統程式 -- 第 6 章 巨集處理器
系統程式 -- 第 6 章 巨集處理器鍾誠 陳鍾誠
 
系統程式 -- 第 5 章 連結與載入
系統程式 -- 第 5 章 連結與載入系統程式 -- 第 5 章 連結與載入
系統程式 -- 第 5 章 連結與載入鍾誠 陳鍾誠
 
系統程式 -- 第 4 章 組譯器
系統程式 -- 第 4 章 組譯器系統程式 -- 第 4 章 組譯器
系統程式 -- 第 4 章 組譯器鍾誠 陳鍾誠
 

Plus de 鍾誠 陳鍾誠 (20)

用十分鐘瞭解 新竹科學園區的發展史
用十分鐘瞭解  新竹科學園區的發展史用十分鐘瞭解  新竹科學園區的發展史
用十分鐘瞭解 新竹科學園區的發展史
 
用十分鐘搞懂 λ-Calculus
用十分鐘搞懂 λ-Calculus用十分鐘搞懂 λ-Calculus
用十分鐘搞懂 λ-Calculus
 
交⼤資訊⼯程學系備審資料 ⾱詠祥
交⼤資訊⼯程學系備審資料 ⾱詠祥交⼤資訊⼯程學系備審資料 ⾱詠祥
交⼤資訊⼯程學系備審資料 ⾱詠祥
 
smallpt: Global Illumination in 99 lines of C++
smallpt:  Global Illumination in 99 lines of C++smallpt:  Global Illumination in 99 lines of C++
smallpt: Global Illumination in 99 lines of C++
 
西洋史 (你或許不知道但卻影響現代教育的那些事)
西洋史  (你或許不知道但卻影響現代教育的那些事)西洋史  (你或許不知道但卻影響現代教育的那些事)
西洋史 (你或許不知道但卻影響現代教育的那些事)
 
區塊鏈 (比特幣背後的關鍵技術) -- 十分鐘系列
區塊鏈  (比特幣背後的關鍵技術)   -- 十分鐘系列區塊鏈  (比特幣背後的關鍵技術)   -- 十分鐘系列
區塊鏈 (比特幣背後的關鍵技術) -- 十分鐘系列
 
區塊鏈 (比特幣背後的關鍵技術) -- 十分鐘系列
區塊鏈  (比特幣背後的關鍵技術)   -- 十分鐘系列區塊鏈  (比特幣背後的關鍵技術)   -- 十分鐘系列
區塊鏈 (比特幣背後的關鍵技術) -- 十分鐘系列
 
梯度下降法 (隱藏在深度學習背後的演算法) -- 十分鐘系列
梯度下降法  (隱藏在深度學習背後的演算法) -- 十分鐘系列梯度下降法  (隱藏在深度學習背後的演算法) -- 十分鐘系列
梯度下降法 (隱藏在深度學習背後的演算法) -- 十分鐘系列
 
用十分鐘理解 《微分方程》
用十分鐘理解  《微分方程》用十分鐘理解  《微分方程》
用十分鐘理解 《微分方程》
 
系統程式 -- 前言
系統程式 -- 前言系統程式 -- 前言
系統程式 -- 前言
 
系統程式 -- 附錄
系統程式 -- 附錄系統程式 -- 附錄
系統程式 -- 附錄
 
系統程式 -- 第 12 章 系統軟體實作
系統程式 -- 第 12 章 系統軟體實作系統程式 -- 第 12 章 系統軟體實作
系統程式 -- 第 12 章 系統軟體實作
 
系統程式 -- 第 11 章 嵌入式系統
系統程式 -- 第 11 章 嵌入式系統系統程式 -- 第 11 章 嵌入式系統
系統程式 -- 第 11 章 嵌入式系統
 
系統程式 -- 第 10 章 作業系統
系統程式 -- 第 10 章 作業系統系統程式 -- 第 10 章 作業系統
系統程式 -- 第 10 章 作業系統
 
系統程式 -- 第 9 章 虛擬機器
系統程式 -- 第 9 章 虛擬機器系統程式 -- 第 9 章 虛擬機器
系統程式 -- 第 9 章 虛擬機器
 
系統程式 -- 第 8 章 編譯器
系統程式 -- 第 8 章 編譯器系統程式 -- 第 8 章 編譯器
系統程式 -- 第 8 章 編譯器
 
系統程式 -- 第 7 章 高階語言
系統程式 -- 第 7 章 高階語言系統程式 -- 第 7 章 高階語言
系統程式 -- 第 7 章 高階語言
 
系統程式 -- 第 6 章 巨集處理器
系統程式 -- 第 6 章 巨集處理器系統程式 -- 第 6 章 巨集處理器
系統程式 -- 第 6 章 巨集處理器
 
系統程式 -- 第 5 章 連結與載入
系統程式 -- 第 5 章 連結與載入系統程式 -- 第 5 章 連結與載入
系統程式 -- 第 5 章 連結與載入
 
系統程式 -- 第 4 章 組譯器
系統程式 -- 第 4 章 組譯器系統程式 -- 第 4 章 組譯器
系統程式 -- 第 4 章 組譯器
 

Dernier

Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIShubhangi Sonawane
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesShubhangi Sonawane
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 

Dernier (20)

Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 

Introduction

  • 1. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 1 www.nand2tetris.org Building a Modern Computer From First Principles Introduction: From Nand to Tetris
  • 2. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 2 Usage and Copyright Notice: Copyright © Noam Nisan and Shimon Schocken This presentation accompanies the textbook “The Elements of Computing Systems” by Noam Nisan & Shimon Schocken, MIT Press, 2005. We provide 13 such presentations. Each presentation is designed to support about 3 hours of classroom or self-study instruction. You are welcome to use or edit this presentation as you see fit for instructional and non- commercial purposes. If you use our book and course materials, please include a reference to www.nand2tetris.org If you have any questions or comments, please write us at nand2tetris@gmail.com This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
  • 3. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 3 Course theme and structure Assembler Chapter 6 H.L. Language & Operating Sys. abstract interface Compiler Chapters 10 - 11 VM Translator Chapters 7 - 8 Computer Architecture Chapters 4 - 5 Gate Logic Chapters 1 - 3 Electrical Engineering Physics Virtual Machine abstract interface Software hierarchy Assembly Language abstract interface Hardware hierarchy Machine Language abstract interface Hardware Platform abstract interface Chips & Logic Gates abstract interface Human Thought Abstract design Chapters 9, 12 (Abstraction–implementation paradigm)
  • 4. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 4 Application level: Pong (example app) Ball abstraction Bat abstraction
  • 5. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 5 The big picture Assembler Chapter 6 H.L. Language & Operating Sys. abstract interface Compiler Chapters 10 - 11 VM Translator Chapters 7 - 8 Computer Architecture Chapters 4 - 5 Gate Logic Chapters 1 - 3 Electrical Engineering Physics Virtual Machine abstract interface Software hierarchy Assembly Language abstract interface Hardware hierarchy Machine Language abstract interface Hardware Platform abstract interface Chips & Logic Gates abstract interface Human Thought Abstract design Chapters 9, 12
  • 6. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 6 High-level programming (our very own Jack language) /** A Graphic Bat for a Pong Game */ class Bat { field int x, y; // screen location of the bat's top-left corner field int width, height; // bat's width & height // The class constructor and most of the class methods are omitted /** Draws (color=true) or erases (color=false) the bat */ method void draw(boolean color) { do Screen.setColor(color); do Screen.drawRectangle(x,y,x+width,y+height); return; } /** Moves the bat one step (4 pixels) to the right. */ method void moveR() { do draw(false); // erase the bat at the current location let x = x + 4; // change the bat's X-location // but don't go beyond the screen's right border if ((x + width) > 511) { let x = 511 - width; } do draw(true); // re-draw the bat in the new location return; } } Ball abstraction Bat abstraction Typical call to an OS method
  • 7. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 7 Operating system level (our very own Jack OS) /** An OS-level screen driver that abstracts the computer's physical screen */ class Screen { static boolean currentColor; // the current color // The Screen class is a collection of methods, each implementing one // abstract screen-oriented operation. Most of this code is omitted. /** Draws a rectangle in the current color. */ // the rectangle's top left corner is anchored at screen location (x0,y0) // and its width and length are x1 and y1, respectively. function void drawRectangle(int x0, int y0, int x1, int y1) { var int x, y; let x = x0; while (x < x1) { let y = y0; while(y < y1) { do Screen.drawPixel(x,y); let y = y+1; } let x = x+1; } } } Ball abstraction Bat abstraction
  • 8. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 8 The big picture Assembler Chapter 6 H.L. Language & Operating Sys. abstract interface Compiler Chapters 10 - 11 VM Translator Chapters 7 - 8 Computer Architecture Chapters 4 - 5 Gate Logic Chapters 1 - 3 Electrical Engineering Physics Virtual Machine abstract interface Software hierarchy Assembly Language abstract interface Hardware hierarchy Machine Language abstract interface Hardware Platform abstract interface Chips & Logic Gates abstract interface Human Thought Abstract design Chapters 9, 12
  • 9. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 9 A modern compilation model . . . RISC machine VM language other digital platforms, each equipped with its VM implementation RISC machine language Hack computer Hack machine language CISC machine language CISC machine . . . Projects 10-11 written in a high-level language Any computer . . . VM implementation over CISC platforms VM imp. over RISC platforms VM imp. over the Hack platform VM emulator Some Other language Jack language Some compiler Some Other compiler Jack compiler . . . Projects 7-8 Some language . . . Projects 1-6 Proj. 9: building an app. Proj. 12: building the OS
  • 10. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 10 Compilation 101 Observations: Modularity Abstraction / implementation interplay The implementation uses abstract services from the level below. parsing Code generation Source code (x + width) > 511 Abstraction push x push width add push 511 gt Intermediate code ImplementationSyntax Analysis widthx + 511 > Parse Tree Semantic Synthesis
  • 11. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 11 The Virtual Machine (our very own VM, modeled after Java’s JVM) // VM implementation push x // s1 push width // s2 add // s3 push 511 // s4 gt // s5 if-goto L1 // s6 goto L2 // s7 L1: push 511 // s8 push width // s9 sub // s10 pop x // s11 L2: ... if ((x+width)>511) { let x=511-width; } 75 450 sp s2memory (before) 450 ... x width 75 ... ... 525 511 sp 1 sp 511 450 sp s4 s5 s9 61 sp s10 450 ... x width 61 ... ... memory (after)
  • 12. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 12 The big picture Assembler Chapter 6 H.L. Language & Operating Sys. abstract interface Compiler Chapters 10 - 11 VM Translator Chapters 7 - 8 Computer Architecture Chapters 4 - 5 Gate Logic Chapters 1 - 3 Electrical Engineering Physics Virtual Machine abstract interface Software hierarchy Assembly Language abstract interface Hardware hierarchy Machine Language abstract interface Hardware Platform abstract interface Chips & Logic Gates abstract interface Human Thought Abstract design Chapters 9, 12
  • 13. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 13 Low-level programming (on the Hack computer) ... push x push width add push 511 gt if-goto L1 goto L2 L1: push 511 push width sub pop x L2: ... Virtual machine program For now, ignore all details!
  • 14. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 14 ... push x push width add push 511 gt if-goto L1 goto L2 L1: push 511 push width sub pop x L2: ... // push 511 @511 D=A // D=511 @SP A=M M=D // *SP=D @SP M=M+1 // SP++ Virtual machine program Assembly programVM translator push 511 Low-level programming (on the Hack computer) For now, ignore all details!
  • 15. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 15 ... push x push width add push 511 gt if-goto L1 goto L2 L1: push 511 push width sub pop x L2: ... // push 511 @511 D=A // D=511 @SP A=M M=D // *SP=D @SP M=M+1 // SP++ Virtual machine program Assembly program 0000000000000000 1110110010001000 Executable VM translator Assembler push 511 @SP M=M+1 // SP++ Low-level programming (on the Hack computer) For now, ignore all details!
  • 16. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 16 The big picture Assembler Chapter 6 H.L. Language & Operating Sys. abstract interface Compiler Chapters 10 - 11 VM Translator Chapters 7 - 8 Computer Architecture Chapters 4 - 5 Gate Logic Chapters 1 - 3 Electrical Engineering Physics Virtual Machine abstract interface Software hierarchy Assembly Language abstract interface Hardware hierarchy Machine Language abstract interface Hardware Platform abstract interface Chips & Logic Gates abstract interface Human Thought Abstract design Chapters 9, 12
  • 17. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 17 Machine language semantics (our very own Hack platform) Code syntax 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 01 1 1 0 1 1 1 Instruction code (0=“address” inst.) Address ALU operation code (M-1) Destination Code (M) Jump Code (no jump) Code semantics, as interpreted by the Hack hardware platform Instruction code (1=“compute” inst.) 0000000000000000 1111110111001000 @0 M=M-1 We need a hardware architecture that realizes this semantics The hardware platform should be designed to: o Parse instructions, and o Execute them. For now, ignore all details!
  • 18. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 18 Computer architecture (Hack platform, approx.) A typical Von Neumann machine Data Memory (M) ALU Instruction Memory instruction A D M Program Counter address of next instruction data in data out RAM(A) For now, ignore all details!
  • 19. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 19 The big picture Assembler Chapter 6 H.L. Language & Operating Sys. abstract interface Compiler Chapters 10 - 11 VM Translator Chapters 7 - 8 Computer Architecture Chapters 4 - 5 Gate Logic Chapters 1 - 3 Electrical Engineering Physics Virtual Machine abstract interface Software hierarchy Assembly Language abstract interface Hardware hierarchy Machine Language abstract interface Hardware Platform abstract interface Chips & Logic Gates abstract interface Human Thought Abstract design Chapters 9, 12
  • 20. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 20 Logic design Combinational logic (leading to an ALU) Sequential logic (leading to a RAM) Putting the whole thing together (leading to a Computer) Using … gate logic.
  • 21. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 21 Gate logic Xor a b out 0 0 0 0 1 1 1 0 1 1 1 0 a b out Interface And And Not Or out a b Not Implementation Hardware platform = inter-connected set of chips Chips are made of simpler chips, all the way down to elemantary logic gates Logic gate = hardware element that implements a certain Boolean function Every chip and gate has an interface, specifying WHAT it is doing, and an implementation, specifying HOW it is doing it.
  • 22. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 22 Hardware Description Language (HDL) And And Not Or out a b Not CHIP Xor { IN a,b; OUT out; PARTS: Not(in=a,out=Nota); Not(in=b,out=Notb); And(a=a,b=Notb,out=w1); And(a=Nota,b=b,out=w2); Or(a=w1,b=w2,out=out); }
  • 23. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 23 The tour ends: 0 0 1 0 1 1 1 0 1 1 1 0 a b out out a b Nand Interface One implementation option (CMOS)
  • 24. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Introduction slide 24 The tour map, revisited Assembler Chapter 6 H.L. Language & Operating Sys. abstract interface Compiler Chapters 10 - 11 VM Translator Chapters 7 - 8 Computer Architecture Chapters 4 - 5 Gate Logic Chapters 1 - 3 Electrical Engineering Physics Virtual Machine abstract interface Software hierarchy Assembly Language abstract interface Hardware hierarchy Machine Language abstract interface Hardware Platform abstract interface Chips & Logic Gates abstract interface Human Thought Abstract design Chapters 9, 12 Course overview: Building this world, from the ground up