Registers & Counters



Similar documents
To design digital counter circuits using JK-Flip-Flop. To implement counter using 74LS193 IC.

ETEC 2301 Programmable Logic Devices. Chapter 10 Counters. Shawnee State University Department of Industrial and Engineering Technologies

ECE 451 Verilog Exercises. Sept 14, James Barnes

Lab #5: Design Example: Keypad Scanner and Encoder - Part 1 (120 pts)

Module 3: Floyd, Digital Fundamental

Chapter 7. Registers & Register Transfers. J.J. Shann. J. J. Shann

Modeling Sequential Elements with Verilog. Prof. Chien-Nan Liu TEL: ext: Sequential Circuit

WEEK 8.1 Registers and Counters. ECE124 Digital Circuits and Systems Page 1

Modeling Registers and Counters

Counters & Shift Registers Chapter 8 of R.P Jain

Design Example: Counters. Design Example: Counters. 3-Bit Binary Counter. 3-Bit Binary Counter. Other useful counters:

DIGITAL COUNTERS. Q B Q A = 00 initially. Q B Q A = 01 after the first clock pulse.

Asynchronous counters, except for the first block, work independently from a system clock.

Asynchronous Counters. Asynchronous Counters

More Verilog. 8-bit Register with Synchronous Reset. Shift Register Example. N-bit Register with Asynchronous Reset.

CHAPTER IX REGISTER BLOCKS COUNTERS, SHIFT, AND ROTATE REGISTERS

Digital Logic Design Sequential circuits

Cascaded Counters. Page 1 BYU

Flip-Flops and Sequential Circuit Design. ECE 152A Winter 2012

Flip-Flops and Sequential Circuit Design

Counters and Decoders

A Lesson on Digital Clocks, One Shots and Counters

Decimal Number (base 10) Binary Number (base 2)

A Lesson on Digital Clocks, One Shots and Counters

Memory Elements. Combinational logic cannot remember

Digital Systems Based on Principles and Applications of Electrical Engineering/Rizzoni (McGraw Hill

Latches, the D Flip-Flop & Counter Design. ECE 152A Winter 2012

Experiment # 9. Clock generator circuits & Counters. Eng. Waleed Y. Mousa

Chapter 7: Advanced Modeling Techniques

LAB #4 Sequential Logic, Latches, Flip-Flops, Shift Registers, and Counters

Contents COUNTER. Unit III- Counters

Counters. Present State Next State A B A B

Design: a mod-8 Counter

Systems I: Computer Organization and Architecture

Wiki Lab Book. This week is practice for wiki usage during the project.

DIGITAL ELECTRONICS. Counters. By: Electrical Engineering Department

DIGITAL TECHNICS II. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute. 2nd (Spring) term 2012/2013

Lesson 12 Sequential Circuits: Flip-Flops

74LS193 Synchronous 4-Bit Binary Counter with Dual Clock

Combinational Logic Design Process

Engr354: Digital Logic Circuits

Chapter 8. Sequential Circuits for Registers and Counters

Sequential Logic. (Materials taken from: Principles of Computer Hardware by Alan Clements )

Finite State Machine Design and VHDL Coding Techniques

INTEGRATED CIRCUITS. For a complete data sheet, please also download:

CpE358/CS381. Switching Theory and Logical Design. Class 10

Lecture 8: Synchronous Digital Systems

Counters are sequential circuits which "count" through a specific state sequence.

Digital Logic Design. Basics Combinational Circuits Sequential Circuits. Pu-Jen Cheng

CHAPTER 11: Flip Flops

ECE232: Hardware Organization and Design. Part 3: Verilog Tutorial. Basic Verilog

EXPERIMENT 8. Flip-Flops and Sequential Circuits

Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language

A Verilog HDL Test Bench Primer Application Note

The components. E3: Digital electronics. Goals:

Chapter 9 Latches, Flip-Flops, and Timers

DM74LS193 Synchronous 4-Bit Binary Counter with Dual Clock

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

CHAPTER 11 LATCHES AND FLIP-FLOPS

DIGITAL TECHNICS II. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute 5. LECTURE: REGISTERS AND RELATED

Lecture-3 MEMORY: Development of Memory:

Computer organization

A New Paradigm for Synchronous State Machine Design in Verilog

BINARY CODED DECIMAL: B.C.D.

DM74LS169A Synchronous 4-Bit Up/Down Binary Counter

Memory unit. 2 k words. n bits per word

Layout of Multiple Cells

Sequential Logic Design Principles.Latches and Flip-Flops

ECE380 Digital Logic

Modeling Latches and Flip-flops

NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY

NOTE: The Flatpak version has the same pinouts (Connection Diagram) as the Dual In-Line Package.

Microprocessor & Assembly Language

ASYNCHRONOUS COUNTERS

L4: Sequential Building Blocks (Flip-flops, Latches and Registers)

Flip-Flops, Registers, Counters, and a Simple Processor

Having read this workbook you should be able to: recognise the arrangement of NAND gates used to form an S-R flip-flop.

16-bit ALU, Register File and Memory Write Interface

PROGETTO DI SISTEMI ELETTRONICI DIGITALI. Digital Systems Design. Digital Circuits Advanced Topics

DM74LS191 Synchronous 4-Bit Up/Down Counter with Mode Control

Timing Methodologies (cont d) Registers. Typical timing specifications. Synchronous System Model. Short Paths. System Clock Frequency

FINITE STATE MACHINE: PRINCIPLE AND PRACTICE

CHAPTER 3 Boolean Algebra and Digital Logic

DATA SHEET. HEF40193B MSI 4-bit up/down binary counter. For a complete data sheet, please also download: INTEGRATED CIRCUITS

Sequential Logic: Clocks, Registers, etc.

Chapter 5 :: Memory and Logic Arrays

SN54HC191, SN74HC191 4-BIT SYNCHRONOUS UP/DOWN BINARY COUNTERS

Digital Design with VHDL

COMBINATIONAL and SEQUENTIAL LOGIC CIRCUITS Hardware implementation and software design

Understanding Verilog Blocking and Non-blocking Assignments

An Integer Square Root Algorithm

MAX II ISP Update with I/O Control & Register Data Retention

E158 Intro to CMOS VLSI Design. Alarm Clock

NOTE: The Flatpak version has the same pinouts (Connection Diagram) as the Dual In-Line Package.

Take-Home Exercise. z y x. Erik Jonsson School of Engineering and Computer Science. The University of Texas at Dallas

Asynchronous & Synchronous Reset Design Techniques - Part Deux

Traffic Light Controller. Digital Systems Design. Dr. Ted Shaneyfelt

State Machines in VHDL

路 論 Chapter 15 System-Level Physical Design

Transcription:

Objectives This section deals with some simple and useful sequential circuits. Its objectives are to: Introduce registers as multi-bit storage devices. Introduce counters by adding logic to registers implementing the functional capability to increment and/or decrement their contents. Define shift registers and show how they can be used to implement counters that use the one-hot code. Reading Assignment Sections 4.4 and 5.4. Registers A register is a memory device that can be used to store more than one bit of information. A register is usually realized as several flip-flops with common control signals that control the movement of data to and from the register. Common refers to the property that the control signals apply to all flip-flops in the same way A register is a generalization of a flip-flop. Where a flipflop stores one bit, a register stores several bits The main operations on a register are the same as for any storage devices, namely Load or Store: Put new data into the register Read: Retrieve the data stored in the register (usually without changing the stored data 2

Control Signals When they are asserted, they initiate an action in the register Asynchronous Control Signals cause the action to take place immediately Synchronous Control Signals must be asserted during a clock assertion to have an effect Examples On the following three registers, which control signals are asynchronous and which are synchronous? How are the control signals asserted? 3 D D D D module reg (STO,, D, ); parameter n = 6; input STO, ; input [n-:] D; output [n-:] ; reg [n-:] ; always @(posedge STO or negedge ) if ( ==) <= ; else <= D; D n- D n- STO endmodule 4 2

D K D K D n- n- LD CLK OE K 5 D D D D D D n- n- LD CLK OE 6 3

Verilog description of previous two registers module reg2 (CLK,, LD, OE, D, ); parameter n = 4; input CLK,, LD, OE; input [n-:] D; output [n-:] ; reg [n-:] I, ; integer k; always @(posedge CLK) if () I <= ; else if (LD) I <= D; always @(OE) if (OE) = I; else = 'bz; endmodule 7 2. Counters A counter is a register capable of incrementing and/or decrementing its contents plus n minus n The definition of "plus" and "minus" depend on the way the register contents encode the integers Binary Counters: Encode the integers with the binary number code 8 4

Example: 3-bit binary counter: plus minus Count Sequence Transistion Table 2 3 4 5 6 7 2 3 4 5 6 7 State Table What does the counter count? The output signals are just the state variables 9 Example: 3-bit binary up/down counter TransistionTable Example: Binary mod 6 counter x x x x x x Transistion Table 2 5 4 3 State Diagram 5

Design of a Binary Up Counter i toggles on every clock cycle where j =, for i > j K K K K Binary Up Counter 2 6

Design of a Binary Down Counter i toggles on every clock cycle where j =, for i > j 3 Binary Down Counter 4 7

Synchronous, Series-Carry Binary Counter 2 3 K K K K = K K2 =4 =5 = T W 3 2 t PFF t PG K3 t PG t su T W t PFF + (n-2)t PG + t su (for n 2) 5 Synchronous, Parallel-Carry Binary Counter 2 3 K K K K =4 =5 = 3 2 = K K2 t PFF t PG T W K3 t PG t su T W t PFF + t PG + t su (for n 3) 6 8

Asynchronous Counters K K K K Typical MSI counter chip 74LS63 LD ENP ENT A B C D A B C D RCO LD and are synchronous LD asserted during the rising edge of the clock loads the register from ABCD. asserted during the rising edge of the clock clears the counter overrides LD LD overrides EN R CO = D C B A ENT, used for cascading chips 7 Verilog description of the 74x63 module V74x63 (CLK, _L, LD_L, ENP, ENT, D,, RCO); input CLK, _L, LD_L, ENP, ENT; input [3:] D; output RCO; output [3:] ; reg [3:] ; reg RCO; always @(posedge CLK) if (_L == ) <= 4'b; else if (LD_L == ) <= D; else if (ENT & ENP) <= +; always @( or ENT) if ( == 5 && ENT == ) RCO = ; else RCO = ; endmodule 8 9

Verilog description of an up/down counter module updowncount (R, Clock, L, E, up_down, ); parameter n = 8; input [n-:] R; input Clock, L, E, up_down; output [n-:] ; reg [n-:] ; integer direction; always @(posedge Clock) begin if (up_down) direction = ; else direction = -; if (L) <= R; else if (E) <= - + direction; end endmodule 9 Verilog description of mod-n counters module upmodn (Ck, ); parameter n = 6; input Ck; output [3:] ; reg [3:] ; always @(posedge Ck) if ( == n) <= ; else <= + ; endmodule module dwnmodn (Ck, ); parameter n = 5; input Ck; output [3:] ; reg [3:] ; always @(posedge Ck) if ( == ) <= n; else <= -; endmodule 2

Design of Mod n Counters Mod 6 Up Counter 2 / 2 3 4 5 2 CLK 74LS63 LD ENP ENT A B C D A B C D RCO Mod 5 Down Counter 2 /LD 4 3 2 4 3 2 CLK 74LS69 U/D LD ENP ENT A B C D A B C D RCO 2 Decoding Binary Counter States A B C A B C Y Y Y2 Y3 Y4 Y5 Y6 Y7 /S /S /S2 /S3 /S4 /S5 /S6 /S7 2 /S /S /S2 The decoding spikes are hazzards that can not be designed out The following circuit will mask the decoding spikes, at the cost of delaying the outputs one clock cycle. A B C A B C Y Y Y2 Y3 Y4 Y5 Y6 Y7 REG CLK 22

3. Shift Registers How would you add a control signal to control when the shift register shifted? How would you add parallel input capability and why would you want to? What kind of control signals are needed? Is the shift register drawn above a left shifter or a right shifter? How would you make a shift register that could shift either left or right and what control signals would you need? 23 Example: 74LS94 S S LIN D B C A RIN D C B A S S Action hold shift right shift left load A* B* C* D* A B C D RIN A B C B C D LIN A B C D Shift left is from A to D Shift right is from D to A is asynchronous 24 2

Verilog Description Of A Shift Register module shift4 (D, LD, LI, Ck, ); input [3:] D; input LD, LI, Ck; output [3:] ; reg [3:] ; always @(posedge Ck) if (LD) <= D; else begin [] <= []; [] <= [2]; [2] <= [3]; [3] <= LI; end endmodule 25 Ring Counters 26 3

Self-Correcting Ring Counter 27 ohnson counter, switch-tail counter, moebius counter 28 4

Self-Correcting ohnson Counter Odd Length ohnson Counter This counter is also self-correcting 29 4. Review Register control signals and assertions. Binary counters and their operations. Reset, Load, Output Enable. Counter timing; maximum clock frequency. Mod-n counters Synchronous vs. asynchronous load and reset signals. Shift registers and shift register counters. Ring counters, ohnson counters, etc Self-correcting counters Counter realization of sequential circuits 3 5