Sorry, you need to enable JavaScript to visit this website.

Need help in code

Unsolved
2 posts / 0 new
Grizzly09
Junior(0)
Need help in code

Hello
I'm currently working on my assignment in Spartan-3E.My assignment is:
While button is clicked show values of switches in low 4 bit of LED,when button is released move from left to right.Switching speed 2Hz.
But i haven't got any success so far.It not even showing values of switch.
And here is my code:

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

use ieee.std_logic_unsigned.all;

use ieee.std_logic_arith.all;

 

entity daalgavar_13 is

Port ( clk : in STD_LOGIC;

       led : out STD_LOGIC_VECTOR (7 downto 0);

       button : in std_logic;

       switch : in  STD_LOGIC_VECTOR (3 downto 0));

end daalgavar_13;

architecture Behavioral of daalgavar_13 is

signal clk_2G: std_logic;

signal tooluur: integer range 0 to 25000000;

signal data : STD_LOGIC_VECTOR (7 downto 0);

 begin 

--led<=data;

process(clk_2G) --, switch)

variable temp:std_logic_vector(7 downto 0);

 

begin

--if (rst = '0') then

if clk_2G'event and clk_2G='1' then

 if button='1' then

     data <="0000" & switch(3 downto 0);

else 

  

temp := data;

       data <= temp (6 downto 0)& temp(7) ;

   

end if;

end if;

end process;

led<=data;

process(clk)

begin

 if clk'event and clk='1' then 

if tooluur=25000000 then  --2Hz

tooluur<=0;

clk_2G<='1';

else 

tooluur<=tooluur+1;

clk_2G<='0';

end if;

end if;

end process;

end Behavioral;

 

Thank you
 

JFoster
Moderator(67)
Hello Grizzly, 

Hello Grizzly, 

Please ask this question over at the Xilinx forum. At this forum we primarly deal with Zynq.

Thank you,

Josh