Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > needs help on CLOCK

Reply
Thread Tools

needs help on CLOCK

 
 
vx100miles vx100miles is offline
Junior Member
Join Date: Oct 2008
Posts: 9
 
      11-03-2008
Hello everyone,
Good Day.

I want to download the following VHDL code to FPGA Xilinx Virtex-4.

process(clk)
begin
if (clk'event and clk = '1') then
if (cycle = '0') then
x <= a;
cycle <= '1';
else
x <= b;
cycle <= '0';
end if;
end if;
end process;

I have downloaded this to the FPGA. I have given input by DIP switch (An active low signal is generated when a given switch is ON) and output is in LED (turned “ON” by driving the LEDx signal to logic “0”). the result is as follows:

1. when a=11 and b=11 (by DIP switch), ALL output LED is OFF
2. when a=01 and b=01 , x(1) is MORE BRIGHT, x(0) is OFF
3. when a=11 and b=01 , x(1) is LESS BRIGHT, x(0) is OFF

Can I explain the result like this, because of the RAPID clocking, x changes rapidly. When it has the same value as previous, it is BRIGHT. and when it has different values, it is less bright.

I am using CLK_100 (System Clock – This clock input is connected to a 100MHz LVTTL oscillator) as clk. How can I control the clock speed?

regards and thanks in advance

pantho
 
Reply With Quote
 
 
 
 
Ardni Ardni is offline
Junior Member
Join Date: Jul 2008
Posts: 24
 
      11-03-2008
Hi pantho,
Probably the easiest way to control the speed at which the LED´s change is to code in a delay into your process. You could experiment with something like the modification shown below.
You may also need some form of reset to reset the delay integer to 0 if you have one of the DIP switches available.
Also experiemnt with the value of delay, I put 18000, maybe this is too much or too little, mess around with it until you find a value that suits, or do the maths and figure out the correct time delay that you want.

process(clk)
variable delay : integer;
begin
if (clk'event and clk = '1') then
delay := delay := delay + 1;

if (delay = 18000) then --experiment with this value
delay:= 0;
if (cycle = '0') then
x <= a;
cycle <= '1';
else
x <= b;
cycle <= '0';
end if;
end if;
end if;
end process;


Hope this helps.
 
Reply With Quote
 
 
 
 
vx100miles vx100miles is offline
Junior Member
Join Date: Oct 2008
Posts: 9
 
      11-03-2008
thank you Ardni. It works fine.
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Single clock pulse transfer to different clock domains. himassk VHDL 1 05-16-2007 10:41 AM
Arbitrary Clock Frequencies From Base Clock abhisheknag@gmail.com VHDL 5 06-23-2006 12:45 PM
What is the best way to clock data in on one clock edge and out on another? simon.stockton@baesystems.com VHDL 4 04-26-2006 11:36 PM
Sync for PC clock and server clock PS Computer Support 3 05-13-2005 05:27 AM
Are clock and divided clock synchronous? Valentin Tihomirov VHDL 11 10-28-2003 01:18 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57