Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

vhdl code for pulse generator

Status
Not open for further replies.

kk_victory

Newbie level 3
Joined
Jul 28, 2008
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,327
Hi guys
I want vhdl code for generating a pulse
of following specifications
PW=1us, 1ms
for PW=1us, 1us=Ton and 1us=Toff
Means it is 50% duty cycle.
I have implemented this code


entity pulse is
Port ( clk : in std_logic;
res : in std_logic;
clk_div : out std_logic);
end pulse;


architecture Behavioral of pulse is
signal count : integer;
signal temp : std_logic;

begin
process(clk,res)
begin
if res='1' then

temp <='0';
count <= 0;

elsif (clk'event and clk='1') then
if (count = 38) then
temp <= not temp;
count <=0;
else
count <= count +1;

end if;
end if;
end process;
clk_div <= temp;

end Behavioral;

But Im not getting proper PW=1us I m using 40 MHz Clock. I have simulted in Model sim
Plz Let me favour
 

Yes, you programmed 40/39 = 1.025 us. And don't forget to disable the smilies when passing code as html text.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top