Chapter 16: Testbench and Design Example
16–37
BFM Procedures and Functions
November 2012
Altera Corporation
Arria V GZ Hard IP for PCI Express
shmem_fill Procedure
The
shmem_fill
procedure fills a block of BFM shared memory with a specified data
pattern.
shmem_chk_ok Function
The
shmem_chk_ok
function checks a block of BFM shared memory against a specified
data pattern.
BFM Log and Message Procedures
The following procedures and functions are available in the Verilog HDL include file
altpcietb_bfm_driver_rp.v.
These procedures provide support for displaying messages in a common format,
suppressing informational messages, and stopping simulation on specific message
types.
The following constants define the type of message and their values determine
whether a message is displayed or simulation is stopped after a specific message.
Each displayed message has a specific prefix, based on the message type in
.
Table 16–34. shmem_fill Procedure
Location
altpcietb_bfm_driver_rp.v
Syntax
shmem_fill(addr, mode, leng, init)
Arguments
addr
BFM shared memory starting address for filling data.
mode
Data pattern used for filling the data. Should be one of the constants defined in section
“Shared Memory Constants” on page 16–35
.
leng
Length, in bytes, of data to fill. If the length is not a multiple of the incrementing data pattern
width, then the last data pattern is truncated to fit.
init
Initial data value used for incrementing data pattern modes. This argument is
reg [63:0]
.
The necessary least significant bits are used for the data patterns that are smaller than 64
bits.
Table 16–35. shmem_chk_ok Function
Location
altpcietb_bfm_shmem.v
Syntax
result:= shmem_chk_ok(addr, mode, leng, init, display_error)
Arguments
addr
BFM shared memory starting address for checking data.
mode
Data pattern used for checking the data. Should be one of the constants defined in
section
“Shared Memory Constants” on page 16–35
.
leng
Length, in bytes, of data to check.
init
This argument is
reg [63:0]
.The necessary least significant bits are used for the data
patterns that are smaller than 64-bits.
display_error
When set to 1, this argument displays the mis-comparing data on the simulator standard
output.
Return
Result
Result is 1-bit.
1’b1 — Data patterns compared successfully
1’b0 — Data patterns did not compare successfully