while not endfile

Gast #1368377
Lesenswert?
• ▲
▼
Hallo -

lese eine stimuli datei mit

while not endfile(...)

ein.

Die Datei soll dann nochmals vollständig eingelesen werden.
Allerderdings weiss ich nicht, wie ich die loop variable wieder auf 0 
setzen muss, denn sie wird ja ledglich so aufgerufen:

    while not endfile(testfile) loop
      readline(testfile_2, testfile_l);
      read(testfile_l, testfile_s);
      ADDR <= to_std_logic_vector(testfile_s(32 downto 19));
      DI   <= to_std_logic_vector(testfile_s(18 downto 3));
      RN <= to_std_logic(testfile_s(2));
      STB  <= to_std_logic(testfile_s(1));
      wait until rising_edge(SYSCLK);
    end loop;

Wäre über Hilfe dankbar,
Kasper
Gast #1368413
Lesenswert?
• ▲
▼
nein..

hier ein auszug

entity top_p_tb is
  generic (
    log_file      : string := "res.log";
    test_file_1    : string := "ramfile_1.txt";
    );
end top_p_tb;
architecture behavior of top_p_tb is
  file logfile_top_p : text open write_mode is log_file;
  file testfile_1     : text open read_mode is ram_file_1;
  -- Component Declaration for the Unit Under Test (UUT)
  component top_p
    port(

..
..
..
..

  -- Stimulus process
  stim_proc : process
    variable ramfile_l      : line;
    variable ramfile_s      : string(32 downto 1);

  begin
  --------------------------------------------------------------------
    -- RESET
  --------------------------------------------------------------------
    wait for 100 ns;
    RESETN <= '0';
    wait until rising_edge(SYSCLK);
    RESETN <= '1';
    wait until rising_edge(SYSCLK);
    wait for 100 ns;
    wait until rising_edge(SYSCLK);

    while not endfile(testfile) loop
      readline(testfile_2, testfile_l);
      read(testfile_l, testfile_s);
      ADDR <= to_std_logic_vector(testfile_s(32 downto 19));
      DI   <= to_std_logic_vector(testfile_s(18 downto 3));
      RN <= to_std_logic(testfile_s(2));
      STB  <= to_std_logic(testfile_s(1));
      wait until rising_edge(SYSCLK);
    end loop;

    ..
    ..


    while not endfile(testfile) loop
      readline(testfile_2, testfile_l);
      read(testfile_l, testfile_s);
      ADDR <= to_std_logic_vector(testfile_s(32 downto 19));
      DI   <= to_std_logic_vector(testfile_s(18 downto 3));
      RN <= to_std_logic(testfile_s(2));
      STB  <= to_std_logic(testfile_s(1));
      wait until rising_edge(SYSCLK);
    end loop;
end process compare_datain;
end;

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren