创建伪随机数生成器的文本文件

时间:2019-06-01 09:19:15

标签: text-files vhdl

我是VHDL的新手。我必须在非常有限的时间内创建随机数代码的测试文件,因此我必须在文本文件中获取随机数,但是我不知道该怎么做。对我来说真的很重要。从现在开始,谢谢您的帮助。

  

图书馆       使用ieee.std_logic_1164.all;

     

entity lfsr是port(       cout:out std_logic_vector(15降至0       enable:在std_logic中;
      clk:in std_logic);最终实体;

     lfsr的

rtl架构为       信号种子:std_logic_vector(15至0):=“ 1010110010101100”;       信号linear_feedback:std_logic;

     

开始       linear_feedback <=(种子(15)或种子(14)或种子(12)或种子(3)或种子(0));

process (clk) begin
         if (rising_edge(clk)) then
        if (enable = '1') then
            seed <= (seed(14 downto 0)& linear_feedback);
        end if;
    end if;
end process;
cout <= seed; end architecture;

测试台

  

图书馆使用ieee.std_logic_1164.all;

     

实体tb_lfsr是结束tb_lfsr;

     

tb_lfsr的架构tb是

component lfsr
    port (cout   : out std_logic_vector (15 downto 0);
          enable : in std_logic;
          clk    : in std_logic);
end component;

signal cout   : std_logic_vector (15 downto 0);
signal enable : std_logic;
signal clk    : std_logic;

constant TbPeriod : time := 10 ns; -- EDIT Put right period here
signal TbClock : std_logic := '0';
signal TbSimEnded : std_logic := '0';
     

开始

dut : lfsr
port map (cout   => cout,
          enable => enable,
          clk    => clk);

    TbClock <= not TbClock after TbPeriod/2 when TbSimEnded /= '1' else '0';

   clk <= TbClock;

stimuli : process
begin
            enable <= '1';

           wait for 100 ns;

            wait for 1000 * TbPeriod;

           TbSimEnded <= '1';
    wait;
end process;
     

结束tb;

     tp_lfsr的

配置cfg_tb_lfsr为       对于TB       结束于结束cfg_tb_lfsr;

0 个答案:

没有答案
相关问题