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 01-27-2008, 09:19 PM
Lore Leunoeg
Guest
 
Posts: n/a
Default assign value on falling edge

Hello

I need to write a testbench which assigns one value at the rising edge and
another value at the falling edge of the clock.

I tried the code below but the value is always assignd only at the rising
edge. What is my mistake?

Thank you
Sincerely
Lore

....
blabla: process
variable i : integer;
begin
s_clk <= '0';
s_reset <= '0';
s_reset <= '1';

while i<50 loop
s_din <= std_logic_vector(to_unsigned(i,width)); -- integer nach
std_logic vector
s_clk <= '1';
wait for 50 ns;
i:= i + 1;
s_din <= std_logic_vector(to_unsigned(i,width)); -- integer nach
std_logic vector
s_clk <= '0';
wait for 50 ns;
end loop;

end process;
....


Reply With Quote
  #2 (permalink)  
Old 01-28-2008, 12:52 AM
KJ
Guest
 
Posts: n/a
Default Re: assign value on falling edge


"Lore Leunoeg" <[email protected]> wrote in message
news:[email protected]...
> Hello
>
> I need to write a testbench which assigns one value at the rising edge and
> another value at the falling edge of the clock.
>
> I tried the code below but the value is always assignd only at the rising
> edge. What is my mistake?
>

It is assigning at both edges, but you're only seeing it change at the
falling edge (not the rising edge as you state) because you never changed
the value of the variable 'i' prior to the rising edge assignment. I'm
assuming that you want to increment 'i' at both places which means that you
need to add "i:= i + 1;" either prior to the first assignment to s_din (the
one preceding when s_clk gets set to 1) or just prior to the "end loop"
statement. Lastly, you have no initial assignment for the variable 'i'
which is probably a mistake as well.

Kevin Jennings


Reply With Quote
  #3 (permalink)  
Old 01-28-2008, 01:36 PM
Guest
 
Posts: n/a
Default Re: assign value on falling edge

I think that correctly you need use 2x frequncy.


Lore Leunoeg:
> Hello
>
> I need to write a testbench which assigns one value at the rising edge and
> another value at the falling edge of the clock.
>
> I tried the code below but the value is always assignd only at the rising
> edge. What is my mistake?
>
> Thank you
> Sincerely
> Lore
>
> ...
> blabla: process
> variable i : integer;
> begin
> s_clk <= '0';
> s_reset <= '0';
> s_reset <= '1';
>
> while i<50 loop
> s_din <= std_logic_vector(to_unsigned(i,width)); -- integer nach
> std_logic vector
> s_clk <= '1';
> wait for 50 ns;
> i:= i + 1;
> s_din <= std_logic_vector(to_unsigned(i,width)); -- integer nach
> std_logic vector
> s_clk <= '0';
> wait for 50 ns;
> end loop;
>
> end process;
> ...

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
React on falling edge in testbench Timo Gerber FPGA 2 11-22-2007 03:40 PM
Are actions permitted on rising *and* falling edge of clock? Anon Anon VHDL 2 05-25-2007 02:00 PM
Rising to falling edge constraints on Actel ProAsic Jura FPGA 0 06-27-2005 11:40 AM
Newbie: Falling edge, what is the threshold? (Xilinx XC9572XL) James A FPGA 9 05-21-2005 10:46 AM
Rising, falling edge ALuPin VHDL 0 04-21-2005 12:26 PM


All times are GMT +1. The time now is 12:02 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