library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity Random_generate is
Port ( clk : in STD_LOGIC;
data_out : out STD_LOGIC_VECTOR (2 downto 0));
end Random_generate;
architecture Behavioral of Random_generate is
signal original : std_logic_vector(2 downto 0) :="100";
signal seed : std_logic :='1'; --产生伪随机数的种子
begin
process(clk)
begin
if rising_edge(clk) then
seed <= original(2) xor seed;
original <= original(1 downto 0) & seed;
end if;
end process;
data_out <= original;
end Behavioral;
仿真图如下:
要求伪随机的还是,固定的,可以使用伪随机产生器,自己编写表达式