FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > VHDL

VHDL comp.lang.vhdl newsgroup / Usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-20-2004, 04:21 PM
ALuPin
Guest
 
Posts: n/a
Default Aligning Signals

Hi,

what is the difference between the following processes
if I want to use the basic clock and the derived clock for my
simulation with Modelsim?


process(clk)
begin
if clk='1' then
clk2 <= not clk2;
end if;
end process;
-- clk and clk2 are used for simulation
----------------------------------------------

process(clk)
begin
clk1 <= clk;
if clk='1' then
clk2 <= not clk2;
end if;
end process;
-- clk1 and clk2 are used for simulation

Thank you for your help.

Best regards
Reply With Quote
  #2 (permalink)  
Old 04-20-2004, 04:48 PM
Ralf Hildebrandt
Guest
 
Posts: n/a
Default Re: Aligning Signals

ALuPin wrote:


> what is the difference between the following processes
> if I want to use the basic clock and the derived clock for my
> simulation with Modelsim?
>
>
> process(clk)
> begin
> if clk='1' then
> clk2 <= not clk2;
> end if;
> end process;
> -- clk and clk2 are used for simulation


clk2 is never reseted - it stays at 'X' forever.

Don't put clk2 into the sensitivity list! You would get an infinite loop.


Better would be - if it matches your desired functionality (I am not
shure what you want!):


process(reset,clk)
begin
if (reset='1') then
clk2<='0';
elsif rising_edge(clk) then
clk2<=NOT(clk2); -- simple clock devider
end if;
end process;


> ----------------------------------------------
>
> process(clk)
> begin
> clk1 <= clk;
> if clk='1' then
> clk2 <= not clk2;
> end if;
> end process;
> -- clk1 and clk2 are used for simulation



For clk1 this is the same as

clk1<=clk;

(no process). clk1 is a simple copy of clk.


clk2 has the same behavior as in the 1st process.


Ralf

Reply With Quote
  #3 (permalink)  
Old 04-20-2004, 07:18 PM
paris
Guest
 
Posts: n/a
Default Re: Aligning Signals


"ALuPin" <[email protected]> escribió en el mensaje
news:[email protected] om...
> Hi,
>
> what is the difference between the following processes
> if I want to use the basic clock and the derived clock for my
> simulation with Modelsim?
>


what do you mean by "aligning signals"? what signals are you aligning?
if you have modelsim why dont you just simulate it to see if you get the
correct behaviour? which only you knows, as it cant be "extracted" from
these small pieces of code...

>
> process(clk)
> begin
> if clk='1' then
> clk2 <= not clk2;
> end if;
> end process;
> -- clk and clk2 are used for simulation
> ----------------------------------------------
>


i dont understand what exactly are you trying to do, but it seems like
you're "dividing" the frequency of clk, use a DFF then, a divider is a DFF
with it's "Qn" output conected to it's "D" input, the output of the divider
can be either Q or Qn

process(CLK, RSTn)
begin
if (RSTn = '0') then
Q <= '0';
elsif (rising_edge(CLK)) then
Q <= D;
end if;
end process;

D <= not Q; -- (which of course you could put in the elsif of
the process, by putting Q <= not Q; )



> process(clk)
> begin
> clk1 <= clk;
> if clk='1' then
> clk2 <= not clk2;
> end if;
> end process;
> -- clk1 and clk2 are used for simulation
>
> Thank you for your help.
>
> Best regards


the same as before, you just have

clk1 <= clk;

but again, you'd be better simulating stuff in modelsim to see what fits
your needs better



Reply With Quote
  #4 (permalink)  
Old 04-21-2004, 06:32 AM
Eyck Jentzsch
Guest
 
Posts: n/a
Default Re: Aligning Signals

ALuPin wrote:
> Hi,
>
> what is the difference between the following processes
> if I want to use the basic clock and the derived clock for my
> simulation with Modelsim?
>
>
> process(clk)
> begin
> if clk='1' then
> clk2 <= not clk2;
> end if;
> end process;
> -- clk and clk2 are used for simulation
> ----------------------------------------------
>
> process(clk)
> begin
> clk1 <= clk;
> if clk='1' then
> clk2 <= not clk2;
> end if;
> end process;
> -- clk1 and clk2 are used for simulation
>
> Thank you for your help.
>
> Best regards

Beside that reset behavior already mentioned you will have problems if
you hand over signals from flops clocked by clk to flops clocked by clk2
since clk2 will change 1 delta cycle later than clk and this is enough
to update outputs of flops clocked by clk. You second soultion avoids
this by 'generating' both clocks in the same delta cycle.
HTH

-Eyck

Reply With Quote
Reply

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Aligning data with clock Bill FPGA 5 01-25-2007 04:53 PM
is there a way to initialize signals to a value Matt Clement FPGA 6 02-15-2006 10:29 AM
VGA sync signals Roger FPGA 8 05-03-2005 03:04 AM
Aligning process outputs with pipeline delays DW Verilog 7 02-18-2005 10:07 AM
VGA Signals Matt North FPGA 6 08-05-2004 10:44 PM


All times are GMT +1. The time now is 12:06 PM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved