First: please use the vhdl tags areund your VHDL code:
Then this:
1 | variable counter :std_logic_vector(27 downto 0):="0000000000000000000000000000";
|
Why do you use a variable?
Why don't you use an integer?
And where did you find this:
1 | if reset='1' then
|
2 | LED <= "00000000";
|
3 | elsif sw1='1' then
|
4 | LED <= "11111111";
|
5 | elsif(clk'event and clk='1') then
|
An asynchronous reset AND additionally a conbinatorial reset. Thats
plain rubbish!
This here:
1 | counter:="0000000000000000000000000000";
|
Could be shortened to that:
Mohammad Mothermohammad wrote:
> i write a vhdl code that is nearly accurate
My VHDL code usually is exactly accurate. Whats the problem with
yours?
> please tell me what is it's problem because in ISIM i don't got the answer
What error messages do you get? What do you expect and what happens
instead?
I would do it like this:
1 | library IEEE;
|
2 | use IEEE.STD_LOGIC_1164.ALL;
|
3 | use IEEE.NUMERIC_STD.ALL;
|
4 |
|
5 | entity BlinkLED is
|
6 | Port ( clk : in STD_LOGIC;
|
7 | led : out STD_LOGIC);
|
8 | end BlinkLED;
|
9 |
|
10 | architecture Behavioral of BlinkLED is
|
11 | -- let the synthesizer do the hard work!
|
12 | signal c : integer range 0 to 1340000000/10-1 := 0; -- 1.34s at 100MHz = 1340000000ns/10ns
|
13 | signal x : std_logic:= '0';
|
14 |
|
15 | begin
|
16 | process begin
|
17 | wait until rising_edge(clk); -- wait till next clock
|
18 | if (c<1340000000/10-1) then -- check the counter
|
19 | c <= c+1; -- if less: count up
|
20 | else -- if reached:
|
21 | c <= 0; -- reset counter
|
22 | x <= not x; -- and toggle the local signal x
|
23 | end if;
|
24 | end process;
|
25 | led <= x; -- hand x over to the LED
|
26 | end Behavioral;
|