Himage (std_logic_vector) function, Himage (integer) function, Verilog hdl formatting functions – Altera IP Compiler for PCI Express User Manual
Page 279: Himage1

Chapter 15: Testbench and Design Example
15–47
BFM Procedures and Functions
August 2014
Altera Corporation
IP Compiler for PCI Express User Guide
himage (std_logic_vector) Function
The himage function is a utility routine that returns a hexadecimal string
representation of the std_logic_vector argument. The string is the length of the
std_logic_vector
divided by four (rounded up). You can control the length of the
string by padding or truncating the argument as needed.
himage (integer) Function
The himage function is a utility routine that returns a hexadecimal string
representation of the integer argument. The string is the length specified by the hlen
argument.
Verilog HDL Formatting Functions
The following procedures and functions are available in the Verilog HDL include file
altpcietb_bfm_log.v
that uses the altpcietb_bfm_log_common.v module,
instantiated at the top level of the testbench. This section outlines formatting
functions that are only used by Verilog HDL. All these functions take one argument of
a specified length and return a vector of a specified length.
himage1
This function creates a one-digit hexadecimal string representation of the input
argument that can be concatenated into a larger message string and passed to
ebfm_display
.
Table 15–46. himage (std_logic_vector) Function
Location
altpcietb_bfm_log.vhd
Syntax
string:= himage(vec)
Argument
vec
This argument is a std_logic_vector that is converted to a hexadecimal string.
Return
string
Hexadecimal formatted string representation of the argument
Table 15–47. himage (integer) Function
Location
altpcietb_bfm_log.vhd
Syntax
string:= himage(num, hlen
)
Arguments
num
Argument of type integer that is converted to a hexadecimal string.
hlen
Length of the returned string. The string is truncated or padded with 0s on the right as
needed.
Return
string
Hexadecimal formatted string representation of the argument.
Table 15–48. himage1
Location
altpcietb_bfm_log.v
syntax
string:= himage(vec)
Argument
vec
Input data type reg with a range of 3:0.
Return range
string
Returns a 1-digit hexadecimal representation of the input argument. Return data is type
reg
with a range of 8:1