0% found this document useful (0 votes)
712 views4 pages

Clock Divider and Pulse Counter

The document describes an experiment to implement VHDL code for a clock divider and pulse counter. It provides background theory on how pulse counters count input pulses and how clock dividers generate output signals at fractional frequencies of the input signal. It then provides the VHDL code for a pulse counter that counts pulses on a sample signal and overflows at a max count, and code for a clock divider that generates a divided clock signal. The output shows the codes were successfully simulated.

Uploaded by

Rohit Panwar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
712 views4 pages

Clock Divider and Pulse Counter

The document describes an experiment to implement VHDL code for a clock divider and pulse counter. It provides background theory on how pulse counters count input pulses and how clock dividers generate output signals at fractional frequencies of the input signal. It then provides the VHDL code for a pulse counter that counts pulses on a sample signal and overflows at a max count, and code for a clock divider that generates a divided clock signal. The output shows the codes were successfully simulated.

Uploaded by

Rohit Panwar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

EXPERIMENT NO.

15
Aim
To implement VHDL code for clock divider and pulse counter.

Tool Required
Mentor Graphics FPGA advantage tool 8.1PS Model sim 6.3a

Theory
Pulse counter The frequency counter has to count the number of cycles per second of an incoming signal. Hence we need a device to count. In electronics circuits, counter ICs are available for counting. These IC's can count the input pulses. Clock Divider In some designs, you need to provide a number of phase-related clocks to various components. In most cases, you generate the needed clocks by dividing a master clock by a power of two (synchronous division). However, sometimes, it is desirable to divide a frequency by an odd or even fractional divisor. In these cases, no synchronous method exists without generating a higher frequency master clock.

A frequency divider also called a clock divider or scalar or presale, is a circuit that takes an input signal of a frequency, fin, and generates an output signal of a frequency:

Where n is an integer. Phase-locked loop frequency synthesizers make use of frequency dividers to generate a frequency that is a multiple of a reference frequency. Frequency dividers can be implemented for both analog and digital applications.

VHDL Code for Pulse Counter LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY pulse_counter IS generic(max_count:natural:=8); port(clk,sample:instd_logic; count:out integer range 0 to max_count-1; overflow:outboolean); END ENTITY pulse_counter; -ARCHITECTURE beh_pulc OF pulse_counter IS BEGIN process(clk,sample) variablelocal_cntr:natural; variablestart_counting:boolean; begin ifsample'event then if sample='1'then overflow<=false; start_counting:=true; local_cntr:=0; elsif sample='0' then start_counting:=false; end if; elsifclk'event and clk='1' then ifstart_counting then local_cntr:=local_cntr+1; iflocal_cntr>max_count then local_cntr:=0; overflow<=true; start_counting:=false; end if; end if; end if; count<=local_cntr; end process; END ARCHITECTURE beh_pulc;

Output:

VHDL Code for Clock divider

LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY clk_divider IS generic(n:positive:=1); port(rst,clk:instd_logic; clk_div:bufferstd_logic); END ENTITY clk_divider; -ARCHITECTURE beh_clkdiv OF clk_divider IS BEGIN process(clk,rst) variablecount:natural; begin ifrst='0'then count:=0; clk_div<='0'; elsifclk'event and clk='1' then count:=count+1;

if count=n then clk_div<=not clk_div; count:=0; end if; end if; end process; END ARCHITECTURE beh_clkdiv;

Output:

Result:
The VHDL code for Pulse Counter and Clock Divider were simulated successfully.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy