title: VHDL - Incrementing Register Value on Push Button Event
body: <p>I am very new to VHDL and am trying to figure out how to do something fairly basic on an Altera Cyclone II. The FPGA has four push buttons - two of them need to be programmed to increase and decrease the selected register (0-F), and the two need to be programmed to increase and decrease the value (from 00 to FF) that will be in that register. Here is what I have so far:</p>
  
  <pre><code>entity raminfr is
      port (
          clk : in std_logic;
          we : in std_logic;
          a : in unsigned(3 downto 0);
          di : in unsigned(7 downto 0);
          do : out unsigned(7 downto 0)
      );
  end raminfr;
  
  architecture rtl of raminfr is
  type ram_type is array (0 to 15) of unsigned(7 downto 0);
  signal RAM : ram_type;
  signal read_a : unsigned(3 downto 0);
  
  begin
  
  process (clk)
  begin
      if rising_edge(clk) then
          if we = '1' then
              RAM(to_integer(a)) &lt;= di;
          end if;
          read_a &lt;= a;
      end if;
  end process;
  
  do &lt;= RAM(to_integer(read_a));
  
  end rtl;
  </code></pre>
  
  <p>Could someone provide some basic sample code as to how to go about programming the push buttons?</p>