mohammadmother
Junior Member level 3
- Joined
- Oct 2, 2012
- Messages
- 26
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,471
hi every body
i write a vhdl code that is nearly accurate counter
every 1.34 s the LED will be ++
(2^27*10ns = 1.34 s )
please tell me what is it's problem because in ISIM i don't got the
answer
_________________________________________
i write a vhdl code that is nearly accurate counter
every 1.34 s the LED will be ++
(2^27*10ns = 1.34 s )
please tell me what is it's problem because in ISIM i don't got the
answer
_________________________________________
Code VHDL - [expand] 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 58 59 60 61 ------------------------------------------------------------------------ ---------- -- Company: -- Engineer: -- -- Create Date: 08:48:18 09/28/2014 -- Design Name: -- Module Name: count - Behavioral -- Project Name: -- Target Devices: -- Tool versions: -- Description: -- -- Dependencies: -- -- Revision: -- Revision 0.01 - File Created -- Additional Comments: -- ------------------------------------------------------------------------ ---------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; -- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values use IEEE.STD_logic_unsigned.ALL; --use IEEE.NUMERIC_STD.ALL; -- Uncomment the following library declaration if instantiating -- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; entity count is Port ( clk : in STD_LOGIC; reset : in STD_LOGIC; sw1 : in STD_LOGIC; LED : out std_logic_vector(7 downto 0)); end count; architecture Behavioral of count is begin process (clk,reset,sw1) variable c :std_logic_vector(7 downto 0):="00000000"; variable counter :std_logic_vector(27 downto 0):="0000000000000000000000000000"; begin if reset='1' then LED <= "00000000"; elsif sw1='1' then LED <= "11111111"; elsif(clk'event and clk='1') then counter := counter +1 ; if (counter ="1000000000000000000000000000") then c:=c+1; LED<=c; counter:="0000000000000000000000000000"; end if; end if; end process; end Behavioral;
Last edited by a moderator: