SlideShare une entreprise Scribd logo
1  sur  16
Télécharger pour lire hors ligne
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 1
www.nand2tetris.org
Building a Modern Computer From First Principles
Sequential Logic
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic 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 , Chapter 3: Sequential Logic slide 3
Sequential VS combinational logic
Combinational devices: operate on data only;
provide calculation services (e.g. Nand … ALU)
Sequential devices: operate on data and a clock signal;
as such, can be made to be state-aware and provide storage and
synchronization services
Sequential devices are sometimes called “clocked devices”
The low-level behavior of clocked / sequential gates is tricky
The good news:
All sequential chips can be based on one low-level sequential gate,
called “data flip flop”, or DFF
The DFF can be constructed from Nand gates…
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 4
Nand Implementation of DFF
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 5
The Clock
clock
signal
cycle cycle cycle cycle
tick
tock
tick
tock
tick
tock
tick
tock
In our jargon, a clock cycle = tick-phase (low), followed by a
tock-phase (high)
In real hardware, the clock is implemented by an oscillator
In our hardware simulator, clock cycles can be simulated either
Manually, by the user, or
“Automatically,” by a test script.
HW
simulator
demo
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 6
Flip-flop
A fundamental state-keeping device
Memory devices are made from numerous flip-flops,
all regulated by the same master clock signal
Notational convention:
sequential
chip outin sequential
chip outin
clock
signal
=
(notation)
HW
simulator
demo
DFF outin
out(t) = in(t-1)
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 7
1-bit register (we call it “Bit”)
DFF
out(t) = in(t-1)
Basic building block
in out
Objective: build a storage unit that can:
(a) Change its state to a given input
(b) Maintain its state over time (until changed)
DFF
out(t) = out(t-1) ?
out(t) = in(t-1) ?
Won’t work
in out
Bit out
load
in
if load(t-1) then out(t)=in(t-1)
else out(t)=out(t-1)
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 8
Bit register (cont.)
Bit out
load
in
if load(t-1) then out(t)=in(t-1)
else out(t)=out(t-1)
Interface
DFF
MUX
load
in
out
Implementation
HW
simulator
demo
o Load bit
o Read logic
o Write logic
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 9
Multi-bit register
Bit out
load
in
if load(t-1) then out(t)=in(t-1)
else out(t)=out(t-1)
1-bit register
o Register’s width: a trivial parameter
o Read logic
o Write logic
. . .Bit
w-bit register
out
load
in
w w
if load(t-1) then out(t)=in(t-1)
else out(t)=out(t-1)
Bit Bit
HW
simulator
demo
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 10
Random Access Memory (RAM)
o Read logic
o Write logic.
load
(0 to n-1)
Direct Access Logic
register 0
register 1
register n-1
RAM n
...
register 2
in out
(word) (word)
address
HW
simulator
demo
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 11
RAM interface
address
load
out
in
16 bits
log 2
n
bits
RAMn
16 bits
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 12
Bit Bit
Register
.. .Bit
RAM anatomy
register
RAM 8
8
register
...
register
RAM8
RAM 64
8
...
RAM8
. . .
Recursive ascent
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 13
Counter
Typical function: program counter
Implementation: register chip + some combinational logic.
PC (counter)
w bits
outin
w bits
inc load reset
If reset(t-1) then out(t)=0
else if load(t-1) then out(t)=in(t-1)
else if inc(t-1) then out(t)=out(t-1)+1
else out(t)=out(t-1)
Needed: a storage device that can:
(a) set its state to some base value
(b) increment the state in every clock cycle
(c) maintain its state (stop incrementing) over clock cycles
(d) reset its state
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 14
Recap: Sequential VS combinational logic
out = some function of (in)
Combinational chip
comb.
logic
in out
out(t) = some function of (in(t-1), out(t-1))
Sequential chip
comb.
logic
in out
DFF
gate(s)
comb.
logic
(optional) (optional)time delay
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 15
Time matters
Implications:
Challenge: propagation delays
Solution: clock synchronization
Cycle length and processing speed.
+
Reg2
a Reg1
b
out
sel
clock
signal
cycle cycle cycle cycle
tick
tock
tick
tock
tick
tock
tick
tock
During a tick-tock cycle, the internal states of all the clocked chips are allowed
to change, but their outputs are “latched”
At the beginning of the next cycle, the outputs of all the clocked chips in the
architecture commit to the new values.
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 16
Perspective
All the memory units described in this lecture are standard
Typical memory hierarchy
Registers
SRAM (“static”), typically used for the cache
DRAM (“dynamic”), typically used for main memory
Disk
(Elaborate caching / paging algorithms)
But ... real memory units are highly optimized, using a great variety of storage
technologies.
Access
time,
Amount Cost

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鍾誠 陳鍾誠
 
Lecture 07 virtual machine i
Lecture 07 virtual machine iLecture 07 virtual machine i
Lecture 07 virtual machine i鍾誠 陳鍾誠
 
nand2tetris 舊版投影片 -- 第四章 機器語言
nand2tetris 舊版投影片 -- 第四章 機器語言nand2tetris 舊版投影片 -- 第四章 機器語言
nand2tetris 舊版投影片 -- 第四章 機器語言鍾誠 陳鍾誠
 
Mutual Exclusion
Mutual ExclusionMutual Exclusion
Mutual ExclusionDavid Evans
 
Redo midterm
Redo midtermRedo midterm
Redo midtermIIUM
 
A blast from the past
A blast from the pastA blast from the past
A blast from the pastJerome Eteve
 
Computer organiztion2
Computer organiztion2Computer organiztion2
Computer organiztion2Umang Gupta
 
Sequential and combinational alu
Sequential and combinational alu Sequential and combinational alu
Sequential and combinational alu Piyush Rochwani
 
System design using HDL - Module 3
System design using HDL - Module 3System design using HDL - Module 3
System design using HDL - Module 3Aravinda Koithyar
 
Más sobre el Algoritmo de Peterson
Más sobre el Algoritmo de PetersonMás sobre el Algoritmo de Peterson
Más sobre el Algoritmo de PetersonEgdares Futch H.
 
External Interface to SIMULINK
External Interface to SIMULINKExternal Interface to SIMULINK
External Interface to SIMULINKRobert Edwards
 

Tendances (20)

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
 
Lecture 07 virtual machine i
Lecture 07 virtual machine iLecture 07 virtual machine i
Lecture 07 virtual machine i
 
nand2tetris 舊版投影片 -- 第四章 機器語言
nand2tetris 舊版投影片 -- 第四章 機器語言nand2tetris 舊版投影片 -- 第四章 機器語言
nand2tetris 舊版投影片 -- 第四章 機器語言
 
Lecture 06 assembler
Lecture 06 assemblerLecture 06 assembler
Lecture 06 assembler
 
Lecture 10 compiler i
Lecture 10 compiler iLecture 10 compiler i
Lecture 10 compiler i
 
Machine language
Machine languageMachine language
Machine language
 
Matlab workshop
Matlab workshopMatlab workshop
Matlab workshop
 
Mutual Exclusion
Mutual ExclusionMutual Exclusion
Mutual Exclusion
 
Redo midterm
Redo midtermRedo midterm
Redo midterm
 
A blast from the past
A blast from the pastA blast from the past
A blast from the past
 
Stack & heap
Stack & heap Stack & heap
Stack & heap
 
Computer organiztion2
Computer organiztion2Computer organiztion2
Computer organiztion2
 
Unit 2 module-2
Unit 2 module-2Unit 2 module-2
Unit 2 module-2
 
Sequential and combinational alu
Sequential and combinational alu Sequential and combinational alu
Sequential and combinational alu
 
System design using HDL - Module 3
System design using HDL - Module 3System design using HDL - Module 3
System design using HDL - Module 3
 
Más sobre el Algoritmo de Peterson
Más sobre el Algoritmo de PetersonMás sobre el Algoritmo de Peterson
Más sobre el Algoritmo de Peterson
 
External Interface to SIMULINK
External Interface to SIMULINKExternal Interface to SIMULINK
External Interface to SIMULINK
 
Chapter#4
Chapter#4Chapter#4
Chapter#4
 

Similaire à Sequential logic

lecture 02 Boolean arithmetic.ppt
lecture 02 Boolean arithmetic.pptlecture 02 Boolean arithmetic.ppt
lecture 02 Boolean arithmetic.pptzorogoh2
 
Master Thesis Presentation
Master Thesis PresentationMaster Thesis Presentation
Master Thesis PresentationMohamed Sobh
 
Deep Learning, Scala, and Spark
Deep Learning, Scala, and SparkDeep Learning, Scala, and Spark
Deep Learning, Scala, and SparkOswald Campesato
 
Sampling and Reconstruction (Online Learning).pptx
Sampling and Reconstruction (Online Learning).pptxSampling and Reconstruction (Online Learning).pptx
Sampling and Reconstruction (Online Learning).pptxHamzaJaved306957
 
Computer organiztion1
Computer organiztion1Computer organiztion1
Computer organiztion1Umang Gupta
 
System Monitoring
System MonitoringSystem Monitoring
System Monitoringbutest
 
Embedded system Design introduction _ Karakola
Embedded system Design introduction _ KarakolaEmbedded system Design introduction _ Karakola
Embedded system Design introduction _ KarakolaJohanAspro
 
Foundations and methods of stochastic simulation
Foundations and methods of stochastic simulationFoundations and methods of stochastic simulation
Foundations and methods of stochastic simulationSpringer
 
Benchmarking with JMH (riviera dev 2017)
Benchmarking with JMH (riviera dev 2017)Benchmarking with JMH (riviera dev 2017)
Benchmarking with JMH (riviera dev 2017)Nenad Bogojevic
 
BSides MCR 2016: From CSV to CMD to qwerty
BSides MCR 2016: From CSV to CMD to qwertyBSides MCR 2016: From CSV to CMD to qwerty
BSides MCR 2016: From CSV to CMD to qwertyJerome Smith
 
Hardware Acceleration for Machine Learning
Hardware Acceleration for Machine LearningHardware Acceleration for Machine Learning
Hardware Acceleration for Machine LearningCastLabKAIST
 
Zero to a Billion in 4.86 Years (A Whirlwind History of Operating Systems)
Zero to a Billion in 4.86 Years (A Whirlwind History of Operating Systems)Zero to a Billion in 4.86 Years (A Whirlwind History of Operating Systems)
Zero to a Billion in 4.86 Years (A Whirlwind History of Operating Systems)David Evans
 
(2) logic design lec foe-rd
(2) logic design lec   foe-rd(2) logic design lec   foe-rd
(2) logic design lec foe-rdwhataaa99
 
Ch7 OS
Ch7 OSCh7 OS
Ch7 OSC.U
 
ParallelLogicToEventDrivenFirmware_Doin
ParallelLogicToEventDrivenFirmware_DoinParallelLogicToEventDrivenFirmware_Doin
ParallelLogicToEventDrivenFirmware_DoinJonny Doin
 
A machine consciousness approach to urban traffic signal control
A machine consciousness approach to urban traffic signal controlA machine consciousness approach to urban traffic signal control
A machine consciousness approach to urban traffic signal controlAndré Paraense
 

Similaire à Sequential logic (20)

lecture 02 Boolean arithmetic.ppt
lecture 02 Boolean arithmetic.pptlecture 02 Boolean arithmetic.ppt
lecture 02 Boolean arithmetic.ppt
 
Master Thesis Presentation
Master Thesis PresentationMaster Thesis Presentation
Master Thesis Presentation
 
Deep Learning, Scala, and Spark
Deep Learning, Scala, and SparkDeep Learning, Scala, and Spark
Deep Learning, Scala, and Spark
 
Sampling and Reconstruction (Online Learning).pptx
Sampling and Reconstruction (Online Learning).pptxSampling and Reconstruction (Online Learning).pptx
Sampling and Reconstruction (Online Learning).pptx
 
Computer organiztion1
Computer organiztion1Computer organiztion1
Computer organiztion1
 
System Monitoring
System MonitoringSystem Monitoring
System Monitoring
 
11 Python CBSE Syllabus
11    Python CBSE Syllabus11    Python CBSE Syllabus
11 Python CBSE Syllabus
 
11 syllabus
11    syllabus11    syllabus
11 syllabus
 
Unsupervised learning networks
Unsupervised learning networksUnsupervised learning networks
Unsupervised learning networks
 
V01 i010401
V01 i010401V01 i010401
V01 i010401
 
Embedded system Design introduction _ Karakola
Embedded system Design introduction _ KarakolaEmbedded system Design introduction _ Karakola
Embedded system Design introduction _ Karakola
 
Foundations and methods of stochastic simulation
Foundations and methods of stochastic simulationFoundations and methods of stochastic simulation
Foundations and methods of stochastic simulation
 
Benchmarking with JMH (riviera dev 2017)
Benchmarking with JMH (riviera dev 2017)Benchmarking with JMH (riviera dev 2017)
Benchmarking with JMH (riviera dev 2017)
 
BSides MCR 2016: From CSV to CMD to qwerty
BSides MCR 2016: From CSV to CMD to qwertyBSides MCR 2016: From CSV to CMD to qwerty
BSides MCR 2016: From CSV to CMD to qwerty
 
Hardware Acceleration for Machine Learning
Hardware Acceleration for Machine LearningHardware Acceleration for Machine Learning
Hardware Acceleration for Machine Learning
 
Zero to a Billion in 4.86 Years (A Whirlwind History of Operating Systems)
Zero to a Billion in 4.86 Years (A Whirlwind History of Operating Systems)Zero to a Billion in 4.86 Years (A Whirlwind History of Operating Systems)
Zero to a Billion in 4.86 Years (A Whirlwind History of Operating Systems)
 
(2) logic design lec foe-rd
(2) logic design lec   foe-rd(2) logic design lec   foe-rd
(2) logic design lec foe-rd
 
Ch7 OS
Ch7 OSCh7 OS
Ch7 OS
 
ParallelLogicToEventDrivenFirmware_Doin
ParallelLogicToEventDrivenFirmware_DoinParallelLogicToEventDrivenFirmware_Doin
ParallelLogicToEventDrivenFirmware_Doin
 
A machine consciousness approach to urban traffic signal control
A machine consciousness approach to urban traffic signal controlA machine consciousness approach to urban traffic signal control
A machine consciousness approach to urban traffic signal control
 

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

80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
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
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
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
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxUmeshTimilsina1
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 

Dernier (20)

80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
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
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
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...
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 

Sequential logic

  • 1. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 1 www.nand2tetris.org Building a Modern Computer From First Principles Sequential Logic
  • 2. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic 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 , Chapter 3: Sequential Logic slide 3 Sequential VS combinational logic Combinational devices: operate on data only; provide calculation services (e.g. Nand … ALU) Sequential devices: operate on data and a clock signal; as such, can be made to be state-aware and provide storage and synchronization services Sequential devices are sometimes called “clocked devices” The low-level behavior of clocked / sequential gates is tricky The good news: All sequential chips can be based on one low-level sequential gate, called “data flip flop”, or DFF The DFF can be constructed from Nand gates…
  • 4. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 4 Nand Implementation of DFF
  • 5. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 5 The Clock clock signal cycle cycle cycle cycle tick tock tick tock tick tock tick tock In our jargon, a clock cycle = tick-phase (low), followed by a tock-phase (high) In real hardware, the clock is implemented by an oscillator In our hardware simulator, clock cycles can be simulated either Manually, by the user, or “Automatically,” by a test script. HW simulator demo
  • 6. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 6 Flip-flop A fundamental state-keeping device Memory devices are made from numerous flip-flops, all regulated by the same master clock signal Notational convention: sequential chip outin sequential chip outin clock signal = (notation) HW simulator demo DFF outin out(t) = in(t-1)
  • 7. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 7 1-bit register (we call it “Bit”) DFF out(t) = in(t-1) Basic building block in out Objective: build a storage unit that can: (a) Change its state to a given input (b) Maintain its state over time (until changed) DFF out(t) = out(t-1) ? out(t) = in(t-1) ? Won’t work in out Bit out load in if load(t-1) then out(t)=in(t-1) else out(t)=out(t-1)
  • 8. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 8 Bit register (cont.) Bit out load in if load(t-1) then out(t)=in(t-1) else out(t)=out(t-1) Interface DFF MUX load in out Implementation HW simulator demo o Load bit o Read logic o Write logic
  • 9. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 9 Multi-bit register Bit out load in if load(t-1) then out(t)=in(t-1) else out(t)=out(t-1) 1-bit register o Register’s width: a trivial parameter o Read logic o Write logic . . .Bit w-bit register out load in w w if load(t-1) then out(t)=in(t-1) else out(t)=out(t-1) Bit Bit HW simulator demo
  • 10. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 10 Random Access Memory (RAM) o Read logic o Write logic. load (0 to n-1) Direct Access Logic register 0 register 1 register n-1 RAM n ... register 2 in out (word) (word) address HW simulator demo
  • 11. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 11 RAM interface address load out in 16 bits log 2 n bits RAMn 16 bits
  • 12. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 12 Bit Bit Register .. .Bit RAM anatomy register RAM 8 8 register ... register RAM8 RAM 64 8 ... RAM8 . . . Recursive ascent
  • 13. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 13 Counter Typical function: program counter Implementation: register chip + some combinational logic. PC (counter) w bits outin w bits inc load reset If reset(t-1) then out(t)=0 else if load(t-1) then out(t)=in(t-1) else if inc(t-1) then out(t)=out(t-1)+1 else out(t)=out(t-1) Needed: a storage device that can: (a) set its state to some base value (b) increment the state in every clock cycle (c) maintain its state (stop incrementing) over clock cycles (d) reset its state
  • 14. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 14 Recap: Sequential VS combinational logic out = some function of (in) Combinational chip comb. logic in out out(t) = some function of (in(t-1), out(t-1)) Sequential chip comb. logic in out DFF gate(s) comb. logic (optional) (optional)time delay
  • 15. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 15 Time matters Implications: Challenge: propagation delays Solution: clock synchronization Cycle length and processing speed. + Reg2 a Reg1 b out sel clock signal cycle cycle cycle cycle tick tock tick tock tick tock tick tock During a tick-tock cycle, the internal states of all the clocked chips are allowed to change, but their outputs are “latched” At the beginning of the next cycle, the outputs of all the clocked chips in the architecture commit to the new values.
  • 16. Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 3: Sequential Logic slide 16 Perspective All the memory units described in this lecture are standard Typical memory hierarchy Registers SRAM (“static”), typically used for the cache DRAM (“dynamic”), typically used for main memory Disk (Elaborate caching / paging algorithms) But ... real memory units are highly optimized, using a great variety of storage technologies. Access time, Amount Cost