Lecture 1 Introduction - Suranaree University of...
Transcript of Lecture 1 Introduction - Suranaree University of...
![Page 1: Lecture 1 Introduction - Suranaree University of Technologypersonal.sut.ac.th/paramate/files/digital/lecture09.pdfLecture 9 Introduction to Sequential Circuits: Evolution of Flip-Flops](https://reader034.fdocuments.in/reader034/viewer/2022052009/601f312ef19f7451f135ba88/html5/thumbnails/1.jpg)
Lecture 9 Introduction to Sequential Circuits: Evolution of
Flip-Flops (Review)
Paramate Horkaew
School of Computer Engineering, Institute of EngineeringSuranaree University of Technology
![Page 2: Lecture 1 Introduction - Suranaree University of Technologypersonal.sut.ac.th/paramate/files/digital/lecture09.pdfLecture 9 Introduction to Sequential Circuits: Evolution of Flip-Flops](https://reader034.fdocuments.in/reader034/viewer/2022052009/601f312ef19f7451f135ba88/html5/thumbnails/2.jpg)
Course Outline
• Introduction to Digital System• Truth Table and Boolean Algebra• Methods for Minimizing Boolean Expression• Programmable Circuits• Sequential Flip-Flops• Synchronous Counters• Synchronous Finite State Machine• A/D and D/A Conversion• Asynchronous Sequential Circuit Design• Practical Digital Designs (Part I Arithmetic Operations)• Practical Digital Designs (Part II Microprocessor)• Practical Digital Designs (Part III Data Communication)
![Page 3: Lecture 1 Introduction - Suranaree University of Technologypersonal.sut.ac.th/paramate/files/digital/lecture09.pdfLecture 9 Introduction to Sequential Circuits: Evolution of Flip-Flops](https://reader034.fdocuments.in/reader034/viewer/2022052009/601f312ef19f7451f135ba88/html5/thumbnails/3.jpg)
Previous Lectures• Digital Feedback
– Meta-states and Oscillations– Electronic SPDT (Single-Pole Double-Throw) Switch Debouncer
• Flip!
• Set-Reset (S-R) Latches– Designing S-R Latches using NOR and NAND gates
– N-Latch Extension
• Clocked S-R Latches– Transient Glitches and Level-Sensitive Clock
• Data (D) Latches• Master-Slave (M-S) Flip-Flops
– Edge-Triggered Clock (Edge Sensitive Clock)
• Toggle (T) Flip-Flops• J-K Flip-Flops
• Data (D) Flip-Flops• Clock Timing and Stability Analysis
![Page 4: Lecture 1 Introduction - Suranaree University of Technologypersonal.sut.ac.th/paramate/files/digital/lecture09.pdfLecture 9 Introduction to Sequential Circuits: Evolution of Flip-Flops](https://reader034.fdocuments.in/reader034/viewer/2022052009/601f312ef19f7451f135ba88/html5/thumbnails/4.jpg)
System Feedbackในวงจร combinational delay ในวงจร logic gates ทําใหเกิด transient glitches แตในที่นี้เราจะนําสมบัติการเกิด delay มาใชประโยชน โดยการทํา positive feedback
(+) feedback
System delay
• (+) feedbackทําใหระบบ ลูออกไปสูคาสูง/ต่ํา สุด
• (-) feedbackทําใหระบบ ลู เขาไปสูคาใดคาคงที่ที่เสถียร
![Page 5: Lecture 1 Introduction - Suranaree University of Technologypersonal.sut.ac.th/paramate/files/digital/lecture09.pdfLecture 9 Introduction to Sequential Circuits: Evolution of Flip-Flops](https://reader034.fdocuments.in/reader034/viewer/2022052009/601f312ef19f7451f135ba88/html5/thumbnails/5.jpg)
Digital Feedbackสําหรับการสราง sequential digital circuits เราจะนํา (+)/(-) feedback มาใช
Feedback Output• Perfect Oscillation (0↔1)• Matastable
ขึ้นอยูกับคาคงตัวเวลาของระบบ
Feedback = +OUT/-OUT
วงจรสมมูล ในรูปของระบบที่มีตัวหนวงเวลา
![Page 6: Lecture 1 Introduction - Suranaree University of Technologypersonal.sut.ac.th/paramate/files/digital/lecture09.pdfLecture 9 Introduction to Sequential Circuits: Evolution of Flip-Flops](https://reader034.fdocuments.in/reader034/viewer/2022052009/601f312ef19f7451f135ba88/html5/thumbnails/6.jpg)
Digital Oscillatorรูปสัญญาณที่ไดจากวงจรดังกลาวจะเกิดการสั่น (oscillation) ดวยคาบเวลาเทากับ 2 เทาของคา delay time บวกดวย rising time (เวลาที่ใชในการเปลี่ยนสถานะของ output ของวงจร logic gate)
วงจร analog ที่สมมูลกัน
Astable Multi-vibrator
![Page 7: Lecture 1 Introduction - Suranaree University of Technologypersonal.sut.ac.th/paramate/files/digital/lecture09.pdfLecture 9 Introduction to Sequential Circuits: Evolution of Flip-Flops](https://reader034.fdocuments.in/reader034/viewer/2022052009/601f312ef19f7451f135ba88/html5/thumbnails/7.jpg)
Designing an S-R Latch
การออกแบบวงจร S-R Latches ดวย gate พื้นฐานเริ่มจากการสรางตารางคาความจริงของ output โดยแบงแยกระหวางคาปจจุบัน QN กับคาถัดไป QN+1
• เมื่อ S-R = (0, 0) คา Q จะไมเปลี่ยน นั่นคือ QN = QN+1
• เมื่อ S-R = (0, 1) หรือ (1, 0) คา QN+1 จะเทากับ R และ S ตามลําดับ
• เมื่อ S-R = (1, 1) คา QN = INV (QN+1)
ซึ่งสามารถนําไปเขียน K-Map ไดดังนี้
![Page 8: Lecture 1 Introduction - Suranaree University of Technologypersonal.sut.ac.th/paramate/files/digital/lecture09.pdfLecture 9 Introduction to Sequential Circuits: Evolution of Flip-Flops](https://reader034.fdocuments.in/reader034/viewer/2022052009/601f312ef19f7451f135ba88/html5/thumbnails/8.jpg)
An S-R Latch from NOR Gates
จาก K-Map เราสามารถสรางวงจรที่ประกอบดวย NOR gates แตเพียงอยางเดียวไดโดยการหา Product of Sums (POS)
delay
![Page 9: Lecture 1 Introduction - Suranaree University of Technologypersonal.sut.ac.th/paramate/files/digital/lecture09.pdfLecture 9 Introduction to Sequential Circuits: Evolution of Flip-Flops](https://reader034.fdocuments.in/reader034/viewer/2022052009/601f312ef19f7451f135ba88/html5/thumbnails/9.jpg)
Level-Sensitive Clockสําหรับวงจร S-R Latch เพิ่มขา CONTROL เพื่อรอให input S-R เปลี่ยนไปตามเงื่อนไขพรอมกอน ในที่นี้เราจะเรียกขา CONTROL วาสัญญาณนาฬิกา (CLOCK)
ก า ร ใ ช CLCK มีป ร ะ โ ยชน ใ น ก า ร แ ก ไ ข Transient Glitch และ เขาจั ง ห ว ะ สัญญาณ input
ขา CLK จะผานให ผลลัพธของ A AND INV (A) ออกไปปรากฏที่ขา S ไดเมื่ อผ านพนช วงที่เปน glitch ไปแลว
![Page 10: Lecture 1 Introduction - Suranaree University of Technologypersonal.sut.ac.th/paramate/files/digital/lecture09.pdfLecture 9 Introduction to Sequential Circuits: Evolution of Flip-Flops](https://reader034.fdocuments.in/reader034/viewer/2022052009/601f312ef19f7451f135ba88/html5/thumbnails/10.jpg)
Data (D) Latchเราอาจปรับปรุง วงจร SR-Latch แบบมีสัญญาณนาฬิกา โดย เพิ่ม Literal สองตัวซึ่งเปน Inverse ของกันและกัน
• สังเกตวา input ลักษณะนี้ โดยปรกติจะทําใหเกิด Transient Glitch แตถา CLK เปน HI หลังจาก ผานชวง delay ที่ INV (D) มาแลวจะไมเกิด glitch ที่ขา Q
• เมื่อสัญญาณ CLK เปน LO S-R จะมีคาเปน (0, 0) นั่นคือ Flip-Flop จะคงคาเดิม ของ D ไว (Hold) หรือ อีกนัยหนึ่งคือประพฤติตัวเปน Memory นั่นเอง
![Page 11: Lecture 1 Introduction - Suranaree University of Technologypersonal.sut.ac.th/paramate/files/digital/lecture09.pdfLecture 9 Introduction to Sequential Circuits: Evolution of Flip-Flops](https://reader034.fdocuments.in/reader034/viewer/2022052009/601f312ef19f7451f135ba88/html5/thumbnails/11.jpg)
Master-Slave (M-S) Flip-FlopD Latch สองตัวที่มาตออนุกรมกัน (ดังรูป) โดยมี INV (CLK) คั่นกลาง จะเรียกวาวงจา Master-Slave (M-S) Flip-Flop
Output ของ Latch ซายมือ (Master) จะ “สั่ง” Input ของ Latch ทางขวามือ (Slave) สังเกตการตอ CLK ลักษณะนี้ใชสัญลักษณ สามเหลี่ยม ที่ขาสัญญาณ
![Page 12: Lecture 1 Introduction - Suranaree University of Technologypersonal.sut.ac.th/paramate/files/digital/lecture09.pdfLecture 9 Introduction to Sequential Circuits: Evolution of Flip-Flops](https://reader034.fdocuments.in/reader034/viewer/2022052009/601f312ef19f7451f135ba88/html5/thumbnails/12.jpg)
Edge-Trigged M-S Flip-Flopจากแผนผังเวลาจะเห็นวา Q-S จะเปลี่ยนก็ตอเมื่อ CLK-S เปลี่ยนจาก 0 เปน 1 (+ delay) เมื่อดูจากวงจรภายนอก ชวงขอบขาลงของ CLK-M ทําให Q-S เปลี่ยนตาม ขอมูล DATA (a) จึงเรียกวา Negative Edge-Trigged หรือ Flip-Flop (FF)
![Page 13: Lecture 1 Introduction - Suranaree University of Technologypersonal.sut.ac.th/paramate/files/digital/lecture09.pdfLecture 9 Introduction to Sequential Circuits: Evolution of Flip-Flops](https://reader034.fdocuments.in/reader034/viewer/2022052009/601f312ef19f7451f135ba88/html5/thumbnails/13.jpg)
Toggle (T) Flip-Flopการออกแบบให input ของ M-S FF ปรากฏแตสถานะ ที่เปน complement กัน (01 หรือ 10) สามารถทําได โดยตอ X และ INV (X) ที่ input
หรืออีกวิธี ที่ใหผลเหมือนกันคือ ตอ Q และ INV (Q) ไปเขาที่ขา R และ S ตามลําดับ (ดังรูป) เรียกวงจร ที่ไดวา T-Flip Flop
T-FF 1 ตัวสามารถนํามาสรางเปน counter ขนาด 2 บิตไดดังแผนผังดานลาง
หมายเหตุ T FF ตางจากวงจร Oscillator แบบ feedback แบบพื้นฐาน ตรงที่ สถานะจะเปลี่ยนเฉพาะตรงขอบขาลงของ CLK
![Page 14: Lecture 1 Introduction - Suranaree University of Technologypersonal.sut.ac.th/paramate/files/digital/lecture09.pdfLecture 9 Introduction to Sequential Circuits: Evolution of Flip-Flops](https://reader034.fdocuments.in/reader034/viewer/2022052009/601f312ef19f7451f135ba88/html5/thumbnails/14.jpg)
M-S S-R Flip Flopถายอนไปพิจารณา negative edge trigged D FF ดังรูปดานซาย พบวา มีเพียง input เดียว (ซึ่งไดจากการตอ complement ภายใน ของ S-R Latch)
ดังนั้น D FF จะไมมีการจําขอมูลระหวางสถานะ
ในขณะที่ S-R FF สาม า รถ จํ า ข อ มู ล ของสถานะ กอนหนาได เมื่อ S-R = (0, 0) ระหวางที่ CLK เปน HI (วงจรภายใน)
Edge trigged MS FF
![Page 15: Lecture 1 Introduction - Suranaree University of Technologypersonal.sut.ac.th/paramate/files/digital/lecture09.pdfLecture 9 Introduction to Sequential Circuits: Evolution of Flip-Flops](https://reader034.fdocuments.in/reader034/viewer/2022052009/601f312ef19f7451f135ba88/html5/thumbnails/15.jpg)
J-K Flip Flopปญหาที่สําคัญของ S-R Flip Flop คือ สถานะที่ S-R เปน 1 พรอมกัน (1, 1) เราสามารถ หลีกเลี่ยงขอจํากัด นี้ได โดยสราง J-K Flip Flop ดังรูป
ที่ขอบขาลงของ CLK
J-K = (1, 0) คา Q = 1J-K = (0, 1) คา Q = 0J-K = (0, 0) คา Q คงเดิมJ-K = (1, 1) คา Q toggle
• D output Q จํา input D ได แตไมขึ้นกับ input กอนหนา
• S-R จํา input และ สถานะกอนหนาได แตมีเงื่อนไข (S, R) ไมเทากับ (1, 1)
• J-K เหมือน S-R แตที่ (1, 1) output จะสลับกัน เหมือน T FF
![Page 16: Lecture 1 Introduction - Suranaree University of Technologypersonal.sut.ac.th/paramate/files/digital/lecture09.pdfLecture 9 Introduction to Sequential Circuits: Evolution of Flip-Flops](https://reader034.fdocuments.in/reader034/viewer/2022052009/601f312ef19f7451f135ba88/html5/thumbnails/16.jpg)
Timing Parametersนอกจากนี้ในการออกแบบวงจร FF ยังมีคาตัวแปรที่ตองพิจารณา ดังตอไปนี้
• tsetup คือเวลานอยที่สุดที่ตองการให DATA มีคาคงที่กอนถึงขอบขาขึ้นของ CLK (มิฉะนั้นจะไมมีการบันทึก DATA)
• thold คือเวลาที่นอยที่สุด ที่ตองการให DATA มีคาคงที่หลังจากขอบขาขึ้นของ CLK (มิฉะนั้นวงจรจะไมพิจารณา DATA)
• tw คือชวงเวลาที่นอยที่สุดของ CLK pulse (นับจากขอบขาขึ้นถึงขาลง) ที่วงจรยังถือวาเปนสัญญาณ CLK
• tp คือ propagation delay (เวลาที่ใชจนกวา input จะไปปรากฏที่ output)• Slew rate (volt per second) คืออัตราการเปลี่ยนแปลงของคาแรงดัน (จาก 0 ไป 1) ตอเวลาที่มากที่สุด ที่ยอมรับได (ความถี่ต่ําสุดของ CLK ที่ยอมรับ)
• ความถี่สูงสุดของ CLK สามารถคํานวณไดจากสมการตอไปนี้
( ) 1max
−++= pholdsetup tttf
![Page 17: Lecture 1 Introduction - Suranaree University of Technologypersonal.sut.ac.th/paramate/files/digital/lecture09.pdfLecture 9 Introduction to Sequential Circuits: Evolution of Flip-Flops](https://reader034.fdocuments.in/reader034/viewer/2022052009/601f312ef19f7451f135ba88/html5/thumbnails/17.jpg)
Clocked FF: Setup/Hold Timesเมื่อพิจารณาโดยละเอียดแลว ถึงแมวาการใชขอบขาลงของสัญญาณนาฬิกาในการควบคุมการทํางานของ FF จะแกปญหา transient glitch ได แตก็เกิดปญหาใหม
สัญญาณที่ output จะเปนเชนไร หากขอมูลเปลี่ยน พรอมๆ กับ CLK
ใ น ท า ง ป ฏิ บั ติ จึ ง มั กออกแบบให DATA คงสถานะไวกอน (SETUP) และ หลัง (HOLD) การเปลี่ ยนแปลงของ CLK เล็กนอย ดังรูป
![Page 18: Lecture 1 Introduction - Suranaree University of Technologypersonal.sut.ac.th/paramate/files/digital/lecture09.pdfLecture 9 Introduction to Sequential Circuits: Evolution of Flip-Flops](https://reader034.fdocuments.in/reader034/viewer/2022052009/601f312ef19f7451f135ba88/html5/thumbnails/18.jpg)
The Metastable Stateในกรณีที่ DATA มาถึงชากวาสัญญาณ CLK เล็กนอย (คา setup time ไมเปนไปตามเงื่อนไข) ดังรูป
ถาบังเอิญวา DATA เขามาในจังหวะที่สัญญาณ CLK กําลังจะเปลี่ยน ทําใหชวงเล็ก กอนหนานั้นไปกระตุนวงจรใหอยูในสถานะก้ํากึ่งระหวาง 0 กับ 1 (metastate)
กรณีนี้เปรียบเทียบไดกับการโยนเหรียญลงตรงขอบ เมื่อเวลาผานไปนานมากๆ ถึงที่สุดเหรียญจะกลับไปเปน 0 หรือ 1 เหมือนเดิม แตจะเปนกรณีใดนั้น ทํานายไมได
![Page 19: Lecture 1 Introduction - Suranaree University of Technologypersonal.sut.ac.th/paramate/files/digital/lecture09.pdfLecture 9 Introduction to Sequential Circuits: Evolution of Flip-Flops](https://reader034.fdocuments.in/reader034/viewer/2022052009/601f312ef19f7451f135ba88/html5/thumbnails/19.jpg)
Synchronizerเพื่อหลีกเลี่ยง metastate ในการออกแบบวงจรขนาดใหญ จึงจําเปนตองใชตัวเขาจังหวะ (Synchronizer)วงจรดานลางแสดงรายละเอียดภายใน synchronizer ประกอบดวย D FF อนุกรม
Metastate ชวงสั้นๆ จะถูกลบทิ้งระหวาง Q1 และ D
![Page 20: Lecture 1 Introduction - Suranaree University of Technologypersonal.sut.ac.th/paramate/files/digital/lecture09.pdfLecture 9 Introduction to Sequential Circuits: Evolution of Flip-Flops](https://reader034.fdocuments.in/reader034/viewer/2022052009/601f312ef19f7451f135ba88/html5/thumbnails/20.jpg)
Conclusions• Digital Feedback
– Meta-states and Oscillations– Electronic SPDT (Single-Pole Double-Throw) Switch Debouncer
• Flip!
• Set-Reset (S-R) Latches– Designing S-R Latches using NOR and NAND gates
– N-Latch Extension
• Clocked S-R Latches– Transient Glitches and Level-Sensitive Clock
• Data (D) Latches• Master-Slave (M-S) Flip-Flops
– Edge-Triggered Clock (Edge Sensitive Clock)
• Toggle (T) Flip-Flops• J-K Flip-Flops
• Data (D) Flip-Flops• Clock Timing and Stability Analysis