我写了代码,但 ModelSim 说:
“unsigned2hexstring”不是运算符符号。
我应该改变什么以及如何使用我的库之类的包?会不会喜欢:图书馆ieee;使用 ieee.std_logic_1164.all;使用 work.prosoft_std.all ???
library ieee;
use ieee.std_logic_1164.all;
package prosoft_std is
constant CopyRigthNotice : string := "Copyright 2016 Prosoft. All rights reserved.";
type UNSIGNED is array (NATURAL range <>) of STD_LOGIC;
type SIGNED is array (NATURAL range <>) of STD_LOGIC;
function "unsigned2hexString" (ARG: UNSIGNED) return SIGNED;
end prosoft_std;
package body prosoft_std is
function "unsigned2hexString" (ARG : UNSIGNED) return UNSIGNED is
variable lengthVect : integer;
variable useThatVect : UNSIGNED:= ARG;
begin
lengthVect := ARG'length rem 4;
if (lengthVect != 0) then
for i in 0 to lengthVect loop
useThatVect := '0' & useThatVect;
end loop;
end if;
return useThatVect;
end "unsigned2hexString";
end prosoft_std;