下面这个程序是书上的例子,但编译总出错,说是:“std_logic_textio" must in the library.但要是我去掉第三行,
则后面的read()都不可以访问编译,不知道怎么回事,高人请点拨一下好吗?我弄了2天了,也找不到原因。谢谢了!
library ieee;
use ieee.std_logic_1164.all;
use std.textio.all;
use ieee.std_logic_textio.all;
use work.cutpkg.all;
entity testcunt is
end testcunt;
architecture test2 of testcunt is
file intest:text is in "test.in";
signal clk ,rest:std_logic;
signal cnt:std_logic_vector(2 downto 0);
begin
U1:count port map(clk=>clk,rest=>rest,cunt=>cnt);
process
variable li:line;
variable errors:boolean:=false;
variable clki,resti:std_logic;
variable cunti:std_logic_vector(2 downto 0);
begin
readline (intest,li);
read(li,clki);
read(li,resti);
read(li,cunti);
clk<=clki;
rest<=resti;
wait for 20 ns;
if cnt/=cunti then
assert false report"Count is wrong value";
errors:=true;
end if;
if endfile (intest) then
assert errors report"test passed." severity note;
assert (not errors) report "Test Failed." severity note;
wait;
end if;
end process;