?? shift_register.vhd
字號:
-- 庫聲明
library IEEE;
use IEEE.STD_LOGIC_1164.all;
-- 實體聲明
entity shift_register is
-- 類屬參數
generic (
TOTAL_BIT : integer := 67 );
-- 端口
port (
clk : in std_logic;
reset_n : in std_logic;
din : in std_logic; --輸入信號
dout : out std_logic ); --輸出信號
end shift_register;
--}} End of automatically maintained section
-- 結構體
architecture shift_register of shift_register is
-- 內部寄存器序列
signal shift_regs : std_logic_vector(TOTAL_BIT-1 downto 0) := (others => '1');
begin
-- 主過程
main : process(reset_n, clk)
begin
-- 檢查復位信號
if reset_n = '0' then
dout <= '1';
-- 在時鐘上升沿動作
elsif rising_edge(clk) then
-- 將最高位輸出到dout
dout <= shift_regs(TOTAL_BIT-1);
-- 次高位到最低位都向高位移一位
shift_regs(TOTAL_BIT-1 downto 1) <= shift_regs(TOTAL_BIT-2 downto 0);
-- 讀取輸入端口信號并且保存到寄存器序列的最低位
shift_regs(0) <= din;
end if;
end process;
end shift_register;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -