Figure 7.1. Control of an alarm system. Memory element Alarm Sensor Reset Set OnOff 

Slides:



Advertisements
Similar presentations
Table 7.1 Verilog Operators.
Advertisements

//HDL Example 6-1 // //Behavioral description of //Universal shift register // Fig. 6-7 and Table 6-3 module shftreg.
Changes in input values are reflected immediately (subject to the speed of light and electrical delays) on the outputs Each gate has an associated “electrical.
Flip-Flops, Registers, Counters, and a Simple Processor
Digital Electronics Chapter 5 Synchronous Sequential Logic.
EE2420 – Digital Logic Summer II 2013
1 Sequential Circuits Dr. Pang. 2 Outline Introduction to sequential circuits Basic latch Gated SR latch and gated D latch D flip-flop, T flip-flop, JK.
EKT 124 / 3 DIGITAL ELEKTRONIC 1
Registers and Counters
Counters Discussion 12.1 Example 33. Counters 3-Bit, Divide-by-8 Counter 3-Bit Behavioral Counter in Verilog Modulo-5 Counter An N-Bit Counter.
Registers and Counters
Chapter 3: Sequential Logic Circuit EKT 121 / 4 ELEKTRONIK DIGIT 1.
Lecture 21 Overview Counters Sequential logic design.
A State Element “Zoo”.
Registers and Counters
Chapter 1_4 Part II Counters
ECE 301 – Digital Electronics Flip-Flops and Registers (Lecture #15)
EE24C Digital Electronics Projects
© The McGraw-Hill Companies, Inc McGraw-Hill 1 PRINCIPLES AND APPLICATIONS OF ELECTRICAL ENGINEERING THIRD EDITION G I O R G I O R I Z Z O N I 14.
CHAPTER 12 REGISTERS AND COUNTERS
Registers & Counters M. Önder Efe
Figure 6.1. A 2-to-1 multiplexer.
Registers CPE 49 RMUTI KOTAT.
Figure A flip-flop with an enable input. D Q Q Q R Clock E 0 1.
1 Sequential Logic Lecture #7. 모바일컴퓨팅특강 2 강의순서 Latch FlipFlop Shift Register Counter.
Unit 11 Latches and Flip-Flops Fundamentals of Logic Design By Roth and Kinney.
Digital Design Lectures 11 & 12 Shift Registers and Counters.
Instructor: Alexander Stoytchev CprE 281: Digital Logic.
ENG241 Digital Design Week #8 Registers and Counters.
Registers and Counters Chapter 6. Digital Circuits 2 Clocked sequential circuits a group of flip-flops and combinational gates connected to form a feedback.
Instructor: Alexander Stoytchev CprE 281: Digital Logic.
Instructor: Alexander Stoytchev CprE 281: Digital Logic.
1 COMP541 Sequential Circuits Montek Singh Feb 1, 2012.
Please see “portrait orientation” PowerPoint file for Appendix A Figure A.1. Light switch example.
Figure 7.6. Gated SR latch. (a) Circuit Q Q R S R S R Clk Q Q S Time (c) Timing diagram Clk ? ? SR xx Q(t) (no change) 0 1.
Instructor: Alexander Stoytchev CprE 281: Digital Logic.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust.
Digital Electronics.
Instructor: Alexander Stoytchev CprE 281: Digital Logic.
EKT 121 / 4 ELEKTRONIK DIGIT I
ECE/CS 352 Digital System Fundamentals© T. Kaminski & C. Kime 1 ECE/CS 352 Digital Systems Fundamentals Fall 2000 Chapter 5 – Part 2 Tom Kaminski & Charles.
SYEN 3330 Digital SystemsJung H. Kim 1 SYEN 3330 Digital Systems Chapter 7 – Part 2.
Chap 5. Registers and Counters
Instructor: Alexander Stoytchev CprE 281: Digital Logic.
Instructor: Alexander Stoytchev CprE 281: Digital Logic.
Counters and registers Eng.Maha Alqubali. Registers Registers are groups of flip-flops, where each flip- flop is capable of storing one bit of information.
Dept. of Electrical Engineering
Instructor: Alexander Stoytchev CprE 281: Digital Logic.
CHAPTER 14 Digital Systems. Figure 14.1 RS flip-flop symbol and truth table Figure
1 CS 352 Introduction to Logic Design Lecture 6 Ahmed Ezzat Latches, Flip/Flops, Registers, and Counters Ch-11 + Ch-12.
1 CHAPTER 12 REGISTERS AND COUNTERS This chapter in the book includes: Objectives Study Guide 12.1Registers and Register Transfers 12.2Shift Registers.
1 Modeling Synchronous Logic Circuits Debdeep Mukhopadhyay Associate Professor Dept of Computer Science and Engineering NYU Shanghai and IIT Kharagpur.
Fundamentals of Digital System Design Pradondet Nilagupta Lecture 7: Flip-flops, Registers, Counters Chapter 7.
Figure Implementation of an FSM in a CPLD..
Digital Design: With an Introduction to the Verilog HDL, 5e M. Morris Mano Michael D. Ciletti Copyright ©2013 by Pearson Education, Inc. All rights reserved.
Lecture 10 Flip-Flops/Latches
Supplement on Verilog FF circuit examples
Supplement on Verilog for Algorithm State Machine Chart
Figure 8.1. The general form of a sequential circuit.
Lecture 11 Registers and Counters
Figure 7.1 Control of an alarm system
Instructor: Alexander Stoytchev
Instructor: Alexander Stoytchev
Instructor: Alexander Stoytchev
CS Fall 2005 – Lec. #5 – Sequential Logic - 1
Instructor: Alexander Stoytchev
6. Registers and Counters
Instructor: Alexander Stoytchev
14 Digital Systems.
(Sequential-Circuit Building Blocks)
Presentation transcript:

Figure 7.1. Control of an alarm system. Memory element Alarm Sensor Reset Set OnOff 

Figure 7.2. A simple memory element. AB

Figure 7.3. A controlled memory element. AB Output Data Load TG1 TG2

Figure 7.4. A memory element with NOR gates. Reset SetQ

Figure 7.5. A latch built with NOR gates. SRQ a Q b /11/ (a) Circuit(b) Truth table Time R S Q a Q b Q a Q b ? ? (c) Timing diagram R S t 1 t 2 t 3 t 4 t 5 t 6 t 7 t 8 t 9 t 10 (no change)

Figure 7.6. Gated SR latch. Please see “portrait orientation” PowerPoint file for Chapter 7

Figure 7.7. Gated SR latch with NAND gates. S R Clk Q Q

Figure 7.8. Gated D latch. Please see “portrait orientation” PowerPoint file for Chapter 7

Figure 7.9. Setup and hold times. t su t h Clk D Q

Figure Master-slave D flip-flop. Please see “portrait orientation” PowerPoint file for Chapter 7

Figure A positive-edge-triggered D flip-flop. D Clock P4 P3 P1 P (a) Circuit D Q Q (b) Graphical symbol Clock Q Q 4

Figure Comparison of level-sensitive and edge-triggered. Please see “portrait orientation” PowerPoint file for Chapter 7

Figure Master-slave D flip-flop with Clear and Preset. Q Q D Clock (a) Circuit D Q Q Preset Clear (b) Graphical symbol Clear Preset

Figure Positive-edge-triggered D flip-flop with Clear and Preset. Please see “portrait orientation” PowerPoint file for Chapter 7

Figure Synchronous reset for a D flip-flop.

Figure T flip-flop. Please see “portrait orientation” PowerPoint file for Chapter 7

Figure JK flip-flop. D Q Q Q Q J Clock (a) Circuit JQ Q K 0 1 Qt1+  Qt  0 (b) Truth table(c) Graphical symbol K J Qt  1 K

Figure A simple shift register. D Q Q Clock D Q Q D Q Q D Q Q In Out t 0 t 1 t 2 t 3 t 4 t 5 t 6 t Q 1 Q 2 Q 3 Q 4 = In (b) A sample sequence (a) Circuit Q 1 Q 2 Q 3 Q 4

Figure Parallel access shift register. Q 3 Q 2 Q 1 Q 0 Clock Parallel input Parallel output Shift/Load Serial input D Q Q D Q Q D Q Q D Q Q

Figure A three-bit up-counter. T Q Q Clock T Q Q T Q Q 1 Q 0 Q 1 Q 2 (a) Circuit Clock Q 0 Q 1 Q 2 Count (b) Timing diagram

Figure A three-bit down-counter. T Q Q Clock T Q Q T Q Q 1 Q 0 Q 1 Q 2 (a) Circuit Clock Q 0 Q 1 Q 2 Count (b) Timing diagram

Table 7.1. Derivation of the synchronous up-counter Clock cycle 0080 Q 2 Q 1 Q 0 Q 1 changes Q 2

Figure A four-bit synchronous up-counter. T Q Q Clock T Q Q T Q Q 1 Q 0 Q 1 Q 2 (a) Circuit Clock Q 0 Q 1 Q 2 Count (b) Timing diagram T Q Q Q 3 Q

Figure Inclusion of Enable and Clear capability. T Q Q Clock T Q Q Enable Clear T Q Q T Q Q

Figure A four-bit counter with D flip-flops. Please see “portrait orientation” PowerPoint file for Chapter 7

Figure A counter with parallel-load capability. Please see “portrait orientation” PowerPoint file for Chapter 7

Figure A modulo-6 counter with synchronous reset. Enable Q 0 Q 1 Q 2 D 0 D 1 D 2 Load Clock Count Q 0 Q 1 Q 2 (a) Circuit (b) Timing diagram

Figure A modulo-6 counter with asynchronous reset. T Q Q Clock T Q Q T Q Q 1 Q 0 Q 1 Q 2 (a) Circuit Clock Q 0 Q 1 Q 2 Count (b) Timing diagram

Figure A two-digit BCD counter. Enable Q 0 Q 1 Q 2 D 0 D 1 D 2 Load Clock Q 3 0 D 3 Enable Q 0 Q 1 Q 2 D 0 D 1 D 2 Load Clock Q 3 0 D 3 BCD 0 1 Clear

Figure Ring counter. Please see “portrait orientation” PowerPoint file for Chapter 7

Figure Johnson counter. D Q Q Clock D Q Q D Q Q Q 0 Q 1 Q n1– Reset

Figure Three types of storage elements in a schematic.

Figure Gated D latch generated by CAD tools. Data Clock Latch

Figure Implementation of a circuit in a CPLD. Please see “portrait orientation” PowerPoint file for Chapter 7

Figure Timing simulation of storage elements.

Figure Code for a gated D latch. module D_latch (D, Clk, Q); input D, Clk; output Q; reg Q; or Clk) if (Clk) Q = D; endmodule

Figure Code for a D flip-flop. module flipflop (D, Clock, Q); input D, Clock; output Q; reg Q; Clock) Q = D; endmodule

Figure Incorrect code for two cascaded flip-flops. module example7_3 (D, Clock, Q1, Q2); input D, Clock; output Q1, Q2; reg Q1, Q2; Clock) begin Q1 = D; Q2 = Q1; end Endmodule

Figure Circuit for Example 7.3.

Figure Code for two cascaded flip-flops. module example7_4 (D, Clock, Q1, Q2); input D, Clock; output Q1, Q2; reg Q1, Q2; Clock) begin Q1 <= D; Q2 <= Q1; end endmodule

Figure Circuit defined in Figure 7.39.

Figure Code for Example 7.5. module example7_5 (x1, x2, x3, Clock, f, g); input x1, x2, x3, Clock; output f, g; reg f, g; Clock) begin f = x1 & x2; g = f | x3; end endmodule

Figure Circuit for Example 7.5.

Figure Code for Example 7.6. module example7_6 (x1, x2, x3, Clock, f, g); input x1, x2, x3, Clock; output f, g; reg f, g; Clock) begin f <= x1 & x2; g <= f | x3; end endmodule

Figure Circuit for Example 7.6.

Figure D flip-flop with asynchronous reset. module flipflop (D, Clock, Resetn, Q); input D, Clock, Resetn; output Q; reg Q; Resetn or posedge Clock) if (!Resetn) Q <= 0; else Q <= D; endmodule

Figure D flip-flop with synchronous reset. module flipflop (D, Clock, Resetn, Q); input D, Clock, Resetn; output Q; reg Q; Clock) if (!Resetn) Q <= 0; else Q <= D; endmodule

Figure The lpm_ff parameterized flip-flop module.

Figure An adder with registered feedback.

Figure Timing simulation.

Figure Instantiation of the lpm_shiftreg module. module shift (Clock, Reset, w, Load, R, Q); input Clock, Reset, w, Load; input [3:0] R; output [3:0] Q ; lpm_shiftreg shift_right (.data(R),.aclr(Reset),.clock(Clock),.load(Load),.shiftin(w),.q(Q)); defparam shift_right.lpm_width = 4; defparam shift_right.lpm_direction = "RIGHT"; endmodule

Figure Code for an n-bit register with asynchronous clear. module regn (D, Clock, Resetn, Q); parameter n = 16; input [n-1:0] D; input Clock, Resetn; output [n-1:0] Q; reg [n-1:0] Q; Resetn or posedge Clock) if (!Resetn) Q <= 0; else Q <= D; endmodule

Figure Code for a D flip-flop with a 2-to-1 multiplexer on the D input. module muxdff (D0, D1, Sel, Clock, Q); input D0, D1, Sel, Clock; output Q; reg Q; Clock) if (!Sel) Q <= D0; else Q <= D1; endmodule

Figure Hierarchical code for a four-bit shift register. module shift4 (R, L, w, Clock, Q); input [3:0] R; input L, w, Clock; output [3:0] Q; wire [3:0] Q; muxdff Stage3 (w, R[3], L, Clock, Q[3]); muxdff Stage2 (Q[3], R[2], L, Clock, Q[2]); muxdff Stage1 (Q[2], R[1], L, Clock, Q[1]); muxdff Stage0 (Q[1], R[0], L, Clock, Q[0]); endmodule

Figure Alternative code for a four-bit shift register. module shift4 (R, L, w, Clock, Q); input [3:0] R; input L, w, Clock; output [3:0] Q; reg [3:0] Q; Clock) if (L) Q <= R; else begin Q[0] <= Q[1]; Q[1] <= Q[2]; Q[2] <= Q[3]; Q[3] <= w; end endmodule

Figure An n-bit shift register. module shiftn (R, L, w, Clock, Q); parameter n = 16; input [n-1:0] R; input L, w, Clock; output [n-1:0] Q; reg [n-1:0] Q; integer k; Clock) if (L) Q <= R; else begin for (k = 0; k < n-1; k = k+1) Q[k] <= Q[k+1]; Q[n-1] <= w; end endmodule

module upcount (Resetn, Clock, E, Q); input Resetn, Clock, E; output [3:0] Q; reg [3:0] Q; Resetn or posedge Clock) if (!Resetn) Q <= 0; else if (E) Q <= Q + 1; endmodule Figure Code for a four-bit up-counter.

module upcount (R, Resetn, Clock, E, L, Q); input [3:0] R; input Resetn, Clock, E, L; output [3:0] Q; reg [3:0] Q; Resetn or posedge Clock) if (!Resetn) Q <= 0; else if (L) Q <= R; else if (E) Q <= Q + 1; endmodule Figure A four-bit up-counter with parallel load.

module downcount (R, Clock, E, L, Q); parameter n = 8; input [n-1:0] R; input Clock, L, E; output [n-1:0] Q; reg [n-1:0] Q; Clock) if (L) Q <= R; else if (E) Q <= Q - 1; endmodule Figure A down-counter with a parallel load.

Figure Code for an up/down counter. module updowncount (R, Clock, L, E, up_down, Q); parameter n = 8; input [n-1:0] R; input Clock, L, E, up_down; output [n-1:0] Q; reg [n-1:0] Q; integer direction; Clock) begin if (up_down) direction = 1; else direction = -1; if (L) Q <= R; else if (E) Q <= Q + direction; end endmodule -

Figure A digital system with k registers. R1 in Rk in Bus Clock R1 out R2 in R2 out Rk out Control circuit Function R1R2Rk Data Extern

Figure Details for connecting registers to a bus.

Figure A shift-register control circuit. D Q Q Clock D Q Q D Q Q w R2 out R3 in  Reset R1 out R2 in  R3 out R1 in 

Figure A modified control circuit. D Q Q Clock D Q Q D Q Q w R2 out R3 in  R1 out R2 in  R3 out R1 in  P Reset

Figure A control circuit that does not require flip-flop preset inputs. D Q Q Clock D Q Q D Q Q w R2 out R3 in  R1 out R2 in  R3 out R1 in  Reset

Figure Using multiplexers to implement a bus. Data R1 in Multiplexers R2 in Rk in Bus Clock S j1– S 0 R1R2Rk

module regn (R, Rin, Clock, Q); parameter n = 8; input [n-1:0] R; input Rin, Clock; output [n-1:0] Q; reg [n-1:0] Q; Clock) if (Rin) Q <= R; endmodule Figure Code for an n-bit register of the type in Figure 7.61.

module trin (Y, E, F); parameter n = 8; input [n-1:0] Y; input E; output [n-1:0] F; wire [n-1:0] F; assign F = E ? Y : 'bz; endmodule Figure Code for an n-bit tri-state module.

module shiftr (Resetn, w, Clock, Q); parameter m = 4; input Resetn, w, Clock; output [1:m] Q; reg [1:m] Q; integer k; Resetn or posedge Clock) if (!Resetn) Q <= 0; else begin for (k = m; k > 1; k = k-1) Q[k] <= Q[k-1]; Q[1] <= w; end endmodule Figure Code for the shift register in Figure 7.62.

Figure A digital system like the one in Figure Please see “portrait orientation” PowerPoint file for Chapter 7

Figure Using multiplexers to implement a bus. Please see “portrait orientation” PowerPoint file for Chapter 7

Figure A simplified version of the specification in Figure Please see “portrait orientation” PowerPoint file for Chapter 7

Figure Timing simulation.

Figure A digital system that implements a simple processor.

Table 7.2. Operations performed in the processor.

Figure A part of the control circuit for the processor. Reset Up-counter Clear w 0 En y 0 w 1 y 1 y 2 y 3 1 T 1 T 2 T 3 2-to-4 decoder Q 1 Q 0 Clock T 0

Figure The function register and decoders. Clock X 0 w 0 En y 0 w 1 y 1 y 2 y 3 1 X 1 X 2 X 3 2-to-4 decoder Function Register Y 0 w 0 En y 0 w 1 y 1 y 2 y 3 1 Y 1 Y 2 Y 3 2-to-4 decoder I 0 En y 0 y 1 y 2 y 3 1 I 1 I 2 I 3 2-to-4 decoder FR in f 1 f 0 Rx 1 0 Ry 1 0 w 0 w 1 Function

Table 7.3. Control signals asserted in each operation/time step.

Figure A two-bit up-counter with synchronous reset. module upcount (Clear, Clock, Q); input Clear, Clock; output [1:0] Q; reg [1:0] Q; Clock) if (Clear) Q <= 0; else Q <= Q + 1; endmodule

Figure Code for the processor. Please see “portrait orientation” PowerPoint file for Chapter 7

Figure Alternative code for the processor. Please see “portrait orientation” PowerPoint file for Chapter 7

Figure Timing simulation of the processor.

Figure A reaction-timer circuit. Please see “portrait orientation” PowerPoint file for Chapter 7

Figure Code for the two-digit BCD counter in Figure Please see “portrait orientation” PowerPoint file for Chapter 7

module reaction (c9, Reset, w, Pushn, LEDn, Digit1, Digit0); input c9, Reset, w, Pushn; output LEDn; output [1:7] Digit1, Digit0; wire LEDn; wire [1:7] Digit1, Digit0; reg LED; wire [3:0] BCD1, BCD0; c9) begin if (Pushn == 0) LED <= 0; else if (w) LED <= 1; end assign LEDn = ~LED; BCDcount counter (c9, Reset, LED, BCD1, BCD0); seg7 seg1 (BCD1, Digit1); seg7 seg0 (BCD0, Digit0); endmodule Figure Code for the reaction timer.

Figure Simulation of the reaction-timer circuit.

Figure P7.1. Timing diagram for problem 7.1. D Clock

Figure P7.2. Circuit for problem 7.9.

Figure P7.3. The circuit for problem T Q Q 1 T Q Q T Q Q Q 0 Q 1 Q 2 Clock

Figure P7.4. The circuit for problem Clock SQ Q Clk R SQ Q R Q Q J K

Figure P7.5. A ring oscillator. f

Figure P7.6. Timing of signals for problem Reset Interval 100 ns

Figure P7.7. Circuit and timing diagram for problem Q Clock D Q A A D Q

Figure P7.8. Timing diagram for problem g f Start Clock

Figure P7.9. Code for a linear-feedback shift register. module lfsr (R, L, Clock, Q); input [0:2] R; input L, Clock; output [0:2] Q; reg [0:2] Q; Clock) if (L) Q <= R; else Q <= {Q[2], Q[0] ^ Q[2], Q[1]}; endmodule

Figure P7.10. Code for a linear-feedback shift register. module lfsr (R, L, Clock, Q); input [0:2] R; input L, Clock; output [0:2] Q; reg [0:2] Q; Clock) if (L) Q <= R; else Q <= {Q[2], Q[0], Q[1] ^ Q[2]}; endmodule

Figure P7.11. Code for problem module lfsr (R, L, Clock, Q); input [0:2] R; input L, Clock; output [0:2] Q; reg [0:2] Q; Clock) if (L) Q <= R; else begin Q[0] = Q[2]; Q[1] = Q[0] ^ Q[2]; Q[2] = Q[1]; end endmodule

Figure P7.12. Code for problem module lfsr (R, L, Clock, Q); input [0:2] R; input L, Clock; output [0:2] Q; reg [0:2] Q; Clock) if (L) Q <= R; else begin Q[0] = Q[2]; Q[1] = Q[0]; Q[2] = Q[1] ^ Q[2]; end endmodule