2012-04-29 63 views
0

このプログラムのデバッグに問題があります。私はプログラムをテストするためにテキストファイルからテストベクトルを読み込むという割り当てを与えられました。プログラムとテストベンチのコードは以下の通りです。なぜ私のシミュレーションが空になっているのか分かりません。エラーはなく、シミュレーションウィンドウが表示されますが、空白です。どのような問題が起こっているのでしょうか?VHDL textioファイルの読み込みデバッグ

モジュール:

library IEEE; 
use IEEE.STD_LOGIC_1164.ALL; 

entity PAR is 
Port (data : in STD_LOGIC_VECTOR (3 downto 0); 
     parity : out STD_LOGIC); 
end PAR; 

architecture Behavioral of PAR is 
begin 
proc: process 
variable count: bit; 
begin 
for i in data'range loop 
    if data(i)='1' then 
     count:=not count; 
    end if; 
end loop; 
if count='0' then 
    parity<='0'; 
else 
    parity<='1'; 
end if; 
wait; 
end process; 


end Behavioral; 

テストベンチ:あなたの "FILE_OPEN .." 行の

LIBRARY ieee; 
USE ieee.std_logic_1164.ALL; 
USE std.textio.all; 
use ieee.std_logic_textio.all; 

ENTITY PAR_test IS 
END PAR_test; 

ARCHITECTURE behavior OF PAR_test IS 

    -- Component Declaration for the Unit Under Test (UUT) 

    COMPONENT PAR 
    PORT(
     data : IN std_logic_vector(3 downto 0); 
     parity : OUT std_logic 
     ); 
    END COMPONENT; 


    --Inputs 
    signal data : std_logic_vector(3 downto 0) := (others => '0'); 

    --Outputs 
    signal parity : std_logic; 
    -- No clocks detected in port list. Replace <clock> below with 
    -- appropriate port name 

BEGIN 

    -- Instantiate the Unit Under Test (UUT) 
    uut: PAR PORT MAP (
      data => data, 
      parity => parity 
     ); 

    TB: process 
     file vec_file: text; 
     variable buf_in: line; 
     variable testv: std_logic_vector(0 to 4); 
     begin 
      file_open(vec_file,"PAR_file.txt,", read_mode); 
     while not endfile (vec_file) loop 
      readline (vec_file, buf_in); 
      read(buf_in,testv); 
      data(3) <= testv(0); 
      data(2) <= testv(1); 
      data(1) <= testv(2); 
      data(0) <= testv(3); 
      wait for 10 ns; 
      assert (parity=testv(4)) 
       report "Test Failed" severity error; 
     end loop; 
    wait; 
    END process; 
    end; 
+0

データに1の偶数がある場合、プログラムは0を出力し、奇数がある場合は1を出力します。 –

+0

さらに詳しい情報があります:どのようなシミュレータ?コードをコンパイルするためにどのようなコマンドを使用しましたか?あなたはそれを実行するためにどのようなコマンドを使用しましたか? –

答えて

0

あなたが持っている ""

間違っ

を必要としないということです。

file_open(vec_file,"PAR_file.txt,", read_mode); 

が正しい:

file_open(vec_file,"PAR_file.txt", read_mode); 
関連する問題