本帖最后由 anzaitian 于 2015-4-23 10:17 编辑
初学FPGA,做了个简单的testbench试验。用quartus直接调用modelsim,做仿真,modelsim出现问题如下,停止仿真。求解决方法。
# ** Error: $MODEL_TECH/../vhdl_src/std/textio.vhd(18): Unknown identifier 'read_mode'.
# ** Error: $MODEL_TECH/../vhdl_src/std/textio.vhd(18): (vcom-1112) FILE declaration using 1076-1993 syntax. Recompile using the -93 option.
# ** Error: $MODEL_TECH/../vhdl_src/std/textio.vhd(18): VHDL Compiler exiting
# ** Error: C:/Modeltech_6.0/win32/vcom failed.
# Error in macro ./add_vhdl_run_msim_rtl_vhdl.do line 9
# C:/Modeltech_6.0/win32/vcom failed.
源:
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
entity add_vhdl is
port(
A:in std_logic;
B:in std_logic;
Cin:in std_logic;
Sum:out std_logic;
Cout:out std_logic
);
end entity;
architecture BEHAVIOR of add_vhdl is
function Majority (A,B,C:std_logic)
return std_logic is
begin
return ((A and B) or (A and C) or (B and C));
end Majority;
begin
Sum<=A xor B xor Cin;
Cout<=Majority(A,B,Cin);
end BEHAVIOR;
testbench:
LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY add_vhdl_vhd_tst IS
END add_vhdl_vhd_tst;
ARCHITECTURE add_vhdl_arch OF add_vhdl_vhd_tst IS
-- constants
-- signals
SIGNAL A : STD_LOGIC;
SIGNAL B : STD_LOGIC;
SIGNAL Cin : STD_LOGIC;
SIGNAL Cout : STD_LOGIC;
SIGNAL Sum : STD_LOGIC;
COMPONENT add_vhdl
PORT (
A : IN STD_LOGIC;
B : IN STD_LOGIC;
Cin : IN STD_LOGIC;
Cout : OUT STD_LOGIC;
Sum : OUT STD_LOGIC
);
END COMPONENT;
BEGIN
i1 : add_vhdl
PORT MAP (
A => A,
B => B,
Cin => Cin,
Cout => Cout,
Sum => Sum
);
always : PROCESS
BEGIN
wait for 1ns;
A='0';B='0';Cin='0';--000 00
wait for 1ns;
A='0';B='0';Cin='1';--001 10
wait for 1ns;
A='0';B='1';Cin='1';--011 01
wait for 1ns;
A='0';B='1';Cin='0';--010 10
wait for 1ns;
A='1';B='1';Cin='0';--110 01
wait for 1ns;
A='1';B='1';Cin='1';--111 11
wait for 1ns;
A='1';B='0';Cin='1';--101 01
wait for 1ns;
A='1';B='0';Cin='0';--100 10
wait for 1ns;
A='0';B='0';Cin='0';--000 00
WAIT;
END PROCESS always;
END add_vhdl_arch;
此帖出自
小平头技术问答
一周热门 更多>