2
我對VHDL非常陌生,我正試圖弄清楚如何在Altera Cyclone II上做相當基本的工作。 FPGA有四個按鈕 - 其中兩個需要編程以增加和減少所選擇的寄存器(0-F),並且需要對這兩個按鈕進行編程以增加和減少將要進入的值(從00到FF)該登記冊。這是我到目前爲止:VHDL - 在按鈕事件上遞增寄存器值
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)) <= di;
end if;
read_a <= a;
end if;
end process;
do <= RAM(to_integer(read_a));
end rtl;
有人可以提供一些基本的示例代碼,如何去編程按鈕?