1

コードを書きましたが、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; 
4

0 に答える 0