16–36
Chapter 16: Testbench and Design Example
BFM Procedures and Functions
Arria V GZ Hard IP for PCI Express
November 2012
Altera Corporation
shmem_write
The
shmem_write
procedure writes data to the BFM shared memory.
shmem_read Function
The
shmem_read
function reads data to the BFM shared memory.
shmem_display Verilog HDL Function
The
shmem_display
Verilog HDL function displays a block of data from the BFM
shared memory.
Table 16–31. shmem_write Verilog HDL Task
Location
altpcietb_bfm_driver_rp.v
Syntax
shmem_write(addr, data, leng)
Arguments
addr
BFM shared memory starting address for writing data
data
Data to write to BFM shared memory.
This parameter is implemented as a 64-bit vector.
leng
is 1–8 bytes. Bits 7 downto 0 are
written to the location specified by
addr
; bits 15 downto 8 are written to the
addr+1
location, etc.
leng
Length, in bytes, of data written
Table 16–32. shmem_read Function
Location
altpcietb_bfm_driver_rp.v
Syntax
data:= shmem_read(addr, leng)
Arguments
addr
BFM shared memory starting address for reading data
leng
Length, in bytes, of data read
Return
data
Data read from BFM shared memory.
This parameter is implemented as a 64-bit vector.
leng
is 1- 8 bytes. If
leng
is less than 8
bytes, only the corresponding least significant bits of the returned data are valid.
Bits 7 downto 0 are read from the location specified by
addr
; bits 15 downto 8 are read from
the addr+1 location, etc.
Table 16–33. shmem_display Verilog Function
Location
altpcietb_bfm_driver_rp.v
Syntax
Verilog HDL:
dummy_return:=shmem_display(addr, leng, word_size, flag_addr, msg_type);
Arguments
addr
BFM shared memory starting address for displaying data.
leng
Length, in bytes, of data to display.
word_size
Size of the words to display. Groups individual bytes into words. Valid values are 1, 2, 4, and
8.
flag_addr
Adds a <== flag to the end of the display line containing this address. Useful for marking
specific data. Set to a value greater than 2**21 (size of BFM shared memory) to suppress the
flag.
msg_type
Specifies the message type to be displayed at the beginning of each line. See
Message Procedures” on page 16–37
for more information about message types. Set to one
of the constants defined in