lecture 5 sequential circuit design circuits using flip
play

Lecture 5: Sequential Circuit Design Circuits using flip-flops - PowerPoint PPT Presentation

Lecture 5: Sequential Circuit Design Circuits using flip-flops Now that we know Inputs Outputs Combinational Circuit about flip-flops and what they do, how do we use them in circuit Storage Units design? Whats the benefit in


  1. Lecture 5: Sequential Circuit Design

  2. Circuits using flip-flops § Now that we know Inputs Outputs Combinational Circuit about flip-flops and what they do, how do we use them in circuit Storage Units design? § What’s the benefit in using flip-flops in a circuit at all?

  3. We are here Assembly Language Processors Arithmetic Finite State Logic Units Machines Devices Flip-flops Circuits Logic Gates Transistors

  4. Example #1: Registers

  5. Shift registers § A series of D flip-flops can store a multi-bit value (such as a 16-bit integer, for example). SI D 0 Q D 1 Q D 2 Q D 15 Q Q Q Q Q Clk § Data can be shifted into this register one bit at a time, over 16 clock cycles. ú Known as a shift register.

  6. Shift registers § Illustration: shifting in 0101010101010101 0 0 1 1 SI D 0 Q D 1 Q D 2 Q D 15 Q Q Q Q Q Clk

  7. Shift registers § Illustration: shifting in 0101010101010101 0 1 0 1 SI D 0 Q D 1 Q D 2 Q D 15 Q Q Q Q Q Clk § After 16 clock cycles….

  8. Load registers § One can also load a register’s values all at once, by feeding signals into each flip-flop: ú In this example: a 4-bit load register. D 0 D 1 D 2 D 3 D Q D Q D Q D Q Q Q Q Q Clk

  9. Load registers § To control when this register is allowed to load its values, we introduce the D flip-flop with enable: EN D Q D Q EN D Clk Q Q

  10. Load registers § To control when this register is allowed to load its values, we introduce the D flip-flop with enable: EN 0 D Q D Q EN D 1 Clk Q Q § It’s a MUX!

  11. Load registers D 0 D 1 D 2 D 3 D Q D Q D Q D Q EN EN EN EN Q Q Q Q Write Clk § Implementing the register with these special D flip-flops will now maintain values in the register until overwritten by setting EN high.

  12. Example #2: Counters

  13. Counters T Q § Consider the T flip-flop: ú Output is inverted when Q input T is high. § What happens when a series of T flip-flops are connected together in sequence? § More interesting: D Q T Connect the output of Clk one flip-flop to the clock Q input of the next!

  14. Counters 1 Q 0 Q 1 Q 2 Q 3 T Q T Q T Q T Q Q Q Q Q § This is a 4-bit ripple counter, which is an example of an asynchronous circuit. ú Timing isn’t quite synchronized with the rising clock pulse à hard to know when output is ready. ú Cheap to implement, but unreliable for timing.

  15. Counters 1 Q 0 Q 1 Q 2 Q 3 T Q T Q T Q T Q C § Timing diagram Q Q Q Q ú Note how propagation delay increases for later Qs C Q 0 0 1 0 0 1 1 1 0 0 Q 1 0 0 1 0 0 1 1 1 0 Q 2 0 0 0 0 1 1 1 1 0 Q 3 0 0 0 0 0 0 0 0 1

  16. Counters Write T Q T Q T Q Q 3 Q 2 T Q Q 1 Q 0 Q Q Q Q Clk § This is a synchronous counter, with a slight delay. § Each AND gate combine outputs of all previous flip-flops § Each flip-flop only changes when all previous flip flops are set

  17. It’s time for… § The Count!

  18. Example #3: Counters Load Write R 1 R 0 0 0 D Q D Q 1 1 Q Q Clk Clear § Counters are often implemented with a parallel load and clear inputs. ú Loading a counter value is used for countdowns.

  19. State Machines

  20. Designing with flip-flops § Counters and registers are examples of how flip-flops can implement useful circuits that store values. § How do you design these circuits? § What would you design with these circuits?

  21. Designing with flip-flops § Sequential circuits are the basis for memory, instruction processing, and any other operation that requires the circuit to remember past data values. § These past data values are also called the states of the circuit. § Sequential circuits use combinational logic to determine what the next state of the system should be, based on the past state and the current input values: input + prev state à next state

  22. State example: Counters § With counters, each state is the current number that is stored in the counter. 0 0 0 1 1 1 1 001 010 011 one two 0 three 0 000 100 zero four 111 110 six 101 five seven 1 1 1 1 0 0 0 § On each clock tick, the circuit transitions from one state to the next, based on the inputs.

  23. State Write State State Tables zero 0 zero 1 zero one 0 § State tables help to one one 1 one two illustrate how the two 0 two states of the circuit two 1 three change with various 0 three three 1 three four input values. 0 four four ú Transitions are four 1 five understood to take five 0 five place on the clock 1 five six ticks 0 six six 1 six seven ú (e.g., rising edge) seven 0 seven seven 1 zero

  24. F 1 F 2 F 3 Write F 1 F 2 F 3 State Tables 0 0 0 0 0 0 0 1 0 0 0 0 0 1 § Same table as on 0 0 0 1 0 0 1 1 0 0 1 0 1 0 the previous slide, 0 1 0 0 0 1 0 but with the 0 1 0 1 0 1 1 actual flip-flop 0 0 1 1 0 1 1 values instead of 1 0 1 1 1 0 0 state labels. 0 1 0 0 1 0 0 § Note: Flip-flop 1 0 0 1 1 0 1 1 0 1 0 1 0 1 values are both 1 1 0 1 1 1 0 inputs and 0 1 1 0 1 1 0 outputs of the 1 1 1 0 1 1 1 circuit here. 1 1 1 0 1 1 1 1 1 1 1 0 0 0

  25. and this brings us to… Finite State Machines

  26. As seen in other courses… § You may have seen finite state machines before, but in a different context. ú Used mainly to describe the grammars of a language, or to model sequence data. § In CSCB58, finite state machines are models for an actual circuit design. ú The states represent internal states of the circuit, which are stored in the flip-flop values.

  27. Finite State Machines (FSMs) § From theory courses… ú A Finite State Machine is an abstract model that captures the operation of a sequential circuit. § A FSM is defined (in general) as: ú A finite set of states, ú A finite set of transitions between states, triggered by inputs to the state machine, ú Output values that are associated with each state or each transition (depending on the machine), ú Start and end states for the state machine.

  28. Example #1: Tickle Me Elmo § Remember how the Tickle Me Elmo works!

  29. Example #1: Tickle Me Elmo § Toy reacts differently each time it is squeezed: ú First squeeze à “Ha ha ha…that tickles.” ú Second squeeze à “Ha ha ha…oh boy.” ú Third squeeze à “HA HA HA HA…HA HA HA HA…etc” § Questions to ask: ú What are the inputs? ú What are the states of this machine? ú How do you change from one state to the next? ú Who thought this is a good toy for children!?

  30. Example #1: Tickle Me Elmo Neutral Squeeze Time Time Tickles Time GoCrazy Squeeze OhBoy Squeeze Squeeze

  31. More elaborate FSMs § Usually our FSM has more than one input, and will trigger a transition based on certain input values but not others. § Also might have input values that don’t cause a transition, but keep the circuit in the same state (transitioning to itself).

  32. Example #2: Alarm Clock § Internal state description: ú Starts in neutral state, until timer signal goes off. Clock moves to alarm state. ú Alarm state continues until: snooze button is pushed (move to snooze state) alarm is turned off (move to neutral state) timer goes off again (move to neutral state) ú In snooze state, clock returns to alarm state when the timer signal goes off again.

  33. Example #3: Traffic Light Change=0 Red Change=1 Change=1 Yellow Green Change=1 Change=0 Change=0

Recommend


More recommend