systems
play

Systems State Machines 2: Design Problems Shankar Balachandran* - PowerPoint PPT Presentation

Spring 2015 Week 6 Module 30 Digital Circuits and Systems State Machines 2: Design Problems Shankar Balachandran* Associate Professor, CSE Department Indian Institute of Technology Madras *Currently a Visiting Professor at IIT Bombay


  1. Spring 2015 Week 6 Module 30 Digital Circuits and Systems State Machines 2: Design Problems Shankar Balachandran* Associate Professor, CSE Department Indian Institute of Technology Madras *Currently a Visiting Professor at IIT Bombay

  2. Example 1: Design a sequential circuit that produces “1” on its output if it detects the  sequence “101” on it’s input. The detector should keep checking for the appropriate sequence and should not reset to the initial state after it has recognized the sequence. P.S. N.S. ( Q 1 * Q 0 *) Out ( z )  D x Q 1 0 Q 1 Q 0 x= 0 x =1 x= 0 x =1  D x 0 s 0 (00) s 0 (00) s 1 (01) 0 0  z x Q 1 s 1 (01) s 2 (10) s 1 (01) 0 0 s 2 (10) s 0 (00) s 1 (01) 0 1 Analysis and Design of Sequential Logic Circuits 2

  3. Moore Style N.S. ( Q 1 * Q 0 *) Out P.S. ( z ) Q 1 Q 0 x= 0 x =1   D x Q x Q Q 1 0 1 0 s 0 (00) s 0 (00) s 1 (01) 0  D x 0 s 1 (01) s 2 (10) s 1 (01) 0  z Q Q 1 0 s 2 (10) s 0 (00) s 3 (11) 0 s 3 (11) s 2 (10) s 1 (01) 1 Analysis and Design of Sequential Logic Circuits 3

  4. Example (contd.): Output Waveforms CLK Input x s 0 s 1 s 2 s 1 s 1 s 2 s 1 s 1 s 2 s 0 State Mealy Output z s 0 s 1 s 2 s 3 s 1 s 2 s 3 s 1 s 2 s 0 State Moore Output z Mealy outputs may change when an input changes (i.e., not necessarily on a clock edge).  output may have glitches. This problem can be solved by making Mealy inputs synchronous. Moore outputs only change on clock edges since they depend only on the present state.  Moore outputs may be delayed w.r.t. the corresponding outputs in a Mealy implementation. Analysis and Design of Sequential Logic Circuits 4

  5. Example 2: A sequential circuit has one input and one output. When input sequence “110” occurs the output becomes 1 and remains 1 until the sequence “110” occurs again in which case the output returns to 0. The output remains 0 until “110” occurs a third time, etc. State Diagram : State Encoding : b 6 states  3-bit encoding 0/0 001 1/0 1/0 a 000 a c 0/0 b 001 1/0 010 000 c 010 0/0 0/1 d 011 011 f 101 d 0/1 e 100 1/1 1/1 1/1 f 101 0/1 100 e 3-bit encoding  3 flip-flops Analysis and Design of Sequential Logic Circuits 5

  6. Excitation table using D Flip-flops : Present State Next State Flip-flop Inputs Input Output ( X ) ( S ) Q 2 Q 1 Q 0 Q 2 * Q 1 * Q 0 * D 2 D 1 D 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 b 0 0 0 1 0 0 0 0 0 0 0 0/0 1/0 001 1 0 0 1 0 1 0 0 1 0 0 1/0 a c 1/0 0 0 1 0 0 1 1 0 1 1 1 0/0 010 000 1 0 1 0 0 1 0 0 1 0 0 0/1 0/0 0 0 1 1 0 1 1 0 1 1 1 101 011 f d 0/1 1/1 1/1 1 0 1 1 1 0 0 1 0 0 1 100 1/1 0/1 0 1 0 0 0 1 1 0 1 1 1 e 1 1 0 0 1 0 1 1 0 1 1 0 1 0 1 0 0 0 0 0 0 0 1 1 0 1 1 0 1 1 0 1 1 Analysis and Design of Sequential Logic Circuits 6

  7. Excitation and output logic functions :   D XQ XQ Q 2 2 1 0     D X Q Q Q X Q Q Q X Q Q 1 2 1 0 1 1 0 2 0     D X Q XQ Q Q X Q Q 0 1 2 2 0 1 0     S X Q XQ Q Q Q Q 1 2 2 0 1 0 Analysis and Design of Sequential Logic Circuits 7

  8. Circuit Implementation   D XQ XQ Q 2 2 1 0     D X Q Q Q X Q Q Q X Q Q 1 2 1 0 1 1 0 2 0     D X Q XQ Q Q X Q Q 0 1 2 2 0 1 0     S X Q XQ Q Q Q Q 1 2 2 0 1 0 Analysis and Design of Sequential Logic Circuits 8

  9. Example 3: Design a sequential comparator circuit that is to determine which of the two multi-bit numbers, A and B , of equal length is larger. Inputs are supplied in MSB first fashion. 10/10 X X /10 10 00 00,11/00 01/01 01 X X /01 Analysis and Design of Sequential Logic Circuits 9

  10. Example 4: Moore Machine Design a bit-serial odd parity checker : It counts the number of 1’s in a bit -  serial input stream and asserts its output when the input stream contains an odd number of 1’s. N.S. ( Q 0 *) P.S. Out ( z ) Q 0 0 0 x= 0 x =1 even even odd 1 0 (0) (0) (1) even odd 0 1 odd odd even reset 1 1 (1) (1) (0) Using D flip-flops Using T flip-flops    D x Q T x 0 0 0   z Q z Q 0 0 Analysis and Design of Sequential Logic Circuits 10

  11. Example: Moore Machine  A bus controller, that receives requests on separate lines, R 0 to R 3 from 4 devices to use the bus. It has four outputs, G 0 to G 3 , only one of which is 1 ( indicating which device is granted control for that clock period ). The lowest number device has the highest priority. A higher priority device can preempt the bus. Assume that, before servicing any pending request, the controller remains idle for one clock period.  The bus controller has five states:  A: idle, no device is using the bus  B: device 0 is using the bus  C: device 1 is using the bus  D: device 2 is using the bus  E: device 3 is using the bus Analysis and Design of Sequential Logic Circuits 11

  12. Moore state machine for the bus controller example . Inputs: R 0 R 1 R 2 R 3 0000 Outputs: G 0 G 1 G 2 G 3 A 0000 XXX0 1XXX 1XXX X1XX XX1X 0001 B E 0XXX 1000 0001 1XXX 001X XX0X 0001 01XX X0XX 1XXX 1XXX X1XX D C 0010 0100 001X 01XX Analysis and Design of Sequential Logic Circuits 12

  13. Read on your own Sequential Circuits 13

  14. Example – Modulo 3 in Binary  Analogous to Decimal - Use long division Modulus 1 9 5 1 9 5 7 4 7 9 3  Take one digit at a time 3  Start at the most significant digit 2  Calculate remainder 2 7  Shift in another digit 0  The previous modulus moves to “tens” position 3  Shifted digit gets added 1  Calculate remainder 1 5 2 2 7 2  Repeat until all digits are done Analysis and Design of Sequential Logic Circuits 14

  15. Binary Modulus  Take one bit at a time (MSB first) m  Calculate remainder  Three possible values – 0,1,2  Shift in the next bit  Shifting results in doubling the previous modulus value  New digit gets added to this doubled value   2 m 1 ; if next bit is 1  m '   2 m 0 ; if next bit is 0   Perform modulus of the resultant value m  2 m ' mod 3 Analysis and Design of Sequential Logic Circuits 15

  16. State Table and State Diagram Next Present Modulus x = 0 x = 1 0 1 0 0 1 1 0 2 0 1 1 2 0 1 0 2 1 2 Next Present Modulus x = 0 x = 1 00 00 01 01 10 00 10 01 10 Analysis and Design of Sequential Logic Circuits 16

  17. Implementation with T Flip-Flops Present State Next State Flip-flop Inputs Input x Q 1 Q 0 Q 1 * Q 0 * T 1 T 0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 1 0 0 1 1 1 0 0 0 0 1 0 1 1 0 1 0 0 0 1 1 1 0 1 0 0 0 1   T x ( Q Q ) 1 1 o    T ( x Q ) Q 0 1 o Analysis and Design of Sequential Logic Circuits 17

  18. Do it Yourself Design a Gray code counter using JK flip-flops. 1. Design a 3 bit up/down counter using T flip-flops. The 2. count direction is determined by input D (D=0 means count down). Design a sequence detector with one input X and one 3. output Z . The detector should recognize the input sequence “101”. The detector should keep checking for the appropriate sequence and should not reset to the initial state after it has recognized the sequence. Analysis and Design of Sequential Logic Circuits 18

  19. End of Week 6: Module 30 Thank You Intro to State Machines 19

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend