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

📄 registro.txt

📁 regisro muy bueno chequenlo espero les sirva
💻 TXT
字号:
library ieee;
use ieee.std_logic_1164.all;

entity test_reg is
  generic ( width : integer := 17 );
  port ( clk        : in  std_ulogic;
         reset      : in  std_ulogic;
         enable     : in  std_ulogic;
         sel        : in  std_ulogic;
         inp1, inp2 : in  std_logic_vector ( width downto 0);
         outpt      : out std_logic_vector ( width downto 0) );
end test_reg;

architecture rtl of test_reg is
  -- Temporoary variable needed for outptx because you can't read an
  -- output port.
  signal inpx, outptx : std_logic_vector ( width downto 0);
begin  --  rtl

  -- Assign the temporary output to the primary output
  outpt <= outptx;

  -- Lets put a mux in front of the register
  inpx <= inp1 when sel = '1' else
          inp2 when sel = '0' else      -- This "when" clause not necessary
          (others => 'X' );             -- "X" claus ignored in Synthesis.

  -- Register with a reset and an Enable, feeding back the output
  regis : process ( clk, reset )
  begin
    if reset = '0' then
      outptx <= ( others => '0');
    elsif rising_edge ( clk ) then
      if enable = '1' then
        outptx <= inpx;
      else
        outptx <= outptx;
      end if;
    end if;
  end process regis;

end rtl;

⌨️ 快捷键说明

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