Forum Discussion
Altera_Forum
Honored Contributor
19 years agoMultiple Distinct Clocks Error
Hello everyone, I am trying to write some code to use the debounced keys on the Altera DE2 board. I have spent days on the same error: "Error (10820): Netlist error at lab1.vhd(49): can't infe...
Altera_Forum
Honored Contributor
19 years agoThank you for everyone's help. I didn't really understand most of it, but I'll check out those references. Here is the way I finally solved the problem:
if(clock'EVENT and clock='1') then
we <= '0';
if(key(3)='1' and key(2)='1' and key(1)='1' and key(0)='1') then
EnableKeyPress := '1';
end if;
if(key(3)='0' and EnableKeyPress='1') then
EnableKeyPress := '0';
if(conv_integer(ram_addr) = 16) then
ram_addr <= "0000";
else
ram_addr <= ram_addr + "0001";
end if;
elsif(key(2)='0' and EnableKeyPress='1') then
EnableKeyPress := '0';
if(conv_integer(ram_addr) = 0) then
ram_addr <= "1111";
else
ram_addr <= ram_addr - "0001";
end if;
elsif(key(1)='0' and EnableKeyPress='1') then
EnableKeyPress := '0';
we <= '1';
if(data_out = "11111111") then
data_in <= "00000000";
else
data_in <= data_in + 1;
end if;
elsif(key(0)='0' and EnableKeyPress='1') then
EnableKeyPress := '0';
we <= '1';
if(data_out = "00000000") then
data_in <= "11111111";
else
data_in <= data_in - 1;
end if;
end if;
end if; It seems to work. I have a few quarks to work out with the ram, but the button detecting code works. Thanks for all the help. Does anyone see any reason why this code should not be used?