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

📄 有限状态机设计风格模板#1.vhd

📁 一些很好的FPGA设计实例
💻 VHD
字号:
---------------------------有限状态机设计风格模板#1
library ieee;
use ieee.std_logic_1164.all;
------------------------------
entity <entity_name> is
   port(input: in<data_type>;
        reset,clock:in std_logic;
         output: out<data_state>);
end <entity_name>;
-------------------------------
architecture <arch_name> of <entity_name> is
   type state is (state0,state1,state2,state3,...);
   signal pr_state,nx_state: state;
begin
--------------------lower section------------------
process (reset,colock)
begin
  if(reset = '1')then
     pr_state <= state0;
  elsif (clock 'event and clock = '1')then
  pr_state <= nx_state;
  end if;
end process;
-----------------------upper section----------------
process (input, pr_state)
begin
  case pr_state is
  when state0 =>
    if(input=...)then
       output <= <value>;
       nx_state <= state1;
    else...
    end if;
  when state1 =>
    if(input=...)then
       output <= <value>;
       nx_state <= state2;
    else...
    end if;
  when state2 =>
    if(input=...)then
       output <= <value>;
       nx_state <= state3;
    else...
    end if;
............
  end case;;
end process;
end <arch_name>;

⌨️ 快捷键说明

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