Ring Counter. 4-bit Ring Counter using D FlipFlop. VHDL Code for 4-bit Ring Counter and Johnson Counter 1. Contents

Similar documents
UNIVERSITI MALAYSIA PERLIS

EASTERN MEDITERRANEAN UNIVERSITY COMPUTER ENGINEERING DEPARTMENT CMPE224 DIGITAL LOGIC SYSTEMS VHDL EXPERIMENT VII

Types of Control. Programmed Non-programmed. Program Counter Hardwired

CSE 260 Digital Computers: Organization and Logical Design. Midterm Solutions

CHAPTER FIVE - Flip-Flops and Related Devices

Four-Way Traffic Light Controller Designing with VHDL

Arria V Timing Optimization Guidelines

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 5

Microelectromechanical System (MEMS) Switch Test

DELD MODEL ANSWER DEC 2018

Digital Circuits II Lecture 6. Lab Demonstration 3 Using Altera Quartus II to Determine Simplified Equations & Entering Truth Table into VHDL

Configuring CorePWM Using RTL Blocks

CS/EE Homework 9 Solutions

Daisy II. By: Steve Rothen EEL5666 Spring 2002

SRI VENKATESWARA COLLEGE OF ENGINEERING AND TECHNOLOGY (AUTONOMOUS)

Lab 1.1 PWM Hardware Design

Introduction to Digital Signal Processing

PE713 FPGA Based System Design

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-2700:

Hardware Design with VHDL Design Example: UART ECE 443

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-378:

A-PDF Split DEMO : Purchase from to remove the watermark 114 FSM

Synthesis Minimizations and Mesh Algorithm Selection: An Extension of the Ultrasonic 3D Camera

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-2700:

Written exam IE1204/5 Digital Design Friday 13/

CSE 260 Digital Computers: Organization and Logical Design. Lab 4. Jon Turner Due 3/27/2012

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-2700:

Topics. FPGA Design EECE 277. Combinational Logic Blocks. From Last Time. Multiplication. Dr. William H. Robinson February 25, 2005

E2 Framing / Deframing according ITU-T G.703 / G.742 : VHDL-Modules

Field Programmable Gate Array Implementation and Testing of a Minimum-phase Finite Impulse Response Filter

Senior Capstone Project Proposal Reconfigurable FPGA Implementation Of Digital Communication System

Bluetooth Transceiver Design with VHDL-AMS

FPGA & Pulse Width Modulation. Digital Logic. Programing the FPGA 7/23/2015. Time Allotment During the First 14 Weeks of Our Advanced Lab Course

Embedded Systems 10 BF - ES - 1 -

Generation of Digital System Test Patterns Based on VHDL Simulations

HDL CODE TO REALIZE ALL THE LOGIC GATES

[VLSI & EMBEDDED SYSTEMS LAB]

Module -18 Flip flops

Chapter 4: FLIP FLOPS. (Sequential Circuits) By: Siti Sabariah Hj. Salihin ELECTRICAL ENGINEERING DEPARTMENT EE 202 : DIGITAL ELECTRONICS 1

Key words: DWT, VHDL, MATLAB, Power Systems, Digital Modeling

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING BENG (HONS) ELECTRICAL & ELECTRONICS ENGINEERING SEMESTER TWO EXAMINATION 2017/2018

Doing DSP Workshop Summer Lab Exercise 2. 1 Overview PMod modules The S3SB to C5510 connection... 4

Efficient Parallel Real-Time Upsampling with Xilinx FPGAs

EXPERIMENT 1: INTRODUCTION TO THE NEXYS 2. ELEC 3004/7312: Signals Systems & Controls EXPERIMENT 1: INTRODUCTION TO THE NEXYS 2

Development of FPGA Based System for Neutron Flux Monitoring in Fast Breeder Reactors

logic system Outputs The addition of feedback means that the state of the circuit may change with time; it is sequential. logic system Outputs

Clocking Schedule and Writing VHDL Programs for Synthesis

M.A. College of Engineering 352-(&75(3257 6LPXODWLRQ DQG 6\QWKH. Prof. K.Radhakrishnan Ray Ranjan Varghese. 'HSDUWPHQW RI (OHFWULFDO á (OHFWURQLFV

ENGG1015: lab 3. Sequential Logic

Midterm Exam ECE 448 Spring 2013 Thursday Section (15 points)

6.111 Lecture # 19. Controlling Position. Some General Features of Servos: Servomechanisms are of this form:

PpsSlaveClock. Reference Manual. Product Info. Product Manager. Author(s) Reviewer(s) - Version 1.3. Date Sven Meier.

Java Bread Board Introductory Digital Electronics Exercise 2, Page 1

VHDL IMPLEMENTATION OF CDMA SYSTEM

FM Radio Receiver with Digital Demodulation

MODULE-4 Memory and programmable logic

Behavioural Library Development and Documentation

Lecture 3, Handouts Page 1. Introduction. EECE 353: Digital Systems Design Lecture 3: Digital Design Flows, Simulation Techniques.

Project Board Game Counter: Digital

IMPROVEMENT OF THE ORTHOGONAL CODE CONVOLUTION CAPABILITIES USING FPGA IMPLEMENTATION

Chapter 5 Sequential Logic Circuits Part II Hiroaki Kobayashi 7/11/2011

Stage report Spark Generator Board & Path Finder Robot

Logic 0 Logic To provide an output load (or two) 5 Voltage Measurement Point V CC +5 74LS00 GND

CHAPTER 5 DESIGNS AND ANALYSIS OF SINGLE ELECTRON TECHNOLOGY BASED MEMORY UNITS

Digital Circuits Laboratory LAB no. 12. REGISTERS

High Speed Binary Counters Based on Wallace Tree Multiplier in VHDL

Block Diagram. i_in. q_in (optional) clk. 0 < seed < use both ports i_in and q_in

Brought to you by. Priti Srinivas Sajja. PS01CMCA02 Course Content. Tutorial Practice Material. Acknowldgement References. Website pritisajja.

CONTENTS Sl. No. Experiment Page No

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

Computer Architecture: Part II. First Semester 2013 Department of Computer Science Faculty of Science Chiang Mai University

TRANSPOSED FORM OF FOLDED FIR FILTER

Midterm Exam ECE 448 Spring Thursday Section. (15 points)

Chapter 5 Sequential Logic Circuits Part II Hiroaki Kobayashi 6/30/2008

EECS 150 Homework 4 Solutions Fall 2008

DIGITAL DESIGN WITH SM CHARTS

Advanced Features of the ispmach 4000ZE Family

Model 305 Synchronous Countdown System

Lecture 20: Several Commercial Counters & Shift Register

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

STUDY OF RECONFIGURABLE MOSTLY DIGITAL RADIO FOR MANET

Digital Fundamentals A Systems Approach Thomas L. Floyd First Edition

THE DESIGN OF DIGITAL FREQUENCY SYNTHESIZER BASED ON VHDL

IES Digital Mock Test

B.E. SEMESTER III (ELECTRICAL) SUBJECT CODE: X30902 Subject Name: Analog & Digital Electronics

FPGA-Based Digital Filters Using Bit-Serial Arithmetic

Code No: R Set No. 1

Game Console Design. Final Presentation. Daniel Laws Comp 499 Capstone Project Dec. 11, 2009

Computer Architecture Laboratory

I hope you have completed Part 2 of the Experiment and is ready for Part 3.

PC-OSCILLOSCOPE PCS500. Analog and digital circuit sections. Description of the operation

Spec. Instructor: Center

Module-20 Shift Registers

1 Q' 3. You are given a sequential circuit that has the following circuit to compute the next state:

Performance assessment of Hamming Code

Chapter 10 Adaptive Delta Demodulator

E-Tec Module Part No

ATmega16A Microcontroller

Lab 1.2 Joystick Interface

Controller Implementation--Part I. Cascading Edge-triggered Flip-Flops

Transcription:

VHDL Code for 4-bit Ring Counter and Johnson Counter 1 Contents 1 Ring Counter 2 4-bit Ring Counter using D FlipFlop 3 Ring Counter Truth Table 4 VHDL Code for 4 bit Ring Counter 5 VHDL Testbench for 4 bit ring counter 6 VHDL Testbench waveform for 4 bit ring counter 7 Johnson Counter 8 4-bit Johnson Counter using D FlipFlop 9 Johnson Counter Truth Table 10 VHDL Code for 4 bit Johnson Counter 11 VHDL Testbench for 4 bit Johnson Counter 12 Testbench waveform for 4 bit Johnson Counter Ring Counter Ring Counter very similar to shift register. At each clock pulse, data at each flipflop shifted to next flipflop with last output is feed back to the input of first flipflop. Also the first flop is set to 1 at the reset state. so it shift bit 1 to next flipflop for each clock input and repeat the sequence as shown below. 4-bit Ring Counter using D FlipFlop

VHDL Code for 4-bit Ring Counter and Johnson Counter 2 Ring Counter Truth Table VHDL Code for 4 bit Ring Counter library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity Ring_counter is Port ( CLOCK : in STD_LOGIC; RESET : in STD_LOGIC; Q : out STD_LOGIC_VECTOR (3 downto 0)); end Ring_counter; architecture Behavioral of Ring_counter is signal q_tmp: std_logic_vector(3 downto 0):= "0000"; process(clock,reset)

VHDL Code for 4-bit Ring Counter and Johnson Counter 3 if RESET = '1' then q_tmp <= "0001"; elsif Rising_edge(CLOCK) then q_tmp(1) <= q_tmp(0); q_tmp(2) <= q_tmp(1); q_tmp(3) <= q_tmp(2); q_tmp(0) <= q_tmp(3); end if; Q <= q_tmp; end Behavioral; VHDL Testbench for 4 bit ring counter LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY Tb_ring_counter IS END Tb_ring_counter; ARCHITECTURE behavior OF Tb_ring_counter IS -- Component Declaration for the Unit Under Test (UUT) COMPONENT Ring_counter PORT( CLOCK : IN std_logic; RESET : IN std_logic; Q : OUT std_logic_vector(3 downto 0) ); END COMPONENT;

VHDL Code for 4-bit Ring Counter and Johnson Counter 4 --Inputs signal CLOCK : std_logic := '0'; signal RESET : std_logic := '0'; --Outputs signal Q : std_logic_vector(3 downto 0); -- Clock period definitions constant CLOCK_period : time := 20 ns; BEGIN -- Instantiate the Unit Under Test (UUT) uut: Ring_counter PORT MAP ( CLOCK => CLOCK, RESET => RESET, Q => Q ); -- Clock process definitions CLOCK_process :process CLOCK <= '0'; wait for CLOCK_period/2; CLOCK <= '1'; wait for CLOCK_period/2; -- Stimulus process stim_proc: process -- hold reset state for 100 ns. wait for 100 ns;

VHDL Code for 4-bit Ring Counter and Johnson Counter 5 wait for 100 ns; Reset <= '1'; Reset <= '0'; wait; END; VHDL Testbench waveform for 4 bit ring counter In the waverform, The output value changes as 0001, 0010, 0100, 1000 and repeat the same sequence at the each clock cycle. Johnson Counter Johnson Counter is also a type of ring counter with output of each flipflop is connected to next flipflop input except at the last flipflop, the output is inverted and connected back to the first flipflop as shown below. 4-bit Johnson Counter using D FlipFlop

VHDL Code for 4-bit Ring Counter and Johnson Counter 6 Johnson Counter Truth Table VHDL Code for 4 bit Johnson Counter library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity Johnson_counter is

VHDL Code for 4-bit Ring Counter and Johnson Counter 7 Port ( clk : in STD_LOGIC; rst : in STD_LOGIC; Q : out STD_LOGIC_VECTOR (3 downto 0)); end Johnson_counter; architecture Behavioral of Johnson_counter is signal temp: std_logic_vector(3 downto 0):= "0000"; process(clk,rst) if rst = '1' then temp <= "0000"; elsif Rising_edge(clk) then temp(1) <= temp(0); temp(2) <= temp(1); temp(3) <= temp(2); temp(0) <= not temp(3); end if; Q <= temp; end Behavioral; VHDL Testbench for 4 bit Johnson Counter LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY Tb_Johnson_counter IS END Tb_Johnson_counter; ARCHITECTURE behavior OF Tb_Johnson_counter IS

VHDL Code for 4-bit Ring Counter and Johnson Counter 8 -- Component Declaration for the Unit Under Test (UUT) COMPONENT Johnson_counter PORT( clk : IN std_logic; rst : IN std_logic; Q : OUT std_logic_vector(3 downto 0) ); END COMPONENT; --Inputs signal clk : std_logic := '0'; signal rst : std_logic := '0'; --Outputs signal Q : std_logic_vector(3 downto 0); -- Clock period definitions constant clk_period : time := 10 ns; BEGIN -- Instantiate the Unit Under Test (UUT) uut: Johnson_counter PORT MAP ( clk => clk, rst => rst, Q => Q ); -- Clock process definitions clk_process :process clk <= '0'; wait for clk_period/2;

VHDL Code for 4-bit Ring Counter and Johnson Counter 9 clk <= '1'; wait for clk_period/2; -- Stimulus process stim_proc: process -- hold reset state for 100 ns. wait for 100 ns; rst <= '1'; wait for 100 ns; rst <= '0'; wait; END; Testbench waveform for 4 bit Johnson Counter In waveform, the output at the 4th flipflop toggles and outputs johnson counter.