cs 126 lecture a4 sequential circuits midterm statistics
play

CS 126 Lecture A4: Sequential Circuits Midterm Statistics 21% - PowerPoint PPT Presentation

CS 126 Lecture A4: Sequential Circuits Midterm Statistics 21% Average: 42.5 Last Semester Median: 44 17% A 36.5% 14% B 32.3% C 23.4% 13% 11% D 3.6% 10% F 4.2% 5% 4% 3% 1% 13 15 20 25 30 35 40 45 50 55 60 F D C


  1. CS 126 Lecture A4: Sequential Circuits

  2. Midterm Statistics 21% Average: 42.5 Last Semester Median: 44 17% A 36.5% 14% B 32.3% C 23.4% 13% 11% D 3.6% 10% F 4.2% 5% 4% 3% 1% 13 15 20 25 30 35 40 45 50 55 60 F D C B A A+ CS126 12-1 Randy Wang

  3. Outline • Introduction • An S-R Flip-flop • More flip-flops • Registers and register files • Counters • Conclusions CS126 12-2 Randy Wang

  4. Where We Are At • We have learned the abstract interface presented by a machine: the instruction set architecture • What we are learning: the implementation behind the interface: - Start with switching devices (such as transistors) - Build logic gates with transistors - Build combinational circuit (memory-less) devices using gates - Today: build sequential circuit (memory) devices - Thursday: glue these devices into a computer CS126 12-3 Randy Wang

  5. Memory-less Devices vs. Devices with Memory • What we we have learned in the last lecture - Devices that can carry out one step of operation • What they can’t do - “Remember” history of operations - Carry out a sequence of operations in which later operations depend on results of previous ones CS126 12-4 Randy Wang

  6. Combinational vs. Sequential Circuits x 1 z 1 x 1 z 1 x 2 z 2 x 2 z 2 O u tp u ts Combinational In p u ts O u tp u ts Sequential In p u ts Circuit Circuit z n-1 x m z n z n M em ory • Combinational circuits - Outputs determined solely by inputs • Sequential Circuits - Characterized by feedbacks - Outputs determined by inputs and previous outputs CS126 12-5 Randy Wang

  7. Outline • Introduction • An S-R Flip-flop • More flip-flops • Registers and register files • Counters • Conclusions CS126 12-6 Randy Wang

  8. Set-Reset Flip-flop Interface Implementation • A flip-flop - A smallest sequential circuit - Can “remember” a bit of information • An S-R flip-flop - Pulse on Set (S) line turns flip-flop on - Pulse on Reset (R) line turns flip-flop off - If S=R=0, nothing happens - S=R=1 not allowed CS126 12-7 Randy Wang

  9. Timing Diagram (for S-R Flip-flop) • Because sequential circuits are functions of time, a timing diagram is one of the ways of describing them CS126 12-8 Randy Wang

  10. Truth Table (for S-R Flip-flop) previous state next state • Previous states become “input variables” in truth table CS126 12-9 Randy Wang

  11. Characteristic Equation (for S-R Flip-flop) Q + = S + R’Q (SR=0) • An equation that expresses the next state of a flip-flop in terms of its present state and inputs (also called next state equations) • Timing diagrams, truth tables, and next-state equations are important tools for understanding and constructing more sophisticated sequential circuits as well CS126 12-10 Randy Wang

  12. Outline • Introduction • An S-R Flip-flop • More flip-flops • Registers and memory • Counters • Conclusions CS126 12-11 Randy Wang

  13. The Clock cycle time rising edge falling edge CS126 12-12 Randy Wang

  14. A Clocked S-R Flip-flop timing interface diagram implementation • In large sequential networks, there are many flip-flops • Need to synchronize operations of different flip-flops • Synchronization provided by a a common clock (pulse) CS126 12-13 Randy Wang

  15. A D Flip-flop Interface Implementation CS126 12-14 Randy Wang

  16. Behavior of D Flip-flop Timing Diagram Q + = D Characteristic Equation Truth Table CS126 12-15 Randy Wang

  17. Rising vs. Falling Edge cycle time rising edge falling edge • So far, all the clocked flip-flops “flip-flop” on the rising edge of a clock signal • When we cram a lot of actions into a single cycle, we sometimes need them to change state on the falling edge CS126 12-16 Randy Wang

  18. Master-Slave D Flip-flop On rising edge, input copied into master; On falling edge, master M S copies data into slave. Im plem entation D Q Cl Interface T im in g D ia gram • Input sampled on rising edge, and must remain stable during the pulse, output changes on falling edge • Question: why don’t we just invert the clock using a NOT? • Another type: “edge-triggered”, allows input change during clock pulse CS126 12-17 Randy Wang

  19. Outline • Introduction • An S-R Flip-flop • More flip-flops • Registers and register files • Counters • Conclusions CS126 12-18 Randy Wang

  20. Stand-alone Register Interface Input Output CS126 12-19 Randy Wang

  21. Stand-alone Register Implementation x 0 D y 0 Q C l x 1 D y 1 Q C l x n-1 D y n-1 Q C l Cl Load CS126 12-20 Randy Wang

  22. Register File Interface (Bits) log 2 n address k = reg 0 input reg 1 output reg 2 write Clock reg n-1 • bunch of bits to choose from • “address” specifies which bit • if “write” is 1, “input” gets copied into the chosen bit on clock pulse • if “write” is 0, chosen bit appears on “output” CS126 12-21 Randy Wang

  23. Register File Implementation (Bits) address in w Cl C l y 0 D Multiplexer Decoder C l y 1 out D C l y n-1 D • Decoder chooses exactly one bit to write into • Multiplexer chooses exactly one bit to copy out CS126 12-22 Randy Wang

  24. 3-State Logic C l C l D D Yes No C l C l D D • Can’t connect outputs together (even if they are zero) • Must use multiplexer (or its equivalent: [3-state logic] ) CS126 12-23 Randy Wang

  25. Register File Implementation 2 (Bits) w address in Cl C l y 0 D Decoder C l y 1 out D C l y n-1 D • Red things are new: replace MUX with 3-state logic • Less Complex than MUX version CS126 12-24 Randy Wang

  26. Register File Interface (Words) log 2 n address reg 0 input k reg 1 reg 2 write output k Clock reg n-1 • Register file of k-bit words • red things show the differences between word case and bit case CS126 12-25 Randy Wang

  27. Register File Implementation (Words) number of address in w Cl register(k) bits per C l y 0 Multiplexer Multiplexer D Multiplexer Multiplexer Decoder C l y 1 out registers (n) number of D C l y n-1 D • red things show the differences between word case and bit case • Multiply the number of flip-flops and MUXes by bits per register (k) • May replace MUXes with 3-state logic (see previous slides) CS126 12-26 Randy Wang

  28. Correting Lecture Notes in Your Course Reader • Memory vs. register files - Lecture notes use the term “memory” - Meant to say register files (or SRAM) - DRAM made differently--no flip-flops - DRAM: one transistor per bit! - Much higher density than flip-flops, but slower CS126 12-27 Randy Wang

  29. Correting Lecture Notes in Your Course Reader (cont.) can’t do this! • Can’t connect outputs together (even if they are zero) • Must use multiplexer (or its equivalent: [3-state logic] ) CS126 12-28 Randy Wang

  30. Correting Lecture Notes in Your Course Reader (cont.) bits words don’t need decoder if already has decoder inside each bit • Don’t need decoder • But even if you remove it, still not quite right for TOY register file: no need to replicate decoders for each bit CS126 12-29 Randy Wang

  31. Outline • Introduction • An S-R Flip-flop • More flip-flops • Registers and register files • Counters • Conclusions CS126 12-30 Randy Wang

  32. 1-Bit Counter Q D C l Q C l interface implementation timing diagram • The behavior of a 1-bit binary counter is a clock whose cycle is twice as long as the input clock CS126 12-31 Randy Wang

  33. N-bit Counter Q n -1 Q 0 Q 1 C l C l C l C l im plem entation output interface Q 2 Q 1 Q 0 T im in g D iagram • n-bit counter: chaining n 1-bit counters together • Recursive! An n-bit counter is made by gluing one extra bit to an (n-1) bit counter CS126 12-32 Randy Wang

  34. Outline • Introduction • An S-R Flip-flop • More flip-flops • Registers and register files • Counters • Conclusions CS126 12-33 Randy Wang

  35. High-Level View of Computer “Memory” “Control” “Data” • Computer: “memory” state with feedback, clocked • Each clock enables changes in memory state • Combinational logic (topic of last lecture) employed to specify what changes to make in response to inputs and past history CS126 12-34 Randy Wang

  36. What We Have Learned Today • Flip-flops ([S-R, D], [unclocked, clocked, master-slave, edge triggered]) - Their behavior (timing diagrams, truth tables, characteristic equations) - How they are made • Some sequential devices (registers, register files, counters) - Their behavior - How they are made CS126 12-35 Randy Wang

Recommend


More recommend