sagar.bavane
Junior Member level 1
- Joined
- Aug 7, 2013
- Messages
- 17
- Helped
- 3
- Reputation
- 6
- Reaction score
- 3
- Trophy points
- 3
- Location
- BANGALORE
- Activity points
- 97
code - vhdl
i am facing problm in making it generic.......
entity gray_count is
generic (
width :INTEGER := 4
);
port( clk : in std_logic;
rst:in std_logic;
enable: in std_logic;
gray: out std_logic_vector(width - 1 downto 0)
);
end gray_count
architecture Behavioral of gray_count is
signal binary : std_logic_vector(width-1 downto 0);
begin
process( clk , rst )
begin
if (rst = '0') then
gray <= (others=>'0');
binary <= (others=>'0');
elsif rising_edge(clk)then
if( enable = '1')then
binary <=binary + '1';
gray <= (binary(width-1) &( binary(width-1 downto 0) xor binary(width-2 downto 0)));------- plz suggest me ulternate to this line.....
end if;
end if;
end process;
end Behavioral;
i am facing problm in making it generic.......
entity gray_count is
generic (
width :INTEGER := 4
);
port( clk : in std_logic;
rst:in std_logic;
enable: in std_logic;
gray: out std_logic_vector(width - 1 downto 0)
);
end gray_count
architecture Behavioral of gray_count is
signal binary : std_logic_vector(width-1 downto 0);
begin
process( clk , rst )
begin
if (rst = '0') then
gray <= (others=>'0');
binary <= (others=>'0');
elsif rising_edge(clk)then
if( enable = '1')then
binary <=binary + '1';
gray <= (binary(width-1) &( binary(width-1 downto 0) xor binary(width-2 downto 0)));------- plz suggest me ulternate to this line.....
end if;
end if;
end process;
end Behavioral;