Lecture 11 Registers and Counters

Slides:



Advertisements
Similar presentations
©2004 Brooks/Cole FIGURES FOR CHAPTER 12 REGISTERS AND COUNTERS Click the mouse to move to the next page. Use the ESC key to exit this chapter. This chapter.
Advertisements

CDA 3100 Recitation Week 11.
Lecture 23: Registers and Counters (2)
Registers and Counters
Table 7.1 Verilog Operators.
//HDL Example 5-1 // //Description of D latch (See Fig.5-6) module D_latch (Q,D,control); output Q; input.
Verilog. 2 Behavioral Description initial:  is executed once at the beginning. always:  is repeated until the end of simulation.
//HDL Example 6-1 // //Behavioral description of //Universal shift register // Fig. 6-7 and Table 6-3 module shftreg.
Registers and Counters
Logic and Computer Design Fundamentals Registers and Counters
ECE C03 Lecture 91 Lecture 9 Registers, Counters and Shifters Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
KU College of Engineering Elec 204: Digital Systems Design
A.Abhari CPS2131 Registers A register is a group of n flip-flops each of them capable of storing one bit of information There are two types of registers:
Registers and Counters
Unit 12 Registers and Counters Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh.
Unit 12 Registers and Counters Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh.
CHAPTER 12 REGISTERS AND COUNTERS
Registers & Counters M. Önder Efe
Registers and Counters
Rabie A. Ramadan Lecture 3
2017/4/24 CHAPTER 6 Counters Chapter 5 (Sections )
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 17 Dr. Shi Dept. of Electrical and Computer Engineering.
Digital Design Lectures 11 & 12 Shift Registers and Counters.
7-6 단일 레지스터에서 Microoperation Multiplexer-Based Transfer  Register 가 서로 다른 시간에 둘 이상의 source 에서 data 를 받을 경우 If (K1=1) then (R0 ←R1) else if (K2=1) then.
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.
Chap 5. Registers and Counters. Chap Definition of Register and Counter l a clocked sequential circuit o consist of a group of flip-flops & combinational.
Chapter 1_4 Part III more on … Counters Chapter 1_4 Part III more on … Counters.
REGISTER A register is a group of flip-flops. Each flip- flop is capable of storing one bit of informa­ tion. An n-bit register consists of a group of.
Registers and Counters
Chapter 8 Solving Larger Sequential Problems.
DIGITAL COMPONENTS. MULTIPLEXERS A multiplexer is a combinational circuit that receives binary information from one of 2 n input data lines and directs.
1 CS 352 Introduction to Logic Design Lecture 6 Ahmed Ezzat Latches, Flip/Flops, Registers, and Counters Ch-11 + Ch-12.
1 Registers A register is a group of n flip-flops each of them capable of storing one bit of information There are two types of registers: parallel and.
1 CHAPTER 12 REGISTERS AND COUNTERS This chapter in the book includes: Objectives Study Guide 12.1Registers and Register Transfers 12.2Shift Registers.
Lecture 10 Flip-Flops/Latches
FLIP FLOPS Binary unit capable of storing one bit – 0 or 1
Supplement on Verilog FF circuit examples
Figure 8.1. The general form of a sequential circuit.
Registers and Counters
Lecture 12 Analysis of Clocked Sequential Network
HDL for Sequential Circuits
Supplement on Verilog Sequential circuit examples: FSM
Analysis of Clocked Sequential Circuit
EKT 221 – Counters.
EKT 221 : Digital 2 COUNTERS.
Figure 12-13: Synchronous Binary Counter
SLIDES FOR CHAPTER 12 REGISTERS AND COUNTERS
DIGITAL 2 : EKT 221 RTL : Microoperations on a Single Register
Lecture 16 Arithmetic Circuits
Instructor: Alexander Stoytchev
Digital System Design Review.
Registers and Counters
Registers and Counters Register : A Group of Flip-Flops. N-Bit Register has N flip-flops. Each flip-flop stores 1-Bit Information. So N-Bit Register Stores.
CS Fall 2005 – Lec. #5 – Sequential Logic - 1
COE 202: Digital Logic Design Sequential Circuits Part 4
Chapter 5 Synchronous Sequential Logic 5-1 Sequential Circuits
29-Nov-18 Counters Chapter 5 (Sections ).
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN
Registers and Register Transfers
CSE 370 – Winter Sequential Logic-2 - 1
332:437 Lecture 8 Verilog and Finite State Machines
COE 202 Introduction to Verilog
6. Registers and Counters
Supplement on Verilog Sequential circuit examples: FSM
Digital Logic Department of CNET Chapter-6
Digital Logic Department of CNET Chapter-6
Outline Registers Counters 5/11/2019.
332:437 Lecture 8 Verilog and Finite State Machines
COE 202: Digital Logic Design Sequential Circuits Part 3
Presentation transcript:

Lecture 11 Registers and Counters Registers can be formed by a group of D flip-flops with a common clock. Chap 12

Data Transfer btw Registers Bus is a group of wires. Load: write control Chap 12

Register with Tri-State Output Physically connected, electrically disconnected. Chap 12

Tri-State Bus Physically connected, electrically disconnected. LdH Chap 12

Accumulator Accumulator is a register. One operand is in the accumulator. Ad signal is used to load the adder outputs into the Acc FF on the rising clock edge. Chap 12

An Accumulator Cell How to load the first operand? Ld is used to select y which is loaded into the accumulator flip-flop. Chap 12

Shift Registers Right shift When enabled, shift occurs on the rising edge. The output loaded into each FF is the value before the rising clock edge because of the propagation delay. Chap 12

Shift Register Timing The output loaded into each FF is the value before the rising clock edge If initial value = 0101, and serial input = 1101, then 0101 -> 1010 -> 1101 .. 2 1 4 6 7 3 5 Chap 12

Parallel-in Parallel-out Right Shift Register All 4 bits can be loaded or read out at the same time. Chap 12

Parallel-in Parallel-out Right Shift Register Next state table Next state equation Q3+ = sh’L’Q3 + sh’L.D3 + sh.SI Chap 12

Shift Register with Feedback Initial state = 000 After the rising clock edge, the state is 100 If the register is in 010, the next state is 101. Not in the main loop. This is a counter. Chap 12

Synchronous Counter Synchronous counter FFs are synchronized by a common input pulse. Example: Construct a binary counter using three T FF to count pulses. 000, 001, 010, 011, 100, 101, 110, 111, 000 ….. Chap 12

Synchronous Binary Counter 000, 001, 010, 011, 100, 101, 110, 111, 000 ….. TC, TB, TA A changes whenever a rising clock edge occurs. B changes when A = 1. C changes when B = 1 and A = 1 and a rising clock edge occurs. Chap 12

Synchronous Binary Counter Using a state table to design the counter. Whenever A and A+ differs, FF A must change state, thus TA = 1 If B and B+ differs, TB = 1, etc. If CBA = 011, C+B+A+ = 100, then TCTBTA = 111. (TC = f (A,B,C), etc) That is, if T FF changes state (Q+ ≠Q), T must be 1. Chap 12

Synchronous Binary Counter (cont.) TC, TB, TA (flip flop inputs) as function of A,B,C Because we have A, B, C as they are, TA, TB, TC are the results of (A,B,C) in order to get what we want in A+, B+, C+). Therefore TA, TB, TC are functions of A, B, C. Consider TA, TB, TC as multiple output From K-map :TC= BA, TB = A, TA = 1 Chap 12

000 to 111 counter Use D FFs DA = A+ = A’ DB = B+ = B xor A DC = C+ = C xor BA B changes state when A=1 C changes state when AB = 1 Chap 12

Binary Counter with D FFs DA = A+ = A’ = 1 xor A DB = B+ = B xor A DC = C+ = C xor BA C changes state when AB = 1 Chap 12

Up-Down Counter State transition Use D FFs U and D can not both equal 1 at the same time. For D=1, B changes state when A = 0 For U=1, B changes state when A = 1 Chap 12

Up-Down Counter Construct a truth table A+ = function (C, B, A, U, D) Then simplify this function for A+ Or observe the table: When U = 1 or D = 1, A+ = A’. When U = 0, D = 0, A remains unchanged. Thus A+ = A’U + A’D + AU’D’ Or A+ = A’(U +D) + A(U+D)’ U = 1 or D = 1, A+ = A’. U = 0 and D = 0, A+ = A. Chap 12

Up-Down Counter DA = A+ = A xor (U + D) DB = B+ = B xor (UA + DA’) DC = C+ = C xor (UBA + DB’A’) Homework: find B+ and C+. When D or U =1, change State. Chap 12

Loadable Counter When Load (Ld=1), data is loaded into the counter on the rising clock edge. When Ct = 1, the counter is incremented on the rising clock edge. Ld’Ct changes state. Chap 12

Loadable Counter When Ld=1, Dins are selected and clocked in since the output of each AND gate is 0. When Ct =1, Ld=0, it becomes equivalent to the UP counter. DA = A+ =(Ld’.A + Ld.DAin) xor Ld’.Ct DB = B+ =(Ld’.B + Ld.DBin) xor Ld’.CtA DC = C+ =(Ld’.C + Ld.DCin) xor Ld’.CtAB Chap 12 Ld’.Ct

Counters with Non-Binary Sequence State graph The next state of 000 is 100. 001 has no next state from the graph. Chap 12

Counters with Non-Binary Sequence (cont.) Alternatively, we use Next-state maps (Q+) to find TC, TB, TA. In C+ map (000), when C = 0, C+ =1, so TC = 1. T = 1 whenever Q+ ≠ Q. Chap 12

Counters with Non-Binary Sequence (cont.) Using clocked T FF. Next-state maps T = 1 whenever Q+ ≠ Q, which means T = Q+ ⊕ Q. T = Q+ T = (Q+)’ Chap 12

Counters with Non-Binary Sequence (cont.) The resultant circuit and timing diagram. Chap 12

Counters with Non-Binary Sequence (cont.) Summary of procedure Form a state table of Q and Q+ Plot Q+ map with respect to Q. Plot T map w.r.t Q. TQ map is formed from the Q+ map by complementing the Q = 1 entries and leaving Q = 0 entries unchanged. Find input equation of each T using the TQ map. Chap 12

Counter Using S-R FF S-R Table Problem ( the same counter) Get SA from Table 12-5 (c) Chap 12

Counter Using S-R FF Get K-map ( of SA, RA, etc) from state table. Problem ( the same counter Fig 12-21) Chap 12

Counter Using Clocked J-K FF Procedure is similar to S-R FF. Chap 12

Counter Using Clocked J-K FF (cont.) Find J-K input equations Chap 12

n-bit register module regn (D, Clock, Resetn, Q); parameter n = 16; input [n-1:0] D; input Clock, Resetn; output reg [n-1:0] Q;   always @(negedge Resetn, posedge Clock) if (!Resetn) Q <= 0; else Q <= D; endmodule Naming: Resetn 16 bits here Asynchronous clear

Shift Register module shift4 (R, L, Din, Clock, Q); input [3:0] R; DFF 2 Q2 DFF 3 D Q3 DFF 0 Q1 Din Q0 module shift4 (R, L, Din, Clock, Q); input [3:0] R; input L, Din, Clock; output reg [3:0] Q;   always @(posedge Clock) if (L) Q <= R; else begin Q[0] <= Q[1]; Q[1] <= Q[2]; Q[2] <= Q[3]; Q[3] <= Din; end endmodule  L: load register with input. Non-blocking statements, so that value before clock edge is shifted into the destination bit, at the end of the always block.

Up Counter with enable module upcount (Resetn, Clock, E, Q); input Resetn, Clock, E; output reg [3:0] Q; always @(negedge Resetn, posedge Clock) if (!Resetn) Q <= 0; else if (E) Q <= Q + 1; endmodule If not reset, at rising edge and enabled, increment the counter by 1

Up/down Counter with enable module UDcount (R, Clock, L, E, up_down, Q); parameter n = 8; input [n-1:0] R; input Clock, L, E, up_down; output reg [n-1:0] Q; always @(posedge Clock) if (L) Q <= R; else if (E) Q <= Q + (up_down ? 1 : -1); endmodule Q <= Q+1 Q <= Q-1

FF with an enable module rege (D, Clock, Resetn, E, Q); input D, Clock, Resetn, E; output reg Q;   always @(posedge Clock, negedge Resetn) if (Resetn == 0) Q <= 0; else if (E) Q <= D; endmodule