|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
求助:VHDL中的PROCEDURE无法编译通过
把Verilog代码用工具转换成了VHDL,结果仿真文件中的task都被翻译为PROCEDURE,但Modelsim无法编译通过。
以下是完整代码,请各位大神帮忙:
----------------------------------------------------------------------------------------------
--
-- VHDL file generated by X-HDL - Revision 3.2.37 Dec. 3, 2003
-- Sat Jun 22 11:41:10 2013
--
-- Input file : E:/modelsim_work/111_vhdl/test_pkg.v
-- Design name : test_pkg
-- Author :
-- Company :
--
-- Description :
--
--
----------------------------------------------------------------------------------------------
--
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
use IEEE.std_logic_unsigned.all;
use IEEE.std_logic_signed;
use IEEE.std_logic_arith.all;
library work;
ENTITY test_pkg IS
END test_pkg;
ARCHITECTURE translated OF test_pkg IS
CONSTANT xhdl_timescale : time := 1 ns;
COMPONENT INFO_PKG
PORT (
clk : IN std_logic;
rst : IN std_logic;
val_a : IN std_logic;
ip_dest_a : IN std_logic_vector(31 DOWNTO 0);
val_m : IN std_logic;
type_m : IN std_logic_vector(1 DOWNTO 0);
port_sour_m : IN std_logic_vector(3 DOWNTO 0);
ip_sour_m : IN std_logic_vector(31 DOWNTO 0);
ip_dest_m : IN std_logic_vector(31 DOWNTO 0);
mpkg_sel : IN std_logic;
apkg_sel : IN std_logic;
mpkg0 : OUT std_logic_vector(31 DOWNTO 0);
mpkg1 : OUT std_logic_vector(31 DOWNTO 0);
mpkg2 : OUT std_logic_vector(31 DOWNTO 0);
mpkg3 : OUT std_logic_vector(31 DOWNTO 0);
mpkg4 : OUT std_logic_vector(31 DOWNTO 0);
cpu_m_int : OUT std_logic;
apkg : OUT std_logic_vector(31 DOWNTO 0);
cpu_a_int : OUT std_logic
);
END COMPONENT;
SIGNAL clk : std_logic;
SIGNAL rst : std_logic;
SIGNAL val_a : std_logic;
SIGNAL ip_dest_a : std_logic_vector(31 DOWNTO 0);
SIGNAL val_m : std_logic;
SIGNAL type_m : std_logic_vector(1 DOWNTO 0);
SIGNAL port_sour_m : std_logic_vector(3 DOWNTO 0);
SIGNAL ip_sour_m : std_logic_vector(31 DOWNTO 0);
SIGNAL ip_dest_m : std_logic_vector(31 DOWNTO 0);
SIGNAL cpu_int : std_logic;
SIGNAL cnt : std_logic_vector(31 DOWNTO 0);
SIGNAL mpkg0 : std_logic_vector(31 DOWNTO 0);
SIGNAL mpkg1 : std_logic_vector(31 DOWNTO 0);
SIGNAL mpkg2 : std_logic_vector(31 DOWNTO 0);
SIGNAL mpkg3 : std_logic_vector(31 DOWNTO 0);
SIGNAL mpkg4 : std_logic_vector(31 DOWNTO 0);
SIGNAL apkg : std_logic_vector(31 DOWNTO 0);
SIGNAL mpkg_sel : std_logic;
SIGNAL apkg_sel : std_logic;
SIGNAL cpu_a_int : std_logic;
SIGNAL cpu_m_int : std_logic;
PROCEDURE write_a (
ip_dest_ain : IN std_logic_vector(31 DOWNTO 0))IS
BEGIN
WAIT UNTIL (clk'EVENT AND clk = '1');
val_a <= '1';
ip_dest_a <= ip_dest_ain;
WAIT UNTIL (clk'EVENT AND clk = '1');
val_a <= '0';
ip_dest_a <= "00000000000000000000000000000000";
END write_a;
PROCEDURE write_m (
type_min : IN std_logic_vector(1 DOWNTO 0);
port_sour_min : IN std_logic_vector(3 DOWNTO 0);
ip_sour_min : IN std_logic_vector(31 DOWNTO 0);
ip_dest_min : IN std_logic_vector(31 DOWNTO 0))IS
BEGIN
WAIT UNTIL (clk'EVENT AND clk = '1');
val_m <= '1';
type_m <= type_min;
port_sour_m <= port_sour_min;
ip_sour_m <= ip_sour_min;
ip_dest_m <= ip_dest_min;
WAIT UNTIL (clk'EVENT AND clk = '1');
val_m <= '0';
type_m <= "00";
port_sour_m <= "0000";
ip_sour_m <= "00000000000000000000000000000000";
ip_dest_m <= "00000000000000000000000000000000";
END write_m;
BEGIN
PROCESS
VARIABLE xhdl_initial : BOOLEAN := TRUE;
BEGIN
IF (xhdl_initial) THEN
clk <= '0';
rst <= '0';
WAIT UNTIL (clk'EVENT AND clk = '1');
rst <= '1';
FOR X IN 1 TO 2 LOOP
WAIT UNTIL (clk'EVENT AND clk = '1');
END LOOP;
rst <= '0';
cnt <= "00000000000000000000000000000000";
FOR X IN 1 TO 8 LOOP
cnt <= cnt + "00000000000000000000000000000001";
-- <<X-HDL>> Warning - Subprogram write_m referenced before declared. Parameter size/type may be wrong
write_m("11", "1111", cnt, cnt + "00000000000000000000000000010100");
FOR X IN 1 TO 40 LOOP
WAIT UNTIL (clk'EVENT AND clk = '1');
END LOOP;
END LOOP;
-- <<X-HDL>> Warning - Subprogram write_m referenced before declared. Parameter size/type may be wrong
write_m("11", "1111", '1', "0000000000000000000010101");
FOR X IN 1 TO 40 LOOP
WAIT UNTIL (clk'EVENT AND clk = '1');
END LOOP;
-- <<X-HDL>> Warning - Subprogram write_m referenced before declared. Parameter size/type may be wrong
write_m("11", "1111", '0', "0000000000000000000010101");
WAIT FOR 600 ns;
cnt <= "00000000000000000000000000000000";
FOR X IN 1 TO 8 LOOP
cnt <= cnt + "00000000000000000000000000000001";
-- <<X-HDL>> Warning - Subprogram write_a referenced before declared. Parameter size/type may be wrong
write_a(cnt);
FOR X IN 1 TO 40 LOOP
WAIT UNTIL (clk'EVENT AND clk = '1');
END LOOP;
END LOOP;
-- <<X-HDL>> Warning - Subprogram write_a referenced before declared. Parameter size/type may be wrong
write_a(3);
FOR X IN 1 TO 40 LOOP
WAIT UNTIL (clk'EVENT AND clk = '1');
END LOOP;
-- <<X-HDL>> Warning - Subprogram write_a referenced before declared. Parameter size/type may be wrong
write_a(25);
WAIT FOR 600 ns;
ASSERT (FALSE) REPORT "'$stop' Encountered" SEVERITY FAILURE;
xhdl_initial := FALSE;
ELSE
WAIT;
END IF;
END PROCESS;
PROCESS
BEGIN
WAIT FOR 5 ns;
clk <= NOT clk;
END PROCESS;
PROCESS
BEGIN
WAIT UNTIL (clk'EVENT AND clk = '1') OR (rst'EVENT AND rst = '1');
IF (rst = '1') THEN
mpkg_sel <= '0';
ELSE
IF (cpu_m_int = '1') THEN
mpkg_sel <= '1';
ELSE
IF (NOT cpu_m_int = '1') THEN
mpkg_sel <= '0';
ELSE
mpkg_sel <= mpkg_sel;
END IF;
END IF;
END IF;
END PROCESS;
PROCESS
BEGIN
WAIT UNTIL (clk'EVENT AND clk = '1') OR (rst'EVENT AND rst = '1');
IF (rst = '1') THEN
apkg_sel <= '0';
ELSE
IF (cpu_a_int = '1') THEN
apkg_sel <= '1';
ELSE
IF (NOT cpu_a_int = '1') THEN
apkg_sel <= '0';
ELSE
apkg_sel <= apkg_sel;
END IF;
END IF;
END IF;
END PROCESS;
-- <<X-HDL>> Can't find translated component 'INFO_PKG'. Port & generic names and types may not match. No template will be included
U_INFO_PKG : INFO_PKG
PORT MAP (
clk => clk,
rst => rst,
val_a => val_a,
ip_dest_a => ip_dest_a,
val_m => val_m,
type_m => type_m,
port_sour_m => port_sour_m,
ip_sour_m => ip_sour_m,
ip_dest_m => ip_dest_m,
mpkg_sel => mpkg_sel,
apkg_sel => apkg_sel,
cpu_m_int => cpu_m_int,
mpkg0 => mpkg0,
mpkg1 => mpkg1,
mpkg2 => mpkg2,
mpkg3 => mpkg3,
mpkg4 => mpkg4,
cpu_a_int => cpu_a_int,
apkg => apkg);
END translated; |
|