Decision Making with Binary Counter Chapter 3 Decision Making with Binary Counter
State Machine Programming Language Bisa digunakan bebagai macam bahasa Yang digunakan pada buku ini : CUPL (Compiler Universal Programming Language) Binary Counter diproses melalui suatu urutan keadaan, masing2 unik dan stabil Ada 3 properties dalam suatu keadaan: Kondisi awal
Keadaan berikut (Next State), pada binary counter tidak ada pengaruh dari luar (input). Output dari state machine akan ditentukan dari keadaan yang spesifik. Setiap bahasa akan mampu mendefinisikan ketiga keadaan tersebut. Penulisan program ditentukan oleh aturan pada masing2 bahasa Misalkan : semicolon (;) merupakan akhir kalimat /* keterangan, { dan } merupakan awal dan akhir suatu program.
Sequential Counter Program /* Practical Example 3.1 */ SEQUENCE [X,Y,Z] { PRESENT 0 NEXT 4 ; PRESENT 4 NEXT 2 ; PRESENT 2 NEXT 1 ; PRESENT 1 NEXT 0 ; }
Present : 2 Next : 3 Present : a Next : b
Conditional Transition Statement Practical Example 3.2 (Solusi di gb 3.4) Conditional State in the State Machine Program /* Practical Example 3.2 */ SEQUENCE [X,Y,Z] { PRESENT 2 IF R NEXT 5 ; IF !R NEXT 7 ; PRESENT 1 NEXT 2 ; PRESENT 5 NEXT 1 ; PRESENT 7 NEXT 1 ; }
Practical Example 3.3 (Solusi ada di gb 3.5) Creating a State Diagram from a State Machine Program /* Practical Example 3.3 Initial State Machine Program*/ SEQUENCE [Q2…..Q0] { PRESENT a IF R NEXT c ; IF !R NEXT b ; PRESENT b IF S NEXT a ; IF !S NEXT d ; PRESENT c IF S NEXT f; IF !S NEXT a ; PRESENT d IF T NEXT e ; IF !T NEXT b ; PRESENT e NEXT a ; PRESENT f IF T NEXT c ; IF !R NEXT e ; }
Tahapan pengerjaan P.Exp 3-3 Membuat State diagram berdasarkan State Machine Program Menentukan Nilai biner dengan ‘Glitch Free’ Menulis ulang program dengan Nilai biner (glitch free) yang terbentuk
Practical Example 3.3 Rewriting the Program and State Diagram /* Practical Example 3.3 State Machine Program*/ SEQUENCE [Q2…..Q0] { PRESENT 2 IF R NEXT 6 ; IF !R NEXT 0 ; PRESENT 0 IF S NEXT 2 ; IF !S NEXT 1 ; PRESENT 6 IF S NEXT 7 ; IF !S NEXT 2 ; PRESENT 1 IF T NEXT 3 ; IF !T NEXT 0 ; PRESENT 3 NEXT 2 ; PRESENT 7 IF T NEXT 6 ; IF !T NEXT 3 ; }
Practical exercise 3.1 Consider the following State Machine Program : SEQUENCE […] { PRESENT a NEXT b ; PRESENT b IF R NEXT e ; DEFAULT NEXT c ; PRESENT c NEXT d ; PRESENT d NEXT c ; PRESENT e IF R NEXT f ; DEFAULT NEXT k ; PRESENT f NEXT g ; PRESENT g NEXT h ; PRESENT h IF R NEXT a ; DEFAULT NEXT i ; PRESENT i IF T NEXT j ; PRESENT j NEXT c ; PRESENT k NEXT g ; }
Decision making in State Tables
Practical Exercise 3-2 Lihat gambar 3-21. Counter ini belum glitch-free. Glitch free bisa diatasi bila keadaan c dan d ditukar, perbedaan kedua bit akan mengubah keadaan. Tugas : Tuliskan program state-machine-nya Buatlah State Table Carilah persamaan minimum input forming logic Gambarkan rangkaian counter tsb
Practical Example 3-4 Handling Multiple input Program state-machine. SEQUENCE [A,B,C] { PRESENT ‘b’ 000 IF (R & !S) NEXT ‘b’ 001 ; /* State-a */ IF (!R & S) NEXT ‘b’ 010 ; DEFAULT NEXT ‘b’ 000 ; PRESENT ‘b’ 001 IF !T NEXT ‘b’ 001 ; DEFAULT NEXT ‘b’ 010 ; /* State-b */ PRESENT ‘b’ 010 IF (S& !T) NEXT ‘b’ 100 ; DEFAULT NEXT ‘b’ 000 ; /* State-c */ PRESENT ‘b’ 100 NEXT ‘b’ 000 ; /* State-d */ }
Input-Forming Logic Simplification Harus dipikirkan : Perlukah glitch free counter? Perlukah meminimize kekompleks-an dari input forming logic? Kedua hal ini bertentangan, bila ingin glitch free, pasti rangkaian akan lebih kompleks.
Practical Exercise 3.3 Circuit Complexity in Controlled Binary Counter Program state-machine. SEQUENCE [A,B,C,D] { PRESENT a IF (!R & S) NEXT b ; DEFAULT NEXT d ; PRESENT b IF (R # !S) NEXT c ; DEFAULT NEXT a ; PRESENT c IF (!R & !S) NEXT d ; DEFAULT NEXT e ; PRESENT d IF S NEXT a ; DEFAULT NEXT d ; PRESENT e NEXT f ; PRESENT f NEXT g; PRESENT g NEXT h ; PRESENT h IF !R NEXT e ; DEFAULT NEXT d ; }
Kondisi I : a=0, b=2, c=4, d=8, e=1, f=3, g=12, dan h=9, Kondisi 2 : a=0, b=4, c=12, d=8, e=13, f=15, g=11, dan h=9, Tugasnya: Buatlah : State Diagram Peta Next State Tabel Next State Karnaugh map Schematic Diagram
Gambar Untuk soal Hal 95 No. 1-9
Gambar Untuk soal Hal 96/97 No. 10-18
Program State Machine untuk soal halaman 97 no. 19-27
Program State Machine untuk soal halaman 98 no. 28-36