⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ascount.vhd

📁 4位MCU AM2901的完整VHDL程序
💻 VHD
字号:
-- Synchronous Counter of Generic Size
--
-- Countersize--size of counter
--
-- clk--posedge clock input
-- areset--asynchronous reset
-- sreset--active high input resets counter to 0
-- enable--active high input enables counting
-- count--counter output
-------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_signed.all;

entity ascount is 
generic(countersize:integer:=2);
port(clk,areset,sreset,enable:in std_logic;
count:buffer std_logic_vector(countersize-1 downto 0));
end ascount;

architecture archascount of ascount is
begin
process(areset,clk)
begin
if areset='1' then
   count<=(others=>'0');
elsif rising_edge(clk) then
    if sreset='1' then
       count<=(others=>'0');
    elsif enable='1' then
          count<=count+1;
    else
          count<=count;
    end if;
end if;
end process;
end archascount;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -