📄 counter.vhd
字号:
package type_of_counter is
constant size: integer:= 16;
subtype int16 is integer range 0 to size-1;
end type_of_counter;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use work.type_of_counter.all;
entity counter is
port(rst: in std_logic;
clk: in std_logic;
counterin: in int16;
up: in std_logic;
load: in std_logic;
counter_q: buffer int16);
end counter;
architecture alg of counter is
begin
process
begin
wait until clk'event and clk='1';
if rst= '1' then
counter_q<= 0;
elsif load= '1' then
counter_q<= counterin;
else
if up= '1' then
counter_q<= (counter_q+1) ;
else
counter_q<= (counter_q-1) ;
end if;
end if;
end process ;
end alg;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -