我写了代码,但ModelSim说:
" unsigned2hexstring"不是运营商的象征。
我应该改变什么以及如何使用我的包像库? 会是这样的: 图书馆; 使用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;