emmagood
Member level 4
- Joined
- Feb 13, 2010
- Messages
- 74
- Helped
- 3
- Reputation
- 6
- Reaction score
- 1
- Trophy points
- 1,288
- Activity points
- 1,849
Hello,
I was trying to make a 4 bit gray to binary code converter using while loop. It was giving me logical error in the waveform. During the first 2-3 clock pulses, the output bits were uninitialized. What can be the reason for it pls.
The code is:
******************
******************
Thanks,
Emma Good.
I was trying to make a 4 bit gray to binary code converter using while loop. It was giving me logical error in the waveform. During the first 2-3 clock pulses, the output bits were uninitialized. What can be the reason for it pls.
The code is:
******************
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 library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity gray2b is Port ( g : in STD_LOGIC_VECTOR (3 downto 0); b : out STD_LOGIC_VECTOR (3 downto 0)); end gtob1; architecture Behavioral of gray2b is signal temp : std_logic_vector(3 downto 0); begin process(g) variable i : integer ; begin i:=3; temp(3) <= g(3); while (i > 0) loop temp(i-1) <= temp(i) xor g(i-1); i:=i-1; end loop; --b<= temp; end process; b <= temp; end Behavioral;
******************
Thanks,
Emma Good.
Last edited by a moderator: