1

I wrote code, but ModelSim said :

"unsigned2hexstring" is not an operator symbol.

What should I change and how use mine package like library? Is it will like : library ieee; use ieee.std_logic_1164.all; use 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; 
  • 2
    Delete the quotes. You'll have to use function call syntax when you call it though, not operator syntax like `a + b`. Oh, and either fix its name or its return type, at the moment it's VERY misleading. –  Nov 15 '16 at 11:38
  • An operator symbol is a string literal (graphic characters enclosed in double quotations). A function designator is either an identifier or an operator symbol. IEEE Std 1076-2008 4.2 Subprogram declarations. Further the 'operators that may be used in expressions are defined' in 9.2 Operators, 9.2.1 (you are not allowed to define your own operators). It appears you want to use an identifier (drop the double quotations). -2008 packages std_logic_1164 and numeric_std provide a to_hstring function that does what your function does. Note type UNSIGNED is declared in package numeric_std. –  Nov 15 '16 at 17:09
  • IEEE Std 1076-2008 Appendix A Description of accompanying files tells how to download the IEEE VHDL package declarations and bodies. ([IEEE-SA Supplemental Material](http://standards.ieee.org/downloads/1076/1076-2008/) file 1076-2008_machine-readable.zip, when expanded subdirectory ieee). –  Nov 15 '16 at 17:52

0 Answers0