Chapter 9: Sequential Logic Modules

Similar documents
Chapter 9: Sequential Logic Modules

Modeling Sequential Circuits in Verilog

Chapter 5: Tasks, Functions, and UDPs

Chapter 6: Hierarchical Structural Modeling

Digital Circuit Design and Language. Datapath Design. Chang, Ik Joon Kyunghee University

Sequential Logic Blocks

Verilog Behavioral Modeling

CSCB58 - Lab 3. Prelab /3 Part I (in-lab) /2 Part II (in-lab) /2 TOTAL /8

Department of Computer Science & Engineering. Lab Manual DIGITAL LAB. Class: 2nd yr, 3rd sem SYLLABUS

Model EXAM Question Bank

EPC6055 Digital Integrated Circuits EXAM 1 Fall Semester 2013

Lecture 3. Behavioral Modeling Sequential Circuits. Registers Counters Finite State Machines

MCMASTER UNIVERSITY EMBEDDED SYSTEMS

Nikhil Gupta. FPGA Challenge Takneek 2012

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

Synthesis of Combinational and Sequential Circuits with Verilog

VALLIAMMAI ENGINEERING COLLEGE. SRM Nagar, Kattankulathur DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING EC6302 DIGITAL ELECTRONICS

EEL 4783: HDL in Digital System Design

Verilog Sequential Logic. Verilog for Synthesis Rev C (module 3 and 4)

Verilog for Synthesis Ing. Pullini Antonio

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1

Digital Design with FPGAs. By Neeraj Kulkarni

ECE 551: Digital System *

Chapter 5 Registers & Counters

EE178 Lecture Verilog FSM Examples. Eric Crabill SJSU / Xilinx Fall 2007

Topics. Midterm Finish Chapter 7

CSE140L: Components and Design Techniques for Digital Systems Lab

Finite-State Machine (FSM) Design

Digital Integrated Circuits

3. The high voltage level of a digital signal in positive logic is : a) 1 b) 0 c) either 1 or 0

EECS150 - Digital Design Lecture 10 Logic Synthesis

EECS150 - Digital Design Lecture 10 Logic Synthesis

Testbenches for Sequential Circuits... also, Components

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis

CSE140L: Components and Design

Digital Design Using Digilent FPGA Boards -- Verilog / Active-HDL Edition

Why Should I Learn This Language? VLSI HDL. Verilog-2

Modeling Synchronous Logic Circuits. Debdeep Mukhopadhyay IIT Madras

Verilog introduction. Embedded and Ambient Systems Lab

Digital Design (VIMIAA01) Introduction to the Verilog HDL

a, b sum module add32 sum vector bus sum[31:0] sum[0] sum[31]. sum[7:0] sum sum overflow module add32_carry assign

In this lecture, we will focus on two very important digital building blocks: counters which can either count events or keep time information, and

Logic Synthesis. EECS150 - Digital Design Lecture 6 - Synthesis

ECE 574: Modeling and Synthesis of Digital Systems using Verilog and VHDL. Fall 2017 Final Exam (6.00 to 8.30pm) Verilog SOLUTIONS

DIGITAL SYSTEM DESIGN

Amrita Vishwa Vidyapeetham. EC429 VLSI System Design Answer Key

Speaker: Kayting Adviser: Prof. An-Yeu Wu Date: 2009/11/23

Code No: R Set No. 1

Synthesis vs. Compilation Descriptions mapped to hardware Verilog design patterns for best synthesis. Spring 2007 Lec #8 -- HW Synthesis 1

Verilog for High Performance

EE 231 Fall EE 231 Homework 8 Due October 20, 2010

Xilinx ASMBL Architecture

RAM Initialization and ROM Emulation in ProASIC PLUS Devices

Laboratory Exercise 7

Graduate Institute of Electronics Engineering, NTU. Lecturer: Chihhao Chao Date:

Federal Urdu University of Arts, Science and Technology, Islamabad VLSI SYSTEM DESIGN. Prepared By: Engr. Yousaf Hameed.

ECE 4514 Digital Design II. Spring Lecture 15: FSM-based Control

Chapter 10: Design Options of Digital Systems

Verilog Coding Guideline

Blocking(=) vs Nonblocking (<=) Assignment. Lecture 3: Modeling Sequential Logic in Verilog HDL. Procedural assignments

Hardware Description Languages (HDLs) Verilog

Reset-able and Enable-able Registers

Introduction to Verilog HDL. Verilog 1

Registers and finite state machines

Register Transfer Level in Verilog: Part I

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Sciences

Topics. Midterm Finish Chapter 7

Verilog 1 - Fundamentals

INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad ELECTRONICS AND COMMUNICATIONS ENGINEERING

ECE 2300 Digital Logic & Computer Organization. More Verilog Finite State Machines

ECE 4514 Digital Design II. Spring Lecture 13: Logic Synthesis

Homework deadline extended to next friday

Chap 6 Introduction to HDL (d)

Digital Integrated Circuits

ECE 2300 Digital Logic & Computer Organization. More Finite State Machines

MLR Institute of Technology

FSM Components. FSM Description. HDL Coding Methods. Chapter 7: HDL Coding Techniques

Last Lecture: Divide by 3 FSM

Verilog Tutorial. Introduction. T. A.: Hsueh-Yi Lin. 2008/3/12 VLSI Digital Signal Processing 2

CAD for VLSI Design - I. Lecture 21 V. Kamakoti and Shankar Balachandran

Writing Circuit Descriptions 8

Verilog 1 - Fundamentals

VERILOG: FLIP-FLOPS AND REGISTERS

St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

FPGA: FIELD PROGRAMMABLE GATE ARRAY Verilog: a hardware description language. Reference: [1]

Recommended Design Techniques for ECE241 Project Franjo Plavec Department of Electrical and Computer Engineering University of Toronto

ECE 2300 Digital Logic & Computer Organization. More Verilog Finite State Machines

N-input EX-NOR gate. N-output inverter. N-input NOR gate

ECEN 468 Advanced Logic Design

EECS150 - Digital Design Lecture 20 - Finite State Machines Revisited

Workshop on Digital Circuit Design in FPGA

Techniques for Digital Systems Lab. Verilog HDL. Tajana Simunic Rosing. Source: Eric Crabill, Xilinx

L5: Simple Sequential Circuits and Verilog

Verilog HDL: Behavioral Counter

Readings: Storage unit. Can hold an n-bit value Composed of a group of n flip-flops. Each flip-flop stores 1 bit of information.

Synthesis of Language Constructs. 5/10/04 & 5/13/04 Hardware Description Languages and Synthesis

L5: Simple Sequential Circuits and Verilog

Graduate Institute of Electronics Engineering, NTU Design of Datapath Controllers

C A R L E T O N U N I V E R S I T Y. FINAL EXAMINATION April Duration: 3 Hours No. of Students: 108

Verilog Module 1 Introduction and Combinational Logic

Transcription:

Chapter 9: Sequential Logic Modules Prof. Ming-Bo Lin Department of Electronic Engineering National Taiwan University of Science and Technology Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-1

Syllabus Objectives Fundamentals of sequential logic modules Flip-flops Memory elements Shift registers Counters Sequence generators Timing generators Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-2

Objectives After completing this chapter, you will be able to: Describe how to model asynchronous and synchronous D-type flip-flops Describe how to model registers (data register, register file, and synchronous RAM) Describe how to model shift registers Describe how to model counters (ripple/synchronous counters and modulo r counters) Describe how to model sequence generators Describe how to model timing generators Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-3

Syllabus Objectives Fundamentals of sequential logic modules Flip-flops Memory elements Shift registers Counters Sequence generators Timing generators Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-4

Basic Sequential Logic Modules Synchronizer Finite state machine Sequence detector Data register Shift register CRC generator Register file Counters (binary, BCD, Johnson) Timing generator Clock generator Pulse generator Chapter 9: Sequential Logic Modules Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-5

Options for Modeling Sequential Logic Behavioral statement Task with delay or event control Sequential UDP Instantiated library register cell Instantiated modules Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-6

Syllabus Objectives Fundamentals of sequential logic modules Flip-flops Memory elements Shift registers Counters Sequence generators Timing generators Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-7

Asynchronous Reset D-Type Flip-Flops // asynchronous reset D-type flip-flop module DFF_async_reset (clk, reset_n, d, q); output reg q; always @(posedge clk or negedge reset_n) if (!reset_n) q <= 0; else q <= d; Q: How would you model a D-type latch? Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-8

Synchronous Reset D-Type Flip-Flops // synchronous reset D-type flip-flop module DFF_sync_reset (clk, reset, d, q); output reg q; always @(posedge clk) if (reset) q <= 0; else q <= d; Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-9

Syllabus Objectives Fundamentals of sequential logic modules Flip-flops Memory elements Shift registers Counters Sequence generators Timing generators Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-10

Types of Memory Elements Data registers Register files Synchronous RAMs Chapter 9: Sequential Logic Modules Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-11

Registers Registers (or data registers) A flip-flop Area: 10 to 20x of an SRAM cell In Xilinx FPGAs Flip-flops Distributed memory Block memory Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-12

Data Registers // an n-bit data register module register(clk, din, qout); parameter N = 4; // number of bits input [N-1:0] din; output reg [N-1:0] qout; always @(posedge clk) qout <= din; Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-13

Data Registers // an n-bit data register with asynchronous reset module register_reset (clk, reset_n, din, qout); parameter N = 4; // number of bits input [N-1:0] din; output reg [N-1:0] qout; always @(posedge clk or negedge reset_n) if (!reset_n) qout <= {N{1'b0}}; else qout <= din; Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-14

Data Registers // an N-bit data register with synchronous load and // asynchronous reset parameter N = 4; // number of bits input clk, load, reset_n; input [N-1:0] din; output reg [N-1:0] qout; always @(posedge clk or negedge reset_n) if (!reset_n) qout <= {N{1'b0}}; else if (load) qout <= din; Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-15

A Register File // an N-word register file with one-write and two-read ports parameter M = 4; // number of address bits parameter N = 16; // number of words, N = 2**M parameter W = 8; // number of bits in a word input clk, wr_enable; input [W-1:0] din; output [W-1:0] douta, doutb; input [M-1:0] rd_addra, rd_addrb, wr_addr; reg [W-1:0] reg_file [N-1:0]; assign douta = reg_file[rd_addra], doutb = reg_file[rd_addrb]; always @(posedge clk) if (wr_enable) reg_file[wr_addr] <= din; Try to synthesize it and see what happens!! Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-16

An Synchronous RAM // a synchronous RAM module example parameter N = 16; // number of words parameter A = 4; // number of address bits parameter W = 4; // number of wordsize in bits input [A-1:0] addr; input [W-1:0] din; input cs, wr, clk; // chip select, read-write control, and clock signals output reg [W-1:0] dout; reg [W-1:0] ram [N-1:0]; // declare an N * W memory array always @(posedge clk) if (cs) if (wr) ram[addr] <= din; else dout <= ram[addr]; Try to synthesize it and see what happens!! Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-17

Syllabus Objectives Fundamentals of sequential logic modules Flip-flops Memory elements Shift registers Counters Sequence generators Timing generators Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-18

Shift Registers Shift registers Parallel/serial format conversion SISO (serial in serial out) SIPO (serial in parallel out) PISO (parallel in serial out) PIPO (parallel in parallel out) Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-19

Shift Registers Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-20

Shift Registers // a shift register module example module shift_register(clk, reset_n, din, qout); Parameter N = 4; // number of bits. output reg [N-1:0] qout; always @(posedge clk or negedge reset_n) if (!reset_n) qout <= {N{1'b0}}; else qout <= {din, qout[n-1:1]}; Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-21

A Shift Register with Parallel Load Chapter 9: Sequential Logic Modules // a shift register with parallel load module example module shift_register_parallel_load (clk, load, reset_n, din, sin, qout); parameter N = 8; // number of bits. input [N-1:0] din; output reg [N-1:0] qout; always @(posedge clk or negedge reset_n) if (!reset_n) qout <= {N{1'b0}}; else if (load) qout <= din; else qout <= {sin, qout[n-1:1]}; Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-22

Universal Shift Registers A universal shift register can carry out SISO SIPO PISO PIPO The register must have the following capabilities Parallel load Serial in and serial out Shift left and shift right Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-23

Universal Shift Registers Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-24

Universal Shift Registers // a universal shift register module module universal_shift_register (clk, reset_n, s1, s0, ); parameter N = 4; // define the default size always @(posedge clk or negedge reset_n) if (!reset_n) qout <= {N{1'b0}}; else case ({s1,s0}) 2'b00: ; // qout <= qout; // No change 2'b01: qout <= {lsi, qout[n-1:1]}; // Shift right 2'b10: qout <= {qout[n-2:0], rsi}; // Shift left 2'b11: qout <= din; // Parallel load endcase Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-25

Syllabus Objectives Fundamentals of sequential logic modules Flip-flops Memory elements Shift registers Counters Sequence generators Timing generators Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-26

Counters Counter Types Counters Timers Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-27

Types of Counters Types of counters Asynchronous Synchronous Asynchronous (ripple) counters Binary counter (up/down counters) Synchronous counters Binary counter (up/down counters) BCD counter (up/down counters) Gray counters (up/down counters) Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-28

Binary Ripple Counters Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-29

Binary Ripple Counters // a 3-bit ripple counter module example module ripple_counter(clk, qout); output reg [2:0] qout; wire c0, c1; // the body of the 3-bit ripple counter assign c0 = qout[0], c1 = qout[1]; always @(negedge clk) qout[0] <= ~qout[0]; always @(negedge c0) qout[1] <= ~qout[1]; always @(negedge c1) qout[2] <= ~qout[2]; Try to synthesize it and see what happens!! The output cannot be observed from simulators due to lacking initial values of qout. Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-30

Binary Ripple Counters // a 3-bit ripple counter with enable control module ripple_counter_enable(clk, enable, reset_n, qout); output reg [2:0] qout; wire c0, c1; assign c0 = qout[0], c1 = qout[1]; always @(posedge clk or negedge reset_n) if (!reset_n) qout[0] <= 1'b0; else if (enable) qout[0] <= ~qout[0]; always @(posedge c0 or negedge reset_n) if (!reset_n) qout[1] <= 1'b0; else if (enable) qout[1] <= ~qout[1]; always @(posedge c1 or negedge reset_n) if (!reset_n) qout[2] <= 1'b0; else if (enable) qout[2] <= ~qout[2]; Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-31

A Binary Ripple Counter // an N-bit ripple counter using generate blocks parameter N = 4; // define the size of counter output reg [N-1:0] qout; genvar i; generate for (i = 0; i < N; i = i + 1) begin: ripple_counter if (i == 0) // specify LSB always @(negedge clk or negedge reset_n) if (!reset_n) qout[0] <= 1'b0; else qout[0] <= ~qout[0]; else // specify the rest bits always @(negedge qout[i-1]or negedge reset_n) if (!reset_n) qout[i] <= 1'b0; else qout[i] <= ~qout[i]; end endgenerate Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-32

A Binary Counter Example module binary_counter(clk, enable, reset, qout, cout); parameter N = 4; output reg [N-1:0] qout; output cout; // carry output always @(posedge clk) if (reset) qout <= {N{1 b0}}; else if (enable) qout <= qout + 1; // generate carry output assign #2 cout = &qout; // Why #2 is required? Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-33

Binary Up/Down Counters --- version 1 module binary_up_down_counter_reset (clk, enable, reset, upcnt, qout, cout, bout); parameter N = 4; output reg [N-1:0] qout; output cout, bout; // carry and borrow outputs always @(posedge clk) if (reset) qout <= {N{1'b0}}; else if (enable) begin if (upcnt) qout <= qout + 1; else qout <= qout - 1; end assign #2 cout = &qout; // Why #2 is required? assign #2 bout = qout; Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-34

Binary Up/Down Counters --- version 2 module up_dn_bin_counter (clk, reset, eup, edn, qout, cout, bout); Parameter N = 4; output reg [N-1:0] qout; output cout, bout; always @(posedge clk) if (reset) qout <= {N{1'b0}}; // synchronous reset else if (eup) qout <= qout + 1; else if (edn) qout <= qout - 1; assign #1 cout = (&qout)& eup; // generate carry out assign #1 bout = (~ qout)& edn; // generate borrow out Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-35

Binary Up/Down Counters --- version 2 // the cascade of two up/down counters module up_dn_bin_counter_cascaded(clk, reset,eup, ); parameter N = 4; output [2*N-1:0] qout; output cout, bout; wire cout1, bout1; up_dn_bin_counter #(4) up_dn_cnt1 (clk, reset,eup, edn, ); up_dn_bin_counter #(4) up_dn_cnt2 (clk, reset, ); Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-36

A Modulo r Binary Counter Chapter 9: Sequential Logic Modules module modulo_r_counter(clk, enable, reset, qout, cout); parameter N = 4; parameter R= 10; // BCD counter output reg [N-1:0] qout; assign cout = (qout == R - 1); always @(posedge clk) if (reset) qout <= {N{1'b0}}; else begin if (enable) if (cout) qout <= 0; else qout <= qout + 1; end Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-37

Syllabus Objectives Fundamentals of sequential logic modules Flip-flops Memory elements Shift registers Counters Sequence generators Timing generators Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-38

Sequence Generators We only focus on the following three circuits PR (pseudo random)-sequence generator Ring counter Johnson counter Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-39

Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-40 Primitive Polynomials n n n i i i x a x a x a a x a x f + + + + = = = 2 2 1 0 0 ) (

Maximal Length Sequence Generators Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-41

A PR-Sequence Generator Example A 4-bit example primitive polynomial: 1 + x + x 4 Chapter 9: Sequential Logic Modules Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-42

A PR-Sequence Generator Example Chapter 9: Sequential Logic Modules // an N-bit pr_sequence generator module --- in standard form module pr_sequence_generate (clk, qout); parameter N = 4; // define the default size parameter [N:0] tap = 5'b10011; output reg [N-1:0] qout = 4 b0100; wire d; assign d = ^(tap[n-1:0] & qout[n-1:0]); always @(posedge clk) qout <= {d, qout[n-1:1]}; Q: Write an N-bit pr_sequence generator in modular form. Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-43

A PR-Sequence Generator Example Chapter 9: Sequential Logic Modules // an N-bit pr_sequence generator module --- in standard form module pr_sequence_generate (clk, start, qout); parameter N = 4; // define the default size parameter [N:0] tap = 5'b10011; output reg [N-1:0] qout; wire d; assign d = ^(tap[n-1:0] & qout[n-1:0]); always @(posedge clk or posedge start) if (start) qout <= {1'b1, {N-1{1'b0}}}; else qout <= {d, qout[n-1:1]}; Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-44

Ring Counters // a ring counter with initial value module ring_counter(clk, start, qout); parameter N = 4; output reg [0:N-1] qout; always @(posedge clk or posedge start) if (start) qout <= {1'b1,{N-1{1'b0}}}; else qout <= {qout[n-1], qout[0:n-2]}; Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-45

Johnson Counters // Johnson counter with initial value module ring_counter(clk, start, qout); parameter N = 4; // define the default size output reg [0:N-1] qout; always @(posedge clk or posedge start) if (start) qout <= {N{1'b0}}; else qout <= {~qout[n-1], qout[0:n-2]}; Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-46

Syllabus Objectives Fundamentals of sequential logic modules Flip-flops Memory elements Shift registers Counters Sequence generators Timing generators Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-47

Timing Generators A timing generator Multiphase clock signals Ring counter Binary counter with decoder Digital monostable circuits Retriggerable Nonretriggerable Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-48

Multiphase Clock Signals Ways of generation Ring counter approach Binary counter with decoder approach Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-49

Multiphase Clock Generators Binary counter with decoder approach Chapter 9: Sequential Logic Modules n = 4 and m =2 clk enable reset [1:0] + bcnt_out_5[1:0] [1:0] [1:0] [1:0] D[1:0] Q[1:0] R bcnt_out[1:0] [1:0] D[1:0] decode EQ[3:0] qout[3:0] [3:0] [3:0] qout[3:0] Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-50

Multiphase Clock Generators Chapter 9: Sequential Logic Modules // a binary counter with decoder serve as a timing generator module binary_counter_timing_generator(clk, reset, enable, qout); parameter N = 8; // the number of phases parameter M = 3; // the bit number of binary counter output reg [N-1:0] qout; reg [M-1:0] bcnt_out; always @(posedge clk or posedge reset) if (reset) bcnt_out <= {M{1'b0}}; else if (enable) bcnt_out <= bcnt_out + 1; always @(bcnt_out) qout = {N-1{1'b0},1'b1} << bcnt_out; Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008~2010, John Wiley 9-51