Shared memory constants, Shmem_write, Shmem_read function – Altera IP Compiler for PCI Express User Manual
Page 273

Chapter 15: Testbench and Design Example
15–41
BFM Procedures and Functions
August 2014
Altera Corporation
IP Compiler for PCI Express User Guide
Shared Memory Constants
The following constants are defined in the BFM shared memory package. They select
a data pattern in the shmem_fill and shmem_chk_ok routines. These shared memory
constants are all VHDL subtype natural or Verilog HDL type integer.
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.
Table 15–33. Constants: VHDL Subtype NATURAL or Verilog HDL Type INTEGER
Constant Description
SHMEM_FILL_ZEROS
Specifies a data pattern of all zeros
SHMEM_FILL_BYTE_INC
Specifies a data pattern of incrementing 8-bit bytes (0x00, 0x01, 0x02, etc.)
SHMEM_FILL_WORD_INC
Specifies a data pattern of incrementing 16-bit words (0x0000, 0x0001, 0x0002, etc.)
SHMEM_FILL_DWORD_INC
Specifies a data pattern of incrementing 32-bit dwords (0x00000000, 0x00000001,
0x00000002, etc.)
SHMEM_FILL_QWORD_INC
Specifies a data pattern of incrementing 64-bit qwords (0x0000000000000000,
0x0000000000000001, 0x0000000000000002, etc.)
SHMEM_FILL_ONE
Specifies a data pattern of all ones
Table 15–34. shmem_write VHDL Procedure or Verilog HDL Task
Location
altpcietb_bfm_shmem.v or altpcietb_bfm_shmem.vhd
Syntax
shmem_write(addr, data, leng)
Arguments
addr
BFM shared memory starting address for writing data
data
Data to write to BFM shared memory.
In VHDL, this argument is an unconstrained std_logic_vector. This vector must be 8
times the leng length. In Verilog, this parameter is implemented as a 64-bit vector. leng is
1–8 bytes. In both languages, 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 15–35. shmem_read Function
Location
altpcietb_bfm_shmem.v or altpcietb_bfm_shmem.vhd
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.
In VHDL, this is an unconstrained std_logic_vector, in which the vector is 8 times the
leng
length. In Verilog, 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.
In both languages, bits 7 downto 0 are read from the location specified by addr; bits 15
downto 8 are read from the addr+1 location, etc.