reg.vhd

来自「protel电路板设计」· VHDL 代码 · 共 35 行

VHD
35
字号
library ieee;
use ieee.std_logic_1164.all;
entity reg is
    port(
         clk:in std_logic;
         reset:in std_logic;
         load:in std_logic;
         din:in std_logic_vector(7 downto 0);
         dout:out std_logic_vector(7 downto 0)
    );
end reg;
architecture reg_arch of reg is
signal n_state,p_state: std_logic_vector(7 downto 0);
begin
   dout<=p_state;
    com:process(p_state,load,din)
   begin
      n_state<=p_state;
      if(load='1')then
           n_state<=din;
      end if;
   end process;
   state:process(clk,reset)
   begin
   if(reset='0')then
      p_state<=(others=>'1');
   elsif(clk'event and clk='1')then
      p_state<=n_state;
   end if;
  end process state;
end reg_arch;  



⌨️ 快捷键说明

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