cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
Memtest HLS

This is a subgroup of Memtest accelerated function with only synthesizable (HLS) functions/classes. More...

Collaboration diagram for Memtest HLS:

Files

file  memtest.hpp
 The Role for a Memtest Example application (UDP or TCP)
 
file  memtest_library.hpp
 A library for some common functionalities: Network-Related Memory interaction Performance Counters.
 
file  memtest_pattern_library.hpp
 A library for memory test functionalities: sequence generation, reading, writing.
 
file  memtest_processing.hpp
 The processing template for the memory test.
 
file  memtest.cpp
 The Role for a Memtest Example application (UDP or TCP)
 

Macros

#define ENABLE_DDR
 
#define ROLE_IS_MEMTEST
 
#define MEMTEST_COMMANDS_HIGH_BIT   MEMTEST_COMMANDS_BITWIDTH-1
 
#define MEMTEST_COMMANDS_LOW_BIT   0
 
#define MEMTEST_COMMANDS_BITWIDTH   8
 
#define WAIT_FOR_META   0
 
#define WAIT_FOR_STREAM_PAIR   1
 
#define PROCESSING_PACKET   2
 
#define MEMTEST_RETURN_RESULTS   3
 
#define PacketFsmType   uint8_t
 
#define FSM_WRITE_NEW_DATA   0
 
#define FSM_DONE   1
 
#define PortFsmType   uint8_t
 
#define DEFAULT_TX_PORT   2718
 
#define DEFAULT_RX_PORT   2718
 
#define MEMDW_512   512
 
#define TOTMEMDW_512   16384
 
#define CYCLES_UNTIL_TIMEOUT   0x0100
 
#define TYPICAL_DDR_LATENCY   4
 
#define DDR_LATENCY   52
 
#define EXTRA_DDR_LATENCY_DUE_II   (64 + 8)
 
#define LOCAL_MEM_WORD_SIZE   512
 
#define LOCAL_MEM_ADDR_SIZE   40
 
#define LOCAL_MEM_ADDR_SIZE_NON_BYTE_ADDRESSABLE   40
 
#define LOCAL_MEM_ADDR_OFFSET   (LOCAL_MEM_WORD_SIZE/8)
 
#define LOCAL_MEM_WORD_BYTE_SIZE   (LOCAL_MEM_WORD_SIZE/8)
 
#define FAULT_INJECTION
 
#define FSM_PROCESSING_WAIT_FOR_META   0
 
#define FSM_PROCESSING_PCKT_PROC   1
 
#define FSM_PROCESSING_STOP   2
 
#define FSM_PROCESSING_START   3
 
#define FSM_PROCESSING_BURST_READING   4
 
#define FSM_PROCESSING_DATAFLOW_WRITE   5
 
#define FSM_PROCESSING_DATAFLOW_READ   6
 
#define FSM_PROCESSING_OUTPUT   7
 
#define FSM_PROCESSING_OUTPUT_2   8
 
#define FSM_PROCESSING_OUTPUT_3   9
 
#define FSM_PROCESSING_OUTPUT_4   10
 
#define FSM_PROCESSING_OUTPUT_5   11
 
#define FSM_PROCESSING_CONTINUOUS_RUN   12
 
#define FSM_PROCESSING_WAIT_FOR_DDR_CONTROLLER_EMPTYNESS   13
 
#define ProcessingFsmType   uint8_t
 
#define MEMTEST_ADDRESS_BITWIDTH   40
 
#define MEMTEST_ITERATION_BITWIDTH   16
 
#define MEMTEST_BURST_BITWIDTH   16
 
#define MEMTEST_ADDRESS_HIGH_BIT   NETWORK_WORD_BIT_WIDTH-1
 
#define MEMTEST_ADDRESS_LOW_BIT   NETWORK_WORD_BIT_WIDTH-MEMTEST_ADDRESS_BITWIDTH
 
#define MEMTEST_ITERATIONS_HIGH_BIT   MEMTEST_ADDRESS_LOW_BIT-1
 
#define MEMTEST_ITERATIONS_LOW_BIT   MEMTEST_ITERATIONS_HIGH_BIT+1-MEMTEST_ITERATION_BITWIDTH
 
#define MEMTEST_BURST_HIGH_BIT   MEMTEST_BURST_BITWIDTH-1+MEMTEST_COMMANDS_BITWIDTH
 
#define MEMTEST_BURST_LOW_BIT   MEMTEST_BURST_HIGH_BIT+1-MEMTEST_BURST_BITWIDTH
 
#define Data_t_in   ap_axiu<INPUT_PTR_WIDTH, 0, 0, 0>
 
#define Data_t_out   ap_axiu<OUTPUT_PTR_WIDTH, 0, 0, 0>
 

Typedefs

typedef ap_uint< 512 > membus_512_t
 
typedef membus_512_t membus_t
 
typedef ap_uint< 512 > local_mem_word_t
 
typedef ap_uint< 40 > local_mem_addr_t
 
typedef ap_uint< 40 > local_mem_addr_non_byteaddressable_t
 

Enumerations

enum  EchoCtrl {
  ECHO_PATH_THRU = 0 , ECHO_STORE_FWD = 1 , ECHO_OFF = 2 , ECHO_PATH_THRU = 0 ,
  ECHO_STORE_FWD = 1 , ECHO_OFF = 2 , ECHO_PATH_THRU = 0 , ECHO_STORE_FWD = 1 ,
  ECHO_OFF = 2 , ECHO_PATH_THRU = 0 , ECHO_STORE_FWD = 1 , ECHO_OFF = 2 ,
  ECHO_PATH_THRU = 0 , ECHO_STORE_FWD = 1 , ECHO_OFF = 2 , ECHO_PATH_THRU = 0 ,
  ECHO_STORE_FWD = 1 , ECHO_OFF = 2 , ECHO_PATH_THRU = 0 , ECHO_STORE_FWD = 1 ,
  ECHO_OFF = 2 , ECHO_STORE_FWD = 0 , ECHO_PATH_THRU = 1 , ECHO_CTRL_DISABLED = 0 ,
  ECHO_PATH_THRU = 1 , ECHO_STORE_FWD = 2 , ECHO_OFF = 3
}
 
enum  MemTestCmd {
  TEST_BURSTSIZE_CMD = 4 , TEST_ENDOFTESTS_CMD = 3 , TEST_STOP_CMD = 2 , TEST_START_CMD = 1 ,
  TEST_INVLD_CMD = 0 , WRPTX_IMG_CMD = 2 , WRPTX_TXMAT_CMD = 1 , WRPTX_INVLD_CMD = 0
}
 

Functions

void memtest (ap_uint< 32 > *pi_rank, ap_uint< 32 > *pi_size, stream< NetworkWord > &siSHL_This_Data, stream< NetworkWord > &soTHIS_Shl_Data, stream< NetworkMetaStream > &siNrc_meta, stream< NetworkMetaStream > &soNrc_meta, ap_uint< 32 > *po_rx_ports, membus_t *lcl_mem0, membus_t *lcl_mem1)
 Main process of the Memtest Application directives. More...
 
void pPortAndDestionation (ap_uint< 32 > *pi_rank, ap_uint< 32 > *pi_size, stream< NodeId > &sDstNode_sig, ap_uint< 32 > *po_rx_ports)
 pPortAndDestionation - Setup the port and the destination rank. More...
 
void pRXPath (stream< NetworkWord > &siSHL_This_Data, stream< NetworkMetaStream > &siNrc_meta, stream< NetworkMetaStream > &sRxtoProc_Meta, stream< NetworkWord > &sRxpToProcp_Data, NetworkMetaStream meta_tmp, bool *start_stop, unsigned int *processed_word_rx, unsigned int *processed_bytes_rx)
 Receive Path - From SHELL to THIS. More...
 
void pTXPath (stream< NetworkWord > &soTHIS_Shl_Data, stream< NetworkMetaStream > &soNrc_meta, stream< NetworkWord > &sProcpToTxp_Data, stream< NetworkMetaStream > &sRxtoTx_Meta, stream< NodeId > &sDstNode_sig, unsigned int *processed_word_tx, ap_uint< 32 > *pi_rank)
 Transmit Path - From THIS to SHELL. More...
 
template<typename Tin , typename Tout , unsigned int arraysize>
void pMyMemtestMemCpy (Tin *in, Tout *out)
 Copy a fixed compile time amount of data to another array. More...
 
template<typename Tin , typename Tout , const unsigned int arraysize>
void pMemCpyCircularBuff (Tin *buff, Tout *out_mem, unsigned int elems, unsigned int offset_buff)
 Copy a run-time variable amount of data to another array employing the src as circular buffer i.e., handling overflow. More...
 
template<typename Tin , typename Tout , const unsigned int burstsize>
void pReadAxiMemMapped2HlsStream (Tin *main_mem, hls::stream< Tout > &sOut, unsigned int elems)
 Copy a run-time variable amount of data to an hls stream with a given max. More...
 
template<typename Tin , typename Tout , const unsigned int burstsize, typename Tcntr >
void pReadAxiMemMapped2HlsStreamCountFirst (Tin *main_mem, hls::stream< Tout > &sOut, unsigned int elems, hls::stream< Tcntr > &cmd)
 Copy a run-time variable amount of data to an hls stream with a given max it assumes also the initialization of a perf counter of "perfCounterMultipleCounts" function. More...
 
template<typename Tin , typename Tout , const unsigned int burstsize, typename Tcntr >
void pReadAxiMemMapped2HlsStreamCountActivated (Tin *main_mem, hls::stream< Tout > &sOut, unsigned int elems, hls::stream< Tcntr > &cmd)
 Copy a run-time variable amount of data to an hls stream with a given max it assumes "perfCounterMultipleCounts" function already initialized so it just incr. More...
 
template<typename Tin , typename Tout , const unsigned int burstsize, typename Tcntr >
void pReadAxiMemMapped2HlsStreamCountExtern (Tin *main_mem, hls::stream< Tout > &sOut, unsigned int elems, hls::stream< Tcntr > &cmd, bool activated)
 Copy a run-time variable amount of data to an hls stream with a given max it assumes "perfCounterMultipleCounts" function already initialized so it just incr. More...
 
template<typename Tin , typename Tout , unsigned int counter_precision = 64>
void perfCounterProc (hls::stream< Tin > &cmd, hls::stream< Tout > &out, int direction, int burst_length, int nmbr_outstanding)
 
template<typename Tin , typename Tout , unsigned int counter_precision = 64>
void perfCounterProc2Mem (hls::stream< Tin > &cmd, Tout *out, int direction, int burst_length, int nmbr_outstanding)
 
template<typename Tin , typename Tout , unsigned int counter_precision = 64>
void perfCounterProc2MemCountOnly (hls::stream< Tin > &cmd, Tout *out)
 Count Clock Cycles between two events, the first event init the counter the second stop the count. More...
 
template<typename Tin , typename Tout , unsigned int counter_precision = 64>
void perfCounterProc2MemCountIncremental (hls::stream< Tin > &cmd, Tout *out)
 Count Clock Cycles between two events, the first event init the counter the second stop the count and increment the out register TODO: seems not working at the csim lvl (never tested below) when executing single DUT step, hanging stream values. More...
 
template<typename Tin , typename Tout , unsigned int counter_precision = 64>
void perfCounterMultipleCounts (hls::stream< Tin > &cmd, Tout *out)
 Count Clock Cycles between two events, the first event init the counter the second stop the count, a 0 after the init stop definitevely the counter. More...
 
template<typename Tevent = bool, const unsigned int counter_width = 32, const unsigned int maximum_counter_value_before_reset = 4000000>
void pCountClockCycles (hls::stream< Tevent > &sOfEnableCCIncrement, hls::stream< Tevent > &sOfResetCounter, hls::stream< Tevent > &sOfGetTheCounter, hls::stream< ap_uint< counter_width > > &oSClockCounter)
 Count Clock Cycles between two events first sketch TODO: make it working without counting with the stream or reshaping as FSM. More...
 
template<typename Tin , typename Tout >
Tout genNextFibonacciNumber (Tin curr, Tin prev)
 
template<typename ADDR_T , unsigned int sequenceDim, typename BIGWORD_T , typename SMALLWORD_T , unsigned int smallWordDim>
void genFibonacciNumbers (ADDR_T curr, BIGWORD_T *outBigWord)
 
template<typename ADDR_T , unsigned int sequenceDim, typename BIGWORD_T , typename SMALLWORD_T , unsigned int smallWordDim>
void genXoredSequentialNumbers (ADDR_T curr, BIGWORD_T *outBigWord)
 
template<typename ADDR_T , unsigned int sequenceDim, typename BIGWORD_T , typename SMALLWORD_T , unsigned int smallWordDim>
void genXoredSequentialNumbersSecondVersion (ADDR_T curr, BIGWORD_T *outBigWord)
 
template<typename ADDR_T , typename BIGWORD_T >
void genXoredNumbersSingleWord (ADDR_T curr, BIGWORD_T *outBigWord)
 
template<typename ADDR_T , typename BIGWORD_T >
void genSequentialNumbers (ADDR_T curr, BIGWORD_T *outBigWord)
 
template<const unsigned int max_iterations = 4000000, const unsigned int buff_dim = 16>
void pWRGenerateData2WriteOnStream (hls::stream< local_mem_word_t > &sOutGeneratedData, ap_uint< 32 > *testCounter, local_mem_addr_t max_addr_ut)
 A function that generate a streams of data according to function and writes them on a stream CHECK: FAULT_INJECTION define insert after the third test some faults. More...
 
template<typename Tcntr , const unsigned int max_iterations = 4000000, const unsigned int buff_dim = 64*2>
void pWRStream2WriteMainMemory (hls::stream< Tcntr > &sOutCmd, hls::stream< local_mem_word_t > &sInGeneratedData, membus_t *lcl_mem, local_mem_addr_t max_addr_ut, unsigned int burst_size)
 A function that read a stream of data and write them in a run-time variable burst-size. More...
 
template<typename Tcntr , const unsigned int max_iterations = 4000000, const unsigned int buff_dim = 64*2>
void pWriteSimplerTestMemTest (hls::stream< Tcntr > &sOutCmd, membus_t *lcl_mem, local_mem_addr_t max_addr_ut, unsigned int burst_size)
 Simple version of a write memtest that write up to a given maximum address No control on the burst size or on the first faulty address. More...
 
template<typename Tcntr , const unsigned int max_iterations = 4000000, const unsigned int buff_dim = 64*2>
void pReadSimplerTestMemTest (hls::stream< Tcntr > &sOutCmd, membus_t *lcl_mem, local_mem_addr_t max_addr_ut, unsigned int burst_size, ap_uint< 32 > *faulty_addresses_cntr, local_mem_addr_t *first_faulty_address)
 Simple version of a read memtest that read up to a given maximum address No control on the burst size or on the first faulty address. More...
 
template<typename Tcntr , const unsigned int max_iterations = 4000000, const unsigned int buff_dim = 64*2>
void pRDRead2StreamDataVariableBurstNoMemCpy (hls::stream< Tcntr > &sOutCmd, hls::stream< local_mem_word_t > &sOutReadData, membus_t *lcl_mem, local_mem_addr_t max_addr_ut, unsigned int burst_size)
 Read a variable burst_size amount of data and output on a stream and count the cc needed just 4 transfer but without using memcpy. More...
 
template<const unsigned int max_iterations = 4000000>
void pRDReadDataStreamAndProduceGold (hls::stream< local_mem_word_t > &sInReadData, local_mem_addr_t max_addr_ut, hls::stream< local_mem_word_t > &sOutReadData, hls::stream< local_mem_word_t > &sOutGoldData)
 Read a data stream and produce the gold expected value. More...
 
template<const unsigned int max_iterations = 4000000, const unsigned int buff_dim = 16>
void pRDCmpStreamsCntWordAligned (local_mem_addr_t max_addr_ut, hls::stream< local_mem_word_t > &sInReadData, hls::stream< local_mem_word_t > &sInGoldData, ap_uint< 32 > *faulty_addresses_cntr, local_mem_addr_t *first_faulty_address)
 Read two streams, compare them and output the number of faults and the first faulty address. More...
 
template<const unsigned int max_iterations = 4000000, const unsigned int unrolling_factor = ( 512 /8), const unsigned int buff_dim = 16>
void pRDCompareDataStreamsCount (local_mem_addr_t max_addr_ut, hls::stream< local_mem_word_t > &sInReadData, hls::stream< local_mem_word_t > &sInGoldData, ap_uint< 32 > *faulty_addresses_cntr, local_mem_addr_t *first_faulty_address)
 Read two streams, compare them and output the number of faults and the first faulty address, but check every single byte NOT USED. More...
 
template<typename Tcntr , const unsigned int max_iterations = 4000000, const unsigned int buff_dim = 64*2>
void pRDMainMemoryRead2StreamData (hls::stream< Tcntr > &sOutCmd, hls::stream< local_mem_word_t > &sOutreadData, membus_t *lcl_mem, local_mem_addr_t max_addr_ut, unsigned int burst_size)
 Read a single word of data and output on a stream and count the cc needed just 4 transfer
NOT USED. More...
 
template<typename Tcntr , const unsigned int max_iterations = 4000000, const unsigned int buff_dim = 64*2>
void pRDRead2StreamDataVariableBurst (hls::stream< Tcntr > &sOutCmd, hls::stream< local_mem_word_t > &sOutreadData, membus_t *lcl_mem, local_mem_addr_t max_addr_ut, unsigned int burst_size)
 Read a variable burst_size amount of data and output on a stream and count the cc needed just 4 transfer
THIS FUNCTION SUFFER FIFO OVERFLOW 4 transfer different from power of 2 numbers NOT USED. More...
 
template<const unsigned int maximum_number_of_beats = 512>
void pWriteDataflowMemTest (membus_t *lcl_mem0, local_mem_addr_t max_address_under_test, ap_uint< 64 > *writing_cntr, ap_uint< 32 > *testCounter, unsigned int burst_size)
 
template<const unsigned int maximum_number_of_beats = 512>
void pReadDataflowMemTest (membus_t *lcl_mem1, local_mem_addr_t max_address_under_test, ap_uint< 64 > *reading_cntr, ap_uint< 32 > *faulty_addresses_cntr, local_mem_addr_t *first_faulty_address, unsigned int burst_size)
 
template<const unsigned int counter_width = 64>
void pTHISProcessingData (stream< NetworkWord > &sRxpToProcp_Data, stream< NetworkWord > &sProcpToTxp_Data, stream< NetworkMetaStream > &sRxtoProc_Meta, stream< NetworkMetaStream > &sProctoTx_Meta, bool *start_stop)
 THIS processing the data once recieved a start command Template function for custom processing. More...
 

Variables

const unsigned long int max_counter_cc = 4000000
 
const unsigned int top_param_maximum_number_of_beats = 4096
 

Detailed Description

This is a subgroup of Memtest accelerated function with only synthesizable (HLS) functions/classes.

Macro Definition Documentation

◆ CYCLES_UNTIL_TIMEOUT

#define CYCLES_UNTIL_TIMEOUT   0x0100

Definition at line 96 of file memtest.hpp.

◆ Data_t_in

#define Data_t_in   ap_axiu<INPUT_PTR_WIDTH, 0, 0, 0>

Definition at line 29 of file memtest.cpp.

◆ Data_t_out

#define Data_t_out   ap_axiu<OUTPUT_PTR_WIDTH, 0, 0, 0>

Definition at line 30 of file memtest.cpp.

◆ DDR_LATENCY

#define DDR_LATENCY   52

Definition at line 98 of file memtest.hpp.

◆ DEFAULT_RX_PORT

#define DEFAULT_RX_PORT   2718

Definition at line 83 of file memtest.hpp.

◆ DEFAULT_TX_PORT

#define DEFAULT_TX_PORT   2718

Definition at line 82 of file memtest.hpp.

◆ ENABLE_DDR

#define ENABLE_DDR

Definition at line 42 of file memtest.hpp.

◆ EXTRA_DDR_LATENCY_DUE_II

#define EXTRA_DDR_LATENCY_DUE_II   (64 + 8)

Definition at line 99 of file memtest.hpp.

◆ FAULT_INJECTION

#define FAULT_INJECTION

Definition at line 35 of file memtest_processing.hpp.

◆ FSM_DONE

#define FSM_DONE   1

Definition at line 79 of file memtest.hpp.

◆ FSM_PROCESSING_BURST_READING

#define FSM_PROCESSING_BURST_READING   4

Definition at line 42 of file memtest_processing.hpp.

◆ FSM_PROCESSING_CONTINUOUS_RUN

#define FSM_PROCESSING_CONTINUOUS_RUN   12

Definition at line 50 of file memtest_processing.hpp.

◆ FSM_PROCESSING_DATAFLOW_READ

#define FSM_PROCESSING_DATAFLOW_READ   6

Definition at line 44 of file memtest_processing.hpp.

◆ FSM_PROCESSING_DATAFLOW_WRITE

#define FSM_PROCESSING_DATAFLOW_WRITE   5

Definition at line 43 of file memtest_processing.hpp.

◆ FSM_PROCESSING_OUTPUT

#define FSM_PROCESSING_OUTPUT   7

Definition at line 45 of file memtest_processing.hpp.

◆ FSM_PROCESSING_OUTPUT_2

#define FSM_PROCESSING_OUTPUT_2   8

Definition at line 46 of file memtest_processing.hpp.

◆ FSM_PROCESSING_OUTPUT_3

#define FSM_PROCESSING_OUTPUT_3   9

Definition at line 47 of file memtest_processing.hpp.

◆ FSM_PROCESSING_OUTPUT_4

#define FSM_PROCESSING_OUTPUT_4   10

Definition at line 48 of file memtest_processing.hpp.

◆ FSM_PROCESSING_OUTPUT_5

#define FSM_PROCESSING_OUTPUT_5   11

Definition at line 49 of file memtest_processing.hpp.

◆ FSM_PROCESSING_PCKT_PROC

#define FSM_PROCESSING_PCKT_PROC   1

Definition at line 39 of file memtest_processing.hpp.

◆ FSM_PROCESSING_START

#define FSM_PROCESSING_START   3

Definition at line 41 of file memtest_processing.hpp.

◆ FSM_PROCESSING_STOP

#define FSM_PROCESSING_STOP   2

Definition at line 40 of file memtest_processing.hpp.

◆ FSM_PROCESSING_WAIT_FOR_DDR_CONTROLLER_EMPTYNESS

#define FSM_PROCESSING_WAIT_FOR_DDR_CONTROLLER_EMPTYNESS   13

Definition at line 51 of file memtest_processing.hpp.

◆ FSM_PROCESSING_WAIT_FOR_META

#define FSM_PROCESSING_WAIT_FOR_META   0

Definition at line 38 of file memtest_processing.hpp.

◆ FSM_WRITE_NEW_DATA

#define FSM_WRITE_NEW_DATA   0

Definition at line 78 of file memtest.hpp.

◆ LOCAL_MEM_ADDR_OFFSET

#define LOCAL_MEM_ADDR_OFFSET   (LOCAL_MEM_WORD_SIZE/8)

Definition at line 48 of file memtest_pattern_library.hpp.

◆ LOCAL_MEM_ADDR_SIZE

#define LOCAL_MEM_ADDR_SIZE   40

Definition at line 42 of file memtest_pattern_library.hpp.

◆ LOCAL_MEM_ADDR_SIZE_NON_BYTE_ADDRESSABLE

#define LOCAL_MEM_ADDR_SIZE_NON_BYTE_ADDRESSABLE   40

Definition at line 46 of file memtest_pattern_library.hpp.

◆ LOCAL_MEM_WORD_BYTE_SIZE

#define LOCAL_MEM_WORD_BYTE_SIZE   (LOCAL_MEM_WORD_SIZE/8)

Definition at line 49 of file memtest_pattern_library.hpp.

◆ LOCAL_MEM_WORD_SIZE

#define LOCAL_MEM_WORD_SIZE   512

Definition at line 41 of file memtest_pattern_library.hpp.

◆ MEMDW_512

#define MEMDW_512   512

Definition at line 90 of file memtest.hpp.

◆ MEMTEST_ADDRESS_BITWIDTH

#define MEMTEST_ADDRESS_BITWIDTH   40

Definition at line 56 of file memtest_processing.hpp.

◆ MEMTEST_ADDRESS_HIGH_BIT

#define MEMTEST_ADDRESS_HIGH_BIT   NETWORK_WORD_BIT_WIDTH-1

Definition at line 60 of file memtest_processing.hpp.

◆ MEMTEST_ADDRESS_LOW_BIT

#define MEMTEST_ADDRESS_LOW_BIT   NETWORK_WORD_BIT_WIDTH-MEMTEST_ADDRESS_BITWIDTH

Definition at line 61 of file memtest_processing.hpp.

◆ MEMTEST_BURST_BITWIDTH

#define MEMTEST_BURST_BITWIDTH   16

Definition at line 58 of file memtest_processing.hpp.

◆ MEMTEST_BURST_HIGH_BIT

#define MEMTEST_BURST_HIGH_BIT   MEMTEST_BURST_BITWIDTH-1+MEMTEST_COMMANDS_BITWIDTH

Definition at line 66 of file memtest_processing.hpp.

◆ MEMTEST_BURST_LOW_BIT

#define MEMTEST_BURST_LOW_BIT   MEMTEST_BURST_HIGH_BIT+1-MEMTEST_BURST_BITWIDTH

Definition at line 67 of file memtest_processing.hpp.

◆ MEMTEST_COMMANDS_BITWIDTH

#define MEMTEST_COMMANDS_BITWIDTH   8

Definition at line 69 of file memtest.hpp.

◆ MEMTEST_COMMANDS_HIGH_BIT

#define MEMTEST_COMMANDS_HIGH_BIT   MEMTEST_COMMANDS_BITWIDTH-1

Definition at line 67 of file memtest.hpp.

◆ MEMTEST_COMMANDS_LOW_BIT

#define MEMTEST_COMMANDS_LOW_BIT   0

Definition at line 68 of file memtest.hpp.

◆ MEMTEST_ITERATION_BITWIDTH

#define MEMTEST_ITERATION_BITWIDTH   16

Definition at line 57 of file memtest_processing.hpp.

◆ MEMTEST_ITERATIONS_HIGH_BIT

#define MEMTEST_ITERATIONS_HIGH_BIT   MEMTEST_ADDRESS_LOW_BIT-1

Definition at line 63 of file memtest_processing.hpp.

◆ MEMTEST_ITERATIONS_LOW_BIT

#define MEMTEST_ITERATIONS_LOW_BIT   MEMTEST_ITERATIONS_HIGH_BIT+1-MEMTEST_ITERATION_BITWIDTH

Definition at line 64 of file memtest_processing.hpp.

◆ MEMTEST_RETURN_RESULTS

#define MEMTEST_RETURN_RESULTS   3

Definition at line 74 of file memtest.hpp.

◆ PacketFsmType

#define PacketFsmType   uint8_t

Definition at line 76 of file memtest.hpp.

◆ PortFsmType

#define PortFsmType   uint8_t

Definition at line 80 of file memtest.hpp.

◆ PROCESSING_PACKET

#define PROCESSING_PACKET   2

Definition at line 73 of file memtest.hpp.

◆ ProcessingFsmType

#define ProcessingFsmType   uint8_t

Definition at line 52 of file memtest_processing.hpp.

◆ ROLE_IS_MEMTEST

#define ROLE_IS_MEMTEST

Definition at line 44 of file memtest.hpp.

◆ TOTMEMDW_512

#define TOTMEMDW_512   16384

Definition at line 93 of file memtest.hpp.

◆ TYPICAL_DDR_LATENCY

#define TYPICAL_DDR_LATENCY   4

Definition at line 97 of file memtest.hpp.

◆ WAIT_FOR_META

#define WAIT_FOR_META   0

Definition at line 71 of file memtest.hpp.

◆ WAIT_FOR_STREAM_PAIR

#define WAIT_FOR_STREAM_PAIR   1

Definition at line 72 of file memtest.hpp.

Typedef Documentation

◆ local_mem_addr_non_byteaddressable_t

typedef ap_uint< 40 > local_mem_addr_non_byteaddressable_t

Definition at line 47 of file memtest_pattern_library.hpp.

◆ local_mem_addr_t

typedef ap_uint< 40 > local_mem_addr_t

Definition at line 45 of file memtest_pattern_library.hpp.

◆ local_mem_word_t

typedef ap_uint< 512 > local_mem_word_t

Definition at line 44 of file memtest_pattern_library.hpp.

◆ membus_512_t

typedef ap_uint< 512 > membus_512_t

Definition at line 91 of file memtest.hpp.

◆ membus_t

Definition at line 92 of file memtest.hpp.

Enumeration Type Documentation

◆ EchoCtrl

enum EchoCtrl

SHELL/MMIO/EchoCtrl - Config Register

Enumerator
ECHO_PATH_THRU 
ECHO_STORE_FWD 
ECHO_OFF 
ECHO_PATH_THRU 
ECHO_STORE_FWD 
ECHO_OFF 
ECHO_PATH_THRU 
ECHO_STORE_FWD 
ECHO_OFF 
ECHO_PATH_THRU 
ECHO_STORE_FWD 
ECHO_OFF 
ECHO_PATH_THRU 
ECHO_STORE_FWD 
ECHO_OFF 
ECHO_PATH_THRU 
ECHO_STORE_FWD 
ECHO_OFF 
ECHO_PATH_THRU 
ECHO_STORE_FWD 
ECHO_OFF 
ECHO_STORE_FWD 
ECHO_PATH_THRU 
ECHO_CTRL_DISABLED 
ECHO_PATH_THRU 
ECHO_STORE_FWD 
ECHO_OFF 

Definition at line 49 of file memtest.hpp.

49  {
50  ECHO_PATH_THRU = 0,
51  ECHO_STORE_FWD = 1,
52  ECHO_OFF = 2
53 };
@ ECHO_STORE_FWD
Definition: memtest.hpp:51
@ ECHO_OFF
Definition: memtest.hpp:52
@ ECHO_PATH_THRU
Definition: memtest.hpp:50

◆ MemTestCmd

enum MemTestCmd

Internal MemTest accelerator command

Enumerator
TEST_BURSTSIZE_CMD 
TEST_ENDOFTESTS_CMD 
TEST_STOP_CMD 
TEST_START_CMD 
TEST_INVLD_CMD 
WRPTX_IMG_CMD 
WRPTX_TXMAT_CMD 
WRPTX_INVLD_CMD 

Definition at line 58 of file memtest.hpp.

58  {
61  TEST_STOP_CMD = 2,
62  TEST_START_CMD = 1,
63  TEST_INVLD_CMD = 0
64 };
@ TEST_ENDOFTESTS_CMD
Definition: memtest.hpp:60
@ TEST_START_CMD
Definition: memtest.hpp:62
@ TEST_STOP_CMD
Definition: memtest.hpp:61
@ TEST_BURSTSIZE_CMD
Definition: memtest.hpp:59
@ TEST_INVLD_CMD
Definition: memtest.hpp:63

Function Documentation

◆ genFibonacciNumbers()

template<typename ADDR_T , unsigned int sequenceDim, typename BIGWORD_T , typename SMALLWORD_T , unsigned int smallWordDim>
void genFibonacciNumbers ( ADDR_T  curr,
BIGWORD_T *  outBigWord 
)

Definition at line 65 of file memtest_pattern_library.hpp.

65  {
66 //#pragma HLS INLINE off
67 
68 // REQUIREMENT: must be a multiple
69  //assert( (BIGWORD_T%SMALLWORD_T)==0);
70 
71  SMALLWORD_T currentFibonacciNumber = static_cast<SMALLWORD_T>(curr);
72  SMALLWORD_T prevFibonacciNumber = currentFibonacciNumber + 1;
73  SMALLWORD_T nextFibonacciNumber = genNextFibonacciNumber<ADDR_T,SMALLWORD_T>(currentFibonacciNumber,prevFibonacciNumber);
74 
75  gen_sequence_loop: for (unsigned int i = 0; i < sequenceDim; i++)
76  {
77 #pragma HLS PIPELINE
78  (*outBigWord).range(smallWordDim*(i+1)-1,smallWordDim*i)=nextFibonacciNumber;
79  prevFibonacciNumber=currentFibonacciNumber;
80  currentFibonacciNumber=nextFibonacciNumber;
81  nextFibonacciNumber=genNextFibonacciNumber<ADDR_T,SMALLWORD_T>(currentFibonacciNumber,prevFibonacciNumber);
82  }
83 
84 
85 }

◆ genNextFibonacciNumber()

template<typename Tin , typename Tout >
Tout genNextFibonacciNumber ( Tin  curr,
Tin  prev 
)

Functions for generating (pseudo)random sequences or for pattern generation

Definition at line 59 of file memtest_pattern_library.hpp.

59  {
60 #pragma HLS INLINE
61  return static_cast<Tout>(curr + prev);
62 }

◆ genSequentialNumbers()

template<typename ADDR_T , typename BIGWORD_T >
void genSequentialNumbers ( ADDR_T  curr,
BIGWORD_T *  outBigWord 
)

Definition at line 139 of file memtest_pattern_library.hpp.

139  {
140 #pragma HLS INLINE
141  *outBigWord = curr+1;
142 }

◆ genXoredNumbersSingleWord()

template<typename ADDR_T , typename BIGWORD_T >
void genXoredNumbersSingleWord ( ADDR_T  curr,
BIGWORD_T *  outBigWord 
)

Definition at line 130 of file memtest_pattern_library.hpp.

130  {
131 #pragma HLS INLINE
132  BIGWORD_T currentNumber = static_cast<BIGWORD_T>(curr);
133  BIGWORD_T nextNumber = (currentNumber+1) xor 1;
134  *outBigWord=nextNumber;
135 }
Here is the caller graph for this function:

◆ genXoredSequentialNumbers()

template<typename ADDR_T , unsigned int sequenceDim, typename BIGWORD_T , typename SMALLWORD_T , unsigned int smallWordDim>
void genXoredSequentialNumbers ( ADDR_T  curr,
BIGWORD_T *  outBigWord 
)

Definition at line 89 of file memtest_pattern_library.hpp.

89  {
90 #pragma HLS INLINE off
91 
92 // REQUIREMENT: must be a multiple
93  //assert( (BIGWORD_T%SMALLWORD_T)==0);
94 
95  SMALLWORD_T currentNumber = static_cast<SMALLWORD_T>(curr);
96  SMALLWORD_T nextNumber = (currentNumber+1) xor 1;
97  SMALLWORD_T prevNumber = currentNumber;
98 
99  gen_sequence_loop: for (unsigned int i = 0; i < sequenceDim; i++)
100  {
101 #pragma HLS PIPELINE
102  (*outBigWord).range(smallWordDim*(i+1)-1,smallWordDim*i)=nextNumber;
103  prevNumber = currentNumber;
104  currentNumber = nextNumber;
105  nextNumber = (nextNumber + 1 ) xor i;
106  }
107 }

◆ genXoredSequentialNumbersSecondVersion()

template<typename ADDR_T , unsigned int sequenceDim, typename BIGWORD_T , typename SMALLWORD_T , unsigned int smallWordDim>
void genXoredSequentialNumbersSecondVersion ( ADDR_T  curr,
BIGWORD_T *  outBigWord 
)

Definition at line 111 of file memtest_pattern_library.hpp.

111  {
112 #pragma HLS INLINE
113 // REQUIREMENT: must be a multiple
114  //assert( (BIGWORD_T%SMALLWORD_T)==0);
115  SMALLWORD_T currentNumber = static_cast<SMALLWORD_T>(curr);
116  SMALLWORD_T nextNumber = (currentNumber+1) xor 1;
117  SMALLWORD_T prevNumber = currentNumber;
118 
119  gen_sequence_loop: for (unsigned int i = 0; i < sequenceDim; i++)
120  {
121 #pragma HLS UNROLL
122  (*outBigWord).range(smallWordDim*(i+1)-1,smallWordDim*i)=nextNumber;
123  prevNumber = currentNumber;
124  currentNumber = nextNumber;
125  nextNumber = (nextNumber + 1 ) xor i;
126  }
127 }

◆ memtest()

void memtest ( ap_uint< 32 > *  pi_rank,
ap_uint< 32 > *  pi_size,
stream< NetworkWord > &  siSHL_This_Data,
stream< NetworkWord > &  soTHIS_Shl_Data,
stream< NetworkMetaStream > &  siNrc_meta,
stream< NetworkMetaStream > &  soNrc_meta,
ap_uint< 32 > *  po_rx_ports,
membus_t lcl_mem0,
membus_t lcl_mem1 
)

Main process of the Memtest Application directives.

Deprecated:
This functions is using deprecated AXI stream interface
Returns
Nothing.

Definition at line 39 of file memtest.cpp.

61 {
62  //-- DIRECTIVES FOR THE BLOCK ---------------------------------------------
63  //#pragma HLS INTERFACE ap_ctrl_none port=return
64 
65  //#pragma HLS INTERFACE ap_stable port=piSHL_This_MmioEchoCtrl
66 
67 #pragma HLS INTERFACE axis register both port=siSHL_This_Data
68 #pragma HLS INTERFACE axis register both port=soTHIS_Shl_Data
69 
70 #pragma HLS INTERFACE axis register both port=siNrc_meta
71 #pragma HLS INTERFACE axis register both port=soNrc_meta
72 
73 #pragma HLS INTERFACE ap_ovld register port=po_rx_ports name=poROL_NRC_Rx_ports
74 #pragma HLS INTERFACE ap_stable register port=pi_rank name=piFMC_ROL_rank
75 #pragma HLS INTERFACE ap_stable register port=pi_size name=piFMC_ROL_size
76 
77 
78 #ifdef ENABLE_DDR
79 
80 const unsigned int ddr_mem_depth = TOTMEMDW_512;//*2;
81 const unsigned int ddr_latency = DDR_LATENCY;
82 const unsigned int num_outstanding_transactions = 256;//16;
83 const unsigned int MAX_BURST_LENGTH_512=64;//Theoretically is 64, 64*512bit = 4096KBytes;
84 
85 // Mapping LCL_MEM0 interface to moMEM_Mp1 channel
86 #pragma HLS INTERFACE m_axi depth=ddr_mem_depth port=lcl_mem0 bundle=moMEM_Mp1\
87  max_read_burst_length=MAX_BURST_LENGTH_512 max_write_burst_length=MAX_BURST_LENGTH_512 offset=direct \
88  num_read_outstanding=num_outstanding_transactions num_write_outstanding=num_outstanding_transactions latency=ddr_latency
89 
90 // Mapping LCL_MEM1 interface to moMEM_Mp1 channel
91 #pragma HLS INTERFACE m_axi depth=ddr_mem_depth port=lcl_mem1 bundle=moMEM_Mp1 \
92  max_read_burst_length=MAX_BURST_LENGTH_512 max_write_burst_length=MAX_BURST_LENGTH_512 offset=direct \
93  num_read_outstanding=num_outstanding_transactions num_write_outstanding=num_outstanding_transactions latency=ddr_latency
94 
95 #endif
96 
97  //-- LOCAL VARIABLES ------------------------------------------------------
99  static stream<NetworkMetaStream> sRxtoProc_Meta("sRxtoProc_Meta");
100  static stream<NetworkMetaStream> sProctoTx_Meta("sProctoTx_Meta");
101  static stream<NetworkWord> sProcpToTxp_Data("sProcpToTxp_Data");
102  #pragma HLS STREAM variable=sProcpToTxp_Data depth=20 dim=1
103  static stream<NetworkWord> sRxpToProcp_Data("sRxpToProcp_Data");
104 
105  static unsigned int processed_word_rx;
106  static unsigned int processed_bytes_rx;
107  static unsigned int processed_word_tx;
108  //*po_rx_ports = 0x1; //currently work only with default ports...
109  static stream<NodeId> sDstNode_sig ("sDstNode_sig");
110  bool start_stop;
111  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
112 #pragma HLS DATAFLOW
113 #pragma HLS reset variable=processed_word_rx
114 #pragma HLS reset variable=processed_word_tx
115 
116 
118 //STEP 0: setup the port and the dst of the cluster
119 // CHANGE THE CLUSTER CONNECTIONS HERE
122  pi_rank,
123  pi_size,
124  sDstNode_sig,
125  po_rx_ports);
126 
128 //STEP 1: received the input data, small parse on
129 // the command and fwd to the following step
130 // CHANGE THE COMMAND PARSING HERE
132  pRXPath(
133  siSHL_This_Data,
134  siNrc_meta,
135  sRxtoProc_Meta,
136  sRxpToProcp_Data,
137  meta_tmp,
138  &start_stop,
139  &processed_word_rx,
140  &processed_bytes_rx);
141 
143 //STEP 2: processing the data.
144 // INSERT THE CUSTOM PROCESSING LOGIC HERE
146  pTHISProcessingData<64>(
147  sRxpToProcp_Data,
148  sProcpToTxp_Data,
149  sRxtoProc_Meta,
150  sProctoTx_Meta,
151  &start_stop
152  #ifdef ENABLE_DDR
153  ,
154  lcl_mem0,
155  lcl_mem1
156  #endif
157  );
158 
160 // STEP 3: transmit back the data
161 // currently steup the tlast once reached max size
162 // WARNING: it needs a new meta if filled up the MTU
164  pTXPath(
165  soTHIS_Shl_Data,
166  soNrc_meta,
167  sProcpToTxp_Data,
168  sProctoTx_Meta,
169  sDstNode_sig,
170  &processed_word_tx,
171  pi_rank);
172 
173 
174 }
void pPortAndDestionation(ap_uint< 32 > *pi_rank, ap_uint< 32 > *pi_size, stream< NodeId > &sDstNode_sig, ap_uint< 32 > *po_rx_ports)
pPortAndDestionation - Setup the port and the destination rank.
void pRXPath(stream< NetworkWord > &siSHL_This_Data, stream< NetworkMetaStream > &siNrc_meta, stream< NetworkMetaStream > &sRxtoProc_Meta, stream< NetworkWord > &sRxpToProcp_Data, NetworkMetaStream meta_tmp, bool *start_stop, unsigned int *processed_word_rx, unsigned int *processed_bytes_rx)
Receive Path - From SHELL to THIS.
#define DDR_LATENCY
Definition: memtest.hpp:98
void pTXPath(stream< NetworkWord > &soTHIS_Shl_Data, stream< NetworkMetaStream > &soNrc_meta, stream< NetworkWord > &sProcpToTxp_Data, stream< NetworkMetaStream > &sRxtoTx_Meta, stream< NodeId > &sDstNode_sig, unsigned int *processed_word_tx, ap_uint< 32 > *pi_rank)
Transmit Path - From THIS to SHELL.
#define ENABLE_DDR
Definition: memtest.hpp:42
#define TOTMEMDW_512
Definition: memtest.hpp:93
membus_t lcl_mem0[16384]
membus_t lcl_mem1[16384]
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pCountClockCycles()

template<typename Tevent = bool, const unsigned int counter_width = 32, const unsigned int maximum_counter_value_before_reset = 4000000>
void pCountClockCycles ( hls::stream< Tevent > &  sOfEnableCCIncrement,
hls::stream< Tevent > &  sOfResetCounter,
hls::stream< Tevent > &  sOfGetTheCounter,
hls::stream< ap_uint< counter_width > > &  oSClockCounter 
)

Count Clock Cycles between two events first sketch TODO: make it working without counting with the stream or reshaping as FSM.

Parameters
[in]sOfEnableCCIncrement
[in]sOfResetCounter
[in]sOfGetTheCounter
[in]oSClockCounter
[in]Teventthe event datatype
[in]counter_widththe counter precision
[in]maximum_counter_value_before_resetthe maxmimum amount of cc count before auto reset
Returns
Nothing.

Definition at line 730 of file memtest_library.hpp.

735 {
736 
737  static ap_uint<counter_width> internal_counter = 0;
738  static bool pop_the_counter = false;
739 #pragma HLS reset variable=internal_counter
740 #pragma HLS reset variable=pop_the_counter
741 //giving priority to the pop
742  if(!sOfGetTheCounter.empty()){
743  pop_the_counter = sOfGetTheCounter.read();
744  }
745  if (pop_the_counter && !oSClockCounter.full())
746  {
747  oSClockCounter.write(internal_counter);
748  pop_the_counter=false;
749  }
750  if(!sOfResetCounter.empty()){
751  bool reset_or_not = sOfResetCounter.read();
752  if (reset_or_not)
753  {
754  internal_counter = 0;
755  }
756  }
757  if(!sOfEnableCCIncrement.empty()){
758  bool increment = sOfEnableCCIncrement.read();
759  if (increment)
760  {
761  if(internal_counter==maximum_counter_value_before_reset){
762  internal_counter=1;
763  }else{
764  internal_counter++;
765  }
766 #if DEBUG_LEVEL == TRACE_ALL
767 #ifndef __SYNTHESIS__
768  printf("DEBUG pCountClockCycles counter value = %s\n", internal_counter.to_string().c_str());
769 #endif //__SYNTHESIS__
770 #endif
771  }
772  }
773 }

◆ perfCounterMultipleCounts()

template<typename Tin , typename Tout , unsigned int counter_precision = 64>
void perfCounterMultipleCounts ( hls::stream< Tin > &  cmd,
Tout *  out 
)

Count Clock Cycles between two events, the first event init the counter the second stop the count, a 0 after the init stop definitevely the counter.

Parameters
[in]cmdthe performance counter cmd stream, first is init second stop(0)/continue(everything else)
[out]outthe output register of where store the incremental counter value
[in]Tinthe input datatype
[in]Toutthe output datatype
[in]counter_precisionthe maxmimum amount of data
Returns
Nothing.

Definition at line 683 of file memtest_library.hpp.

683  {
684  #pragma HLS interface ap_ctrl_none port=return
685  Tin input_cmd=1;
686 
687  // wait to receive a value to start counting
688  ap_uint<counter_precision> cnt = cmd.read();
689  reset:
690  while (input_cmd != 0)//a zero will stop the counter
691  {
692 #pragma HLS LOOP_TRIPCOUNT min = 1 max = max_counter_cc
693 #if DEBUG_LEVEL == TRACE_ALL
694  #ifndef __SYNTHESIS__
695  //printf("DEBUG begin to count :D input_cmd value = %s\n", input_cmd.to_string().c_str());
696 #endif //__SYNTHESIS__
697 #endif
698 // keep counting until a value is available
699 count:
700  while (cmd.read_nb(input_cmd) == false) {
701 #pragma HLS LOOP_TRIPCOUNT min = 1 max = max_counter_cc
702 #pragma HLS PIPELINE II=1
703  cnt++;
704 #if DEBUG_LEVEL == TRACE_ALL
705  #ifndef __SYNTHESIS__
706  // printf("DEBUG perfCounterProc counter value = %s\n", cnt.to_string().c_str());
707 #endif //__SYNTHESIS__
708 #endif
709  }
710  input_cmd=cmd.read();
711  }
712  *out +=cnt;
713 }
out
Definition: test.py:12

◆ perfCounterProc()

template<typename Tin , typename Tout , unsigned int counter_precision = 64>
void perfCounterProc ( hls::stream< Tin > &  cmd,
hls::stream< Tout > &  out,
int  direction,
int  burst_length,
int  nmbr_outstanding 
)

Definition at line 546 of file memtest_library.hpp.

547 {
548 #pragma HLS INLINE off
549 
550  Tin input_cmd;
551  // wait to receive a value to start counting
552  ap_uint<counter_precision> cnt = cmd.read();
553 // keep counting until a value is available
554 count:
555  while (cmd.read_nb(input_cmd) == false) {
556  cnt++;
557  #if DEBUG_LEVEL == TRACE_ALL
558 #ifndef __SYNTHESIS__
559  printf("DEBUG perfCounterProc counter value = %s\n", cnt.to_string().c_str());
560 #endif //__SYNTHESIS__
561 #endif
562  }
563 
564  // // write out kernel statistics to global memory
565  Tout tmp[1];//was 4
566  tmp[0] = cnt;
567  // tmp[1] = input_cmd;
568  //tmp[1] = burst_length;
569  // tmp[3] = nmbr_outstanding;
570  //memcpy(out, tmp, 4 * sizeof(Tout));
571  out.write(tmp[0]);
572  //out.write(tmp[1]);
573  //out.write(nmbr_outstanding); this
574  //out.write(input_cmd); Xilinx use this to count the errors but we are already counting so...
575 }

◆ perfCounterProc2Mem()

template<typename Tin , typename Tout , unsigned int counter_precision = 64>
void perfCounterProc2Mem ( hls::stream< Tin > &  cmd,
Tout *  out,
int  direction,
int  burst_length,
int  nmbr_outstanding 
)

Definition at line 581 of file memtest_library.hpp.

581  {
582 
583  Tin input_cmd;
584  // wait to receive a value to start counting
585  ap_uint<counter_precision> cnt = cmd.read();
586 // keep counting until a value is available
587 count:
588  while (cmd.read_nb(input_cmd) == false) {
589 #pragma HLS LOOP_TRIPCOUNT min = 1 max = max_counter_cc
590  cnt++;
591 
592 #if DEBUG_LEVEL == TRACE_ALL
593 #ifndef __SYNTHESIS__
594  printf("DEBUG perfCounterProc counter value = %s\n", cnt.to_string().c_str());
595 #endif //__SYNTHESIS__
596 #endif
597  }
598  *out =cnt;
599 }

◆ perfCounterProc2MemCountIncremental()

template<typename Tin , typename Tout , unsigned int counter_precision = 64>
void perfCounterProc2MemCountIncremental ( hls::stream< Tin > &  cmd,
Tout *  out 
)

Count Clock Cycles between two events, the first event init the counter the second stop the count and increment the out register TODO: seems not working at the csim lvl (never tested below) when executing single DUT step, hanging stream values.

Parameters
[in]cmdthe performance counter cmd stream, first is init second stop
[out]outthe output register of where increment the counter value
[in]Tinthe input datatype
[in]Toutthe output datatype
[in]counter_precisionthe maxmimum amount of data
Returns
Nothing.

Definition at line 651 of file memtest_library.hpp.

651  {
652 
653  Tin input_cmd;
654  // wait to receive a value to start counting
655  ap_uint<counter_precision> cnt = cmd.read();
656 // keep counting until a value is available
657 count:
658  while (cmd.read_nb(input_cmd) == false) {
659 #pragma HLS LOOP_TRIPCOUNT min = 1 max = max_counter_cc
660  cnt++;
661 #if DEBUG_LEVEL == TRACE_ALL
662 #ifndef __SYNTHESIS__
663  printf("DEBUG perfCounterProc counter value = %s\n", cnt.to_string().c_str());
664 #endif //__SYNTHESIS__
665 #endif
666  }
667  *out +=cnt;
668 }

◆ perfCounterProc2MemCountOnly()

template<typename Tin , typename Tout , unsigned int counter_precision = 64>
void perfCounterProc2MemCountOnly ( hls::stream< Tin > &  cmd,
Tout *  out 
)

Count Clock Cycles between two events, the first event init the counter the second stop the count.

Parameters
[in]cmdthe performance counter cmd stream, first is init second stop
[out]outthe output register of where store the counter value
[in]Tinthe input datatype
[in]Toutthe output datatype
[in]counter_precisionthe maxmimum amount of data
Returns
Nothing.

Definition at line 615 of file memtest_library.hpp.

615  {
616 
617  Tin input_cmd;
618  // wait to receive a value to start counting
619  ap_uint<counter_precision> cnt = cmd.read();
620 // keep counting until a value is available
621 count:
622  while (cmd.read_nb(input_cmd) == false) {
623 #pragma HLS LOOP_TRIPCOUNT min = 1 max = max_counter_cc
624  cnt++;
625 
626 #if DEBUG_LEVEL == TRACE_ALL
627 #ifndef __SYNTHESIS__
628  printf("DEBUG perfCounterProc counter value = %s\n", cnt.to_string().c_str());
629 #endif //__SYNTHESIS__
630 #endif
631  }
632  *out =cnt;
633 }

◆ pMemCpyCircularBuff()

template<typename Tin , typename Tout , const unsigned int arraysize>
void pMemCpyCircularBuff ( Tin *  buff,
Tout *  out_mem,
unsigned int  elems,
unsigned int  offset_buff 
)

Copy a run-time variable amount of data to another array employing the src as circular buffer i.e., handling overflow.

Parameters
[out]out_memthe dst ptr
[in]buffthe src ptr, or the circular buffer
[in]elemsthe current amount of data to tx
[in]offset_buffthe initial offest in the circular buffer
[in]Tinthe input datatype
[in]Toutthe output datatype
[in]arraysizethe maxmimum amount of data
Returns
Nothing.

Definition at line 398 of file memtest_library.hpp.

398  {
399 #pragma HLS INLINE
400  unsigned int j = 0;
401  circ_buff_loop: for (unsigned int i = 0; i < elems; i++)
402  {
403 #pragma HLS PIPELINE II=1
404 #pragma HLS LOOP_TRIPCOUNT min = 1 max = arraysize
405  if(offset_buff+j==arraysize)//
406  {
407  offset_buff=0;
408  j=1;
409  out_mem[i] = buff[0];
410  }else{
411  out_mem[i] = buff[offset_buff+j];
412  j++;
413  }
414  }
415 
416 }

◆ pMyMemtestMemCpy()

template<typename Tin , typename Tout , unsigned int arraysize>
void pMyMemtestMemCpy ( Tin *  in,
Tout *  out 
)

Copy a fixed compile time amount of data to another array.

Parameters
[out]outthe dst ptr
[in]inthe src ptr
[in]Tinthe input datatype
[in]Toutthe output datatype
[in]arraysizethe fixed amount of data
Returns
Nothing.

Definition at line 373 of file memtest_library.hpp.

373  {
374 #pragma HLS INLINE
375  for (unsigned int i = 0; i < arraysize; i++)
376  {
377 #pragma HLS PIPELINE II=1
378  *out = *in;
379  }
380 
381 }

◆ pPortAndDestionation()

void pPortAndDestionation ( ap_uint< 32 > *  pi_rank,
ap_uint< 32 > *  pi_size,
stream< NodeId > &  sDstNode_sig,
ap_uint< 32 > *  po_rx_ports 
)

pPortAndDestionation - Setup the port and the destination rank.

Parameters
[in]pi_rank
[in]pi_size
[out]sDstNode_sig
[out]po_rx_ports
Returns
Nothing.

Definition at line 71 of file memtest_library.hpp.

77 {
78  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
79 #pragma HLS INLINE off
80  //-- STATIC VARIABLES (with RESET) ------------------------------------------
81  static PortFsmType port_fsm = FSM_WRITE_NEW_DATA;
82 #pragma HLS reset variable=port_fsm
83 
84  switch(port_fsm)
85  {
86  default:
87  case FSM_WRITE_NEW_DATA:
88  //Triangle app needs to be reset to process new rank
89  if(!sDstNode_sig.full())
90  {
91  NodeId dst_rank = (*pi_rank + 1) % *pi_size;
92  #if DEBUG_LEVEL == TRACE_ALL
93  printf("rank: %d; size: %d; \n", (int) *pi_rank, (int) *pi_size);
94  #endif
95  sDstNode_sig.write(dst_rank);
96  *po_rx_ports = 0x0; //init the value
97  port_fsm = FSM_DONE;
98  }
99  break;
100  case FSM_DONE:
101  *po_rx_ports = 0x1; //currently work only with default ports...
102  break;
103  }
104 
105 }
#define FSM_WRITE_NEW_DATA
Definition: memtest.hpp:78
#define FSM_DONE
Definition: memtest.hpp:79
#define PortFsmType
Definition: memtest.hpp:80
ap_uint< 8 > NodeId
Definition: network.hpp:82
Here is the caller graph for this function:

◆ pRDCmpStreamsCntWordAligned()

template<const unsigned int max_iterations = 4000000, const unsigned int buff_dim = 16>
void pRDCmpStreamsCntWordAligned ( local_mem_addr_t  max_addr_ut,
hls::stream< local_mem_word_t > &  sInReadData,
hls::stream< local_mem_word_t > &  sInGoldData,
ap_uint< 32 > *  faulty_addresses_cntr,
local_mem_addr_t first_faulty_address 
)

Read two streams, compare them and output the number of faults and the first faulty address.

Parameters
[in]max_addr_utthe maximum address to test
[in]sInReadDatathe read data stream
[in]sInGoldDatathe gold data stream
[out]faulty_addresses_cntrthe fault cntr ptr
[out]first_faulty_addressthe first fault address ptr
Returns
Nothing.

Definition at line 601 of file memtest_pattern_library.hpp.

607 {
608 #pragma HLS INLINE off
609 #pragma HLS interface ap_ctrl_none port=return
610  local_mem_addr_t curr_address_ut;
611  static local_mem_word_t testingVector[buff_dim];
612  static local_mem_word_t goldenVector[buff_dim];
613  local_mem_addr_non_byteaddressable_t maddr_non_byte=0;
614  static bool cmp_ok [buff_dim];
615  static ap_uint<32> faulty_addresses_cntr_support_array [buff_dim];
616 
617  static bool first_fault_found = false;
618  static ap_uint<32> faulty_addresses_cntr_local;
619 
620  reading_loop:
621  for (curr_address_ut = 0, faulty_addresses_cntr_local=0; curr_address_ut < max_addr_ut; curr_address_ut++)
622  {
623 #pragma HLS PIPELINE
624 #pragma HLS LOOP_TRIPCOUNT min = 1 max = max_iterations
625 #pragma HLS dependence variable=faulty_addresses_cntr_support_array inter RAW distance=buff_dim true
626 
627  if (!sInReadData.empty() && !sInGoldData.empty())
628  {
629  testingVector[maddr_non_byte%buff_dim] = sInReadData.read();
630  goldenVector[maddr_non_byte%buff_dim] = sInGoldData.read();
631 
632  int idx=maddr_non_byte%buff_dim;
633  #if DEBUG_LEVEL == TRACE_ALL
634  #ifndef __SYNTHESIS__
635  std::cout << maddr_non_byte << " tst=" << testingVector[idx] << " vs gld=" << goldenVector[idx] << std::endl;
636  #endif
637  #endif
638  bool cmp_results = testingVector[idx] == goldenVector[idx];
639  cmp_ok[idx]=cmp_results;
640  if(!cmp_results ){
641  faulty_addresses_cntr_support_array[idx]++;
642  if (!first_fault_found)
643  {
644  *first_faulty_address=curr_address_ut*64;
645  first_fault_found = true;
646  }else{
647  first_fault_found = first_fault_found;
648  }
649  }
650 
651  maddr_non_byte++;
652  }else{
653  curr_address_ut--;
654  }
655  }
656  // std::cout << std::endl;
657 
658  for (int i = 0; i < buff_dim; i++)
659  {
660 #pragma HLS PIPELINE
661  faulty_addresses_cntr_local += faulty_addresses_cntr_support_array[i];
662  faulty_addresses_cntr_support_array[i]=0;
663  }
664 
665  first_fault_found=false;
666 *faulty_addresses_cntr=faulty_addresses_cntr_local;
667 
668 }
ap_uint< 40 > local_mem_addr_t
ap_uint< 40 > local_mem_addr_non_byteaddressable_t
ap_uint< 512 > local_mem_word_t

◆ pRDCompareDataStreamsCount()

template<const unsigned int max_iterations = 4000000, const unsigned int unrolling_factor = ( 512 /8), const unsigned int buff_dim = 16>
void pRDCompareDataStreamsCount ( local_mem_addr_t  max_addr_ut,
hls::stream< local_mem_word_t > &  sInReadData,
hls::stream< local_mem_word_t > &  sInGoldData,
ap_uint< 32 > *  faulty_addresses_cntr,
local_mem_addr_t first_faulty_address 
)

Read two streams, compare them and output the number of faults and the first faulty address, but check every single byte NOT USED.

Deprecated:
Parameters
[in]max_addr_utthe maximum address to test
[in]sInReadDatathe read data stream
[in]sInGoldDatathe gold data stream
[out]faulty_addresses_cntrthe fault cntr ptr
[out]first_faulty_addressthe first fault address ptr
Returns
Nothing.

Definition at line 688 of file memtest_pattern_library.hpp.

694 {
695 //#pragma HLS INLINE off
696  const unsigned int dble_wrd_dim = LOCAL_MEM_ADDR_OFFSET * 2;
697  const unsigned int support_dim = LOCAL_MEM_ADDR_OFFSET * 2;
698 
699 
700  local_mem_addr_t curr_address_ut;
701  static local_mem_word_t testingVector[buff_dim];
702  static local_mem_word_t goldenVector[buff_dim];
703  local_mem_addr_non_byteaddressable_t maddr_non_byte=0;
704 
705 
706  static ap_uint<8> testingVector_bytes [support_dim];
707  static ap_uint<8> goldenVector_bytes [support_dim];
708  static bool cmp_ok [support_dim];
709  static ap_uint<32> faulty_addresses_cntr_support_array [support_dim];
710 
711 #pragma HLS array_partition variable=faulty_addresses_cntr_support_array cyclic factor=2 dim=1
712 #pragma HLS array_partition variable=testingVector_bytes cyclic factor=2 dim=1
713 #pragma HLS array_partition variable=goldenVector_bytes cyclic factor=2 dim=1
714 #pragma HLS array_partition variable=cmp_ok cyclic factor=2 dim=1
715 
716  static bool first_fault_found = false;
717  static ap_uint<32> faulty_addresses_cntr_local;
718 
719  ap_uint<1> k;
720  reading_loop:
721  for (curr_address_ut = 0, k=0, faulty_addresses_cntr_local=0; curr_address_ut < max_addr_ut; k++, curr_address_ut++)
722  {
723 #pragma HLS PIPELINE
724 #pragma HLS LOOP_TRIPCOUNT min = 1 max = max_iterations
725  if (!sInReadData.empty() && !sInGoldData.empty())
726  {
727  testingVector[maddr_non_byte%buff_dim] = sInReadData.read();
728  goldenVector[maddr_non_byte%buff_dim] = sInGoldData.read();
729  golden_comparison: for (int i = 0; i < LOCAL_MEM_ADDR_OFFSET; i++)
730  {
731  //#pragma HLS UNROLL factor=unrolling_factor skip_exit_check
732  int idx = (i + k*LOCAL_MEM_ADDR_OFFSET);
733  testingVector_bytes[idx]=testingVector[maddr_non_byte%buff_dim].range((i+1)*8-1,i*8);
734  goldenVector_bytes[idx]=goldenVector[maddr_non_byte%buff_dim].range((i+1)*8-1,i*8);
735  #if DEBUG_LEVEL == TRACE_ALL
736  #ifndef __SYNTHESIS__
737  std::cout << " tst=" << testingVector_bytes[idx] << " vs gld=" << goldenVector_bytes[idx] ;
738  #endif
739  #endif
740 
741  cmp_ok[idx] = testingVector_bytes[idx] == goldenVector_bytes[idx];
742  if(!cmp_ok[idx] ){
743  faulty_addresses_cntr_support_array[i+k]++;
744  if (!first_fault_found)
745  {
746  *first_faulty_address=i+curr_address_ut*64;
747  first_fault_found = true;
748  }else{
749  first_fault_found = first_fault_found;
750  }
751  }
752  }
753  #if DEBUG_LEVEL == TRACE_ALL
754  #ifndef __SYNTHESIS__
755  std::cout << std::endl;
756  #endif
757  #endif
758  //sInCmpRes.write(tmpOut);
759  maddr_non_byte++;
760  }else{
761  k--;
762  curr_address_ut--;
763  }
764  }
765 
766  flt_cntr_loop: for (int i = 0; i < support_dim; i++)
767  {
768 #pragma HLS PIPELINE
769  faulty_addresses_cntr_local += faulty_addresses_cntr_support_array[i];
770  faulty_addresses_cntr_support_array[i]=0;
771  }
772 
773  first_fault_found=false;
774 *faulty_addresses_cntr=faulty_addresses_cntr_local;
775 
776 }
#define LOCAL_MEM_ADDR_OFFSET

◆ pRDMainMemoryRead2StreamData()

template<typename Tcntr , const unsigned int max_iterations = 4000000, const unsigned int buff_dim = 64*2>
void pRDMainMemoryRead2StreamData ( hls::stream< Tcntr > &  sOutCmd,
hls::stream< local_mem_word_t > &  sOutreadData,
membus_t lcl_mem,
local_mem_addr_t  max_addr_ut,
unsigned int  burst_size 
)

Read a single word of data and output on a stream and count the cc needed just 4 transfer
NOT USED.

Deprecated:
Parameters
[out]sOutCmdthe perf counter cmd stream
[out]sOutreadDatathe read data stream
[in]lcl_memthe virtual memory mapped pointer
[in]max_addr_utthe maximum address to test
[in]burst_sizethe run-time variable burst size
Returns
Nothing.

Definition at line 795 of file memtest_pattern_library.hpp.

801 {
802 #pragma HLS INLINE off
803 
804  local_mem_addr_t curr_address_ut;
805  static local_mem_addr_t curr_reading_addr;
806  static local_mem_word_t tmp_out[buff_dim];
807 #pragma HLS array_partition variable=tmp_out cyclic factor=2 dim=1
808 
809  sOutCmd.write(0);
810  int i, reading_i;
811  read_data_from_main_mem:
812  for (i = 0, curr_address_ut = 0, curr_reading_addr=0, reading_i=0; curr_address_ut < max_addr_ut; )
813  {
814 #pragma HLS PIPELINE II=1
815 #pragma HLS LOOP_TRIPCOUNT min = 1 max = max_iterations
816  if (!sOutreadData.full())
817  {
818 
819  memcpy(tmp_out+reading_i, lcl_mem+curr_address_ut, sizeof(local_mem_word_t));
820  if(reading_i > curr_reading_addr+1){
821  sOutreadData.write(tmp_out[curr_reading_addr]);
822  #if DEBUG_LEVEL == TRACE_ALL
823  #ifndef __SYNTHESIS__
824  std::cout << " writing a memory word " << curr_reading_addr << " I have to reach " << i << std::endl;
825  #endif
826  #endif
827  curr_reading_addr++;
828 
829  }
830  #if DEBUG_LEVEL == TRACE_ALL
831  #ifndef __SYNTHESIS__
832  std::cout << "read the " << reading_i << " memory word, outputreading at " << curr_reading_addr << " i at " << i << std::endl;
833  #endif
834  #endif
835 
836  if(reading_i==buff_dim-1){
837  reading_i=0;
838  }else{
839  reading_i++;
840  }
841  curr_address_ut++;
842  i++;
843  }
844  }
845 
846  sOutCmd.write(0);
847  i--;
848  reading_i=i%buff_dim;
849  sent_out_remaining_buff:
850  for (int j = 0; j < buff_dim; j++)
851  {
852 #pragma HLS LOOP_TRIPCOUNT min = 1 max = buff_dim
853 #pragma HLS PIPELINE II=1
854  if (!sOutreadData.full())
855  {
856  if(j==curr_reading_addr && i >= curr_reading_addr){
857  #if DEBUG_LEVEL == TRACE_ALL
858  #ifndef __SYNTHESIS__
859  std::cout << " writing a memory word " << curr_reading_addr << " I have to reach " << i << std::endl;
860  #endif
861  #endif
862  sOutreadData.write(tmp_out[curr_reading_addr]);
863  curr_reading_addr++;
864  tmp_out[j]=0;
865  }else{
866  tmp_out[j]=0;
867  }
868  }else{
869  j--;
870  }
871  }
872  curr_reading_addr=0;
873 
874 }

◆ pRDRead2StreamDataVariableBurst()

template<typename Tcntr , const unsigned int max_iterations = 4000000, const unsigned int buff_dim = 64*2>
void pRDRead2StreamDataVariableBurst ( hls::stream< Tcntr > &  sOutCmd,
hls::stream< local_mem_word_t > &  sOutreadData,
membus_t lcl_mem,
local_mem_addr_t  max_addr_ut,
unsigned int  burst_size 
)

Read a variable burst_size amount of data and output on a stream and count the cc needed just 4 transfer
THIS FUNCTION SUFFER FIFO OVERFLOW 4 transfer different from power of 2 numbers NOT USED.

Deprecated:
Parameters
[out]sOutCmdthe perf counter cmd stream
[out]sOutreadDatathe read data stream
[in]lcl_memthe virtual memory mapped pointer
[in]max_addr_utthe maximum address to test
[in]burst_sizethe run-time variable burst size
Returns
Nothing.

Definition at line 892 of file memtest_pattern_library.hpp.

898 {
899 #pragma HLS INLINE off
900 
901  local_mem_addr_t curr_address_ut;
902  static local_mem_word_t tmp_out[buff_dim];
903 #pragma HLS array_partition variable=tmp_out cyclic factor=2 dim=1
905  static local_mem_addr_t curr_reading_addr;
906  static unsigned int end_distance=0;
907  static int ptrs_distance=0;
908  static int ptrs_distance_opposite=0;
909  static bool transfer_less_than_burst = false;
910  static bool activated_cntr = false;
911  static bool can_read_data = false;
912 
913  read_data_from_main_mem:
914  int reading_mm_i = 0;//how much filled the buff
915  int consumed_fifo_i = 0;//how much already outputed
916  int missing_words=0;
917  unsigned int total_consumed_words=0;
918  unsigned int total_readfrom_mm_words=0;
919  bool fifo_is_not_full=false;
920  for (curr_address_ut = 0, curr_reading_addr=0; curr_address_ut < max_addr_ut; )
921  {
922 #pragma HLS PIPELINE II=1
923 #pragma HLS LOOP_TRIPCOUNT min = 1 max = max_iterations
924  if (!sOutreadData.full())
925  {
926 
927  end_distance = max_addr_ut-curr_reading_addr;
928  ptrs_distance = total_readfrom_mm_words - total_consumed_words;
929  ptrs_distance_opposite = total_consumed_words - total_readfrom_mm_words;
930  transfer_less_than_burst = burst_size>end_distance;
931  fifo_is_not_full = ptrs_distance <= burst_size;
932  //i have data to crunch, and eithre the fifo can read a burst or consumed enough to tx less than a burst)
933  can_read_data=(end_distance > 0) && (fifo_is_not_full || (ptrs_distance<=end_distance && transfer_less_than_burst));
934  #if DEBUG_LEVEL == TRACE_ALL
935  #ifndef __SYNTHESIS__
936  std::cout << "Max " << max_addr_ut << " reading at " << curr_reading_addr << " reading fifo at " << reading_mm_i << " consumed at " << consumed_fifo_i << std::endl;
937  std::cout << "End dst " << end_distance << " ptrs dst " << ptrs_distance << " is last? " << transfer_less_than_burst << std::endl;
938  std::cout << "curr_address_ut " << curr_address_ut << std::endl;
939  #endif
940  #endif
941  //if more than a burst size to available or the last iteration
942  if(can_read_data){
943  if (!transfer_less_than_burst)
944  {
945  //read a burst
946  if(!activated_cntr){
947  sOutCmd.write(0);
948  activated_cntr = true;
949  }else{
950  sOutCmd.write(1);
951  }
952  #if DEBUG_LEVEL == TRACE_ALL
953  #ifndef __SYNTHESIS__
954  std::cout << "BURST reading " << burst_size << " words from " << curr_reading_addr << " address, to " << reading_mm_i << std::endl;
955  #endif
956  #endif
957  memcpy(tmp_out+reading_mm_i, lcl_mem+curr_reading_addr, sizeof(local_mem_word_t)*burst_size);
958  sOutCmd.write(1);
959  std::cout << "before " << curr_reading_addr;
960  curr_reading_addr+=burst_size;
961  std::cout << " afterwards " << curr_reading_addr << std::endl;
962  total_readfrom_mm_words+=burst_size;
963  reading_mm_i=(reading_mm_i+burst_size)%buff_dim;
964  }else{
965  //read the missing words
966  missing_words= end_distance%burst_size;
967  std::cout << "before of before 1" << curr_reading_addr << std::endl;
968  if(!activated_cntr){
969  sOutCmd.write(0);
970  activated_cntr = true;
971  }else{
972  sOutCmd.write(1);
973  }
974  #if DEBUG_LEVEL == TRACE_ALL
975  #ifndef __SYNTHESIS__
976  std::cout << "LAST reading " << missing_words << " words from " << curr_reading_addr << " address, to " << reading_mm_i << std::endl;
977  #endif
978  #endif
979  total_readfrom_mm_words+=missing_words;
980  std::cout << "before of before 3" << curr_reading_addr << std::endl;
981  memcpy(tmp_out+reading_mm_i, lcl_mem+curr_reading_addr, sizeof(local_mem_word_t)*(end_distance%burst_size));
982  sOutCmd.write(1);
983 
984  std::cout << "before " << curr_reading_addr;
985  curr_reading_addr+=missing_words;
986  std::cout << " afterwards " << curr_reading_addr << std::endl;
987  reading_mm_i=(reading_mm_i+missing_words)%buff_dim;
988  }
989  }
990 
991  if(ptrs_distance > 0 || can_read_data){
992  sOutreadData.write(tmp_out[consumed_fifo_i]);
993  #if DEBUG_LEVEL == TRACE_ALL
994  #ifndef __SYNTHESIS__
995  std::cout << " consumin a read memory word " << consumed_fifo_i << " I have to reach " << reading_mm_i << std::endl;
996  std::cout << " The readmemoryword is " << tmp_out[consumed_fifo_i] << std::endl;
997  #endif
998  #endif
999 
1000  if(consumed_fifo_i==buff_dim-1){
1001  consumed_fifo_i=0;
1002  }else{
1003  consumed_fifo_i++;
1004  }
1005  total_consumed_words++;
1006  }
1009  //if() still data to read and to consume
1010  curr_address_ut++;
1011  //else{
1012  // curr_address_ut=max_addr_ut;
1013  //}
1014  #if DEBUG_LEVEL == TRACE_ALL
1015  #ifndef __SYNTHESIS__
1016  std::cout <<std::endl;
1017  #endif
1018  #endif
1019  }
1020  }
1021  sOutCmd.write(0);
1022  //reset
1023  end_distance=0;
1024  transfer_less_than_burst = false;
1025  activated_cntr=false;
1026  can_read_data=false;
1027  ptrs_distance=0;
1028 }

◆ pRDRead2StreamDataVariableBurstNoMemCpy()

template<typename Tcntr , const unsigned int max_iterations = 4000000, const unsigned int buff_dim = 64*2>
void pRDRead2StreamDataVariableBurstNoMemCpy ( hls::stream< Tcntr > &  sOutCmd,
hls::stream< local_mem_word_t > &  sOutReadData,
membus_t lcl_mem,
local_mem_addr_t  max_addr_ut,
unsigned int  burst_size 
)

Read a variable burst_size amount of data and output on a stream and count the cc needed just 4 transfer but without using memcpy.

Parameters
[out]sOutCmdthe perf counter cmd stream
[out]sOutReadDatathe read data stream
[in]lcl_memthe virtual memory mapped pointer
[in]max_addr_utthe maximum address to test
[in]burst_sizethe run-time variable burst size
Returns
Nothing.

Definition at line 434 of file memtest_pattern_library.hpp.

440 {
441 #pragma HLS INLINE off
442 #pragma HLS interface ap_ctrl_none port=return
443 
444  local_mem_addr_t curr_address_ut;
445  static local_mem_word_t tmp_out[buff_dim];
446 #pragma HLS array_partition variable=tmp_out cyclic factor=2 dim=1
448  static local_mem_addr_t curr_reading_addr;
449  static unsigned int end_distance=0;
450  static bool transfer_less_than_burst = false;
451  static bool activated_cntr = false;
452  static bool can_read_data = false;
453 
454  read_data_from_main_mem:
455  int reading_mm_i = 0;//how much filled the buff
456  int consumed_fifo_i = 0;//how much already outputed
457  int missing_words=0;
458  for (curr_address_ut = 0, curr_reading_addr=0; curr_address_ut < max_addr_ut; )
459  {
460 #pragma HLS PIPELINE II=1
461 #pragma HLS LOOP_TRIPCOUNT min = 1 max = max_iterations
462  if (!sOutReadData.full())
463  {
464  end_distance = max_addr_ut-curr_reading_addr;
465  transfer_less_than_burst = burst_size>end_distance;
466  //i have data to crunch, and eithre the fifo can read a burst or consumed enough to tx less than a burst)
467  can_read_data=(end_distance > 0) ;
468  #if DEBUG_LEVEL == TRACE_ALL
469  #ifndef __SYNTHESIS__
470  std::cout << "Max " << max_addr_ut << " reading at " << curr_reading_addr << " reading fifo at " << reading_mm_i << " consumed at " << consumed_fifo_i << std::endl;
471  std::cout << "End dst " << end_distance << " is last? " << transfer_less_than_burst << std::endl;
472  std::cout << "curr_address_ut " << curr_address_ut << std::endl;
473  #endif
474  #endif
475  //if more than a burst size to available or the last iteration
476  if(can_read_data){
477  if (!transfer_less_than_burst)
478  {
479  //read a burst
480  if(!activated_cntr){
481  activated_cntr = true;
483  local_mem_word_t,64>(lcl_mem+curr_reading_addr,
484  sOutReadData, burst_size, sOutCmd);
485  }else{
487  local_mem_word_t,64>(lcl_mem+curr_reading_addr,
488  sOutReadData, burst_size, sOutCmd);
489  }
490  #if DEBUG_LEVEL == TRACE_ALL
491  #ifndef __SYNTHESIS__
492  std::cout << "BURST reading " << burst_size << " words from " << curr_reading_addr << " address, to " << reading_mm_i << std::endl;
493  #endif
494  #endif
495  curr_reading_addr+=burst_size;
496  reading_mm_i=(reading_mm_i+burst_size)%buff_dim;
497  }else{
498  //read the missing words
499  missing_words= end_distance%burst_size;
500  if(!activated_cntr){
501  activated_cntr = true;
503  local_mem_word_t,64>(lcl_mem+curr_reading_addr,
504  sOutReadData, missing_words, sOutCmd);
505  }else{
507  local_mem_word_t,64>(lcl_mem+curr_reading_addr,
508  sOutReadData, missing_words, sOutCmd);
509  }
510  #if DEBUG_LEVEL == TRACE_ALL
511  #ifndef __SYNTHESIS__
512  std::cout << "LAST reading " << missing_words << " words from " << curr_reading_addr << " address, to " << reading_mm_i << std::endl;
513  #endif
514  #endif
515  curr_reading_addr+=missing_words;
516  reading_mm_i=(reading_mm_i+missing_words)%buff_dim;
517  }
518  }
519 
522  //if() still data to read and to consume
523  curr_address_ut++;
524  //else{
525  // curr_address_ut=max_addr_ut;
526  //}
527  #if DEBUG_LEVEL == TRACE_ALL
528  #ifndef __SYNTHESIS__
529  std::cout <<std::endl;
530  #endif
531  #endif
532  }
533  }
534  sOutCmd.write(0);
535  //reset
536  end_distance=0;
537  transfer_less_than_burst = false;
538  activated_cntr=false;
539  can_read_data=false;
540 }
membus_512_t membus_t
Definition: memtest.hpp:92
void pReadAxiMemMapped2HlsStreamCountFirst(Tin *main_mem, hls::stream< Tout > &sOut, unsigned int elems, hls::stream< Tcntr > &cmd)
Copy a run-time variable amount of data to an hls stream with a given max it assumes also the initial...
void pReadAxiMemMapped2HlsStreamCountActivated(Tin *main_mem, hls::stream< Tout > &sOut, unsigned int elems, hls::stream< Tcntr > &cmd)
Copy a run-time variable amount of data to an hls stream with a given max it assumes "perfCounterMult...
Here is the call graph for this function:

◆ pRDReadDataStreamAndProduceGold()

template<const unsigned int max_iterations = 4000000>
void pRDReadDataStreamAndProduceGold ( hls::stream< local_mem_word_t > &  sInReadData,
local_mem_addr_t  max_addr_ut,
hls::stream< local_mem_word_t > &  sOutReadData,
hls::stream< local_mem_word_t > &  sOutGoldData 
)

Read a data stream and produce the gold expected value.

Parameters
[in]sInReadDatathe input read data stream
[in]max_addr_utthe maximum address to test
[in]sOutReadDatathe copy of the input data stream
[in]sOutGoldDatathe golden expected value stream
Returns
Nothing.

Definition at line 554 of file memtest_pattern_library.hpp.

559 {
560 #pragma HLS interface ap_ctrl_none port=return
561  static local_mem_addr_t curr_address_ut= 0;
562  local_mem_word_t testingVector;
563  local_mem_word_t goldenVector;
564 
565  generate_loop:
566  for (; curr_address_ut < max_addr_ut; )
567  {
568 #pragma HLS PIPELINE II=1
569 #pragma HLS LOOP_TRIPCOUNT min = 1 max = max_iterations
570  if (!sInReadData.empty() && !sOutReadData.full() && !sOutGoldData.full())
571  {
572  testingVector = sInReadData.read();
573 
574  // genXoredSequentialNumbersSecondVersion<local_mem_addr_non_byteaddressable_t, LOCAL_MEM_WORD_SIZE/32,
575  // local_mem_word_t, ap_uint<32>,32>(local_mem_addr_non_byteaddressable, &goldenVector);
577  local_mem_word_t>(curr_address_ut, &goldenVector);
578  //genSequentialNumbers<local_mem_addr_non_byteaddressable_t,local_mem_word_t>(curr_address_ut*64, &goldenVector);
579 
580  sOutReadData.write(testingVector);
581  sOutGoldData.write(goldenVector);
582  curr_address_ut++;
583  }
584  }
585  curr_address_ut = 0;
586 }
void genXoredNumbersSingleWord(ADDR_T curr, BIGWORD_T *outBigWord)
Here is the call graph for this function:

◆ pReadAxiMemMapped2HlsStream()

template<typename Tin , typename Tout , const unsigned int burstsize>
void pReadAxiMemMapped2HlsStream ( Tin *  main_mem,
hls::stream< Tout > &  sOut,
unsigned int  elems 
)

Copy a run-time variable amount of data to an hls stream with a given max.

Parameters
[out]main_memthe src ptr to read
[in]sOutthe dst hls stream
[in]elemsthe current amount of data to tx
[in]Tinthe input datatype
[in]Toutthe output datatype
[in]burstsizethe maxmimum amount of data
Returns
Nothing.

Definition at line 432 of file memtest_library.hpp.

432  {
433 #pragma HLS INLINE
434  mmloop: for (unsigned int i = 0; i < elems; i++)
435  {
436 #pragma HLS PIPELINE II=1
437 #pragma HLS LOOP_TRIPCOUNT min = 1 max = burstsize
438  Tout tmp = main_mem[i];
439  sOut.write(tmp);
440  }
441 
442 }

◆ pReadAxiMemMapped2HlsStreamCountActivated()

template<typename Tin , typename Tout , const unsigned int burstsize, typename Tcntr >
void pReadAxiMemMapped2HlsStreamCountActivated ( Tin *  main_mem,
hls::stream< Tout > &  sOut,
unsigned int  elems,
hls::stream< Tcntr > &  cmd 
)

Copy a run-time variable amount of data to an hls stream with a given max it assumes "perfCounterMultipleCounts" function already initialized so it just incr.

Parameters
[out]main_memthe src ptr to read
[in]sOutthe dst hls stream
[in]elemsthe current amount of data to tx
[in]cmdthe performance counter cmd stream
[in]Tinthe input datatype
[in]Toutthe output datatype
[in]burstsizethe maxmimum amount of data
[in]Tcntrthe cmd perf counter datatype
Returns
Nothing.

Definition at line 491 of file memtest_library.hpp.

491  {
492 #pragma HLS INLINE
493  cmd.write(1);
494  mmloop: for (unsigned int i = 0; i < elems; i++)
495  {
496 #pragma HLS PIPELINE II=1
497 #pragma HLS LOOP_TRIPCOUNT min = 1 max = burstsize
498  Tout tmp = main_mem[i];
499  sOut.write(tmp);
500  }
501  cmd.write(1);
502 }
Here is the caller graph for this function:

◆ pReadAxiMemMapped2HlsStreamCountExtern()

template<typename Tin , typename Tout , const unsigned int burstsize, typename Tcntr >
void pReadAxiMemMapped2HlsStreamCountExtern ( Tin *  main_mem,
hls::stream< Tout > &  sOut,
unsigned int  elems,
hls::stream< Tcntr > &  cmd,
bool  activated 
)

Copy a run-time variable amount of data to an hls stream with a given max it assumes "perfCounterMultipleCounts" function already initialized so it just incr.

Parameters
[out]main_memthe src ptr to read
[in]sOutthe dst hls stream
[in]elemsthe current amount of data to tx
[in]cmdthe performance counter cmd stream
[in]Tinthe input datatype
[in]Toutthe output datatype
[in]burstsizethe maxmimum amount of data
[in]Tcntrthe cmd perf counter datatype
Returns
Nothing.

Definition at line 520 of file memtest_library.hpp.

520  {
521 #pragma HLS INLINE
522  cmd.write(activated);
523  mmloop: for (unsigned int i = 0; i < elems; i++)
524  {
525 #pragma HLS PIPELINE II=1
526 #pragma HLS LOOP_TRIPCOUNT min = 1 max = burstsize
527  Tout tmp = main_mem[i];
528  sOut.write(tmp);
529  }
530  cmd.write(1);
531 }

◆ pReadAxiMemMapped2HlsStreamCountFirst()

template<typename Tin , typename Tout , const unsigned int burstsize, typename Tcntr >
void pReadAxiMemMapped2HlsStreamCountFirst ( Tin *  main_mem,
hls::stream< Tout > &  sOut,
unsigned int  elems,
hls::stream< Tcntr > &  cmd 
)

Copy a run-time variable amount of data to an hls stream with a given max it assumes also the initialization of a perf counter of "perfCounterMultipleCounts" function.

Parameters
[out]main_memthe src ptr to read
[in]sOutthe dst hls stream
[in]elemsthe current amount of data to tx
[in]cmdthe performance counter cmd stream
[in]Tinthe input datatype
[in]Toutthe output datatype
[in]burstsizethe maxmimum amount of data
[in]Tcntrthe cmd perf counter datatype
Returns
Nothing.

Definition at line 461 of file memtest_library.hpp.

461  {
462 #pragma HLS INLINE
463 cmd.write(0);
464  mmloop: for (unsigned int i = 0; i < elems; i++)
465  {
466 #pragma HLS PIPELINE II=1
467 #pragma HLS LOOP_TRIPCOUNT min = 1 max = burstsize
468  Tout tmp = main_mem[i];
469  sOut.write(tmp);
470  }
471  cmd.write(1);
472 
473 }
Here is the caller graph for this function:

◆ pReadDataflowMemTest()

template<const unsigned int maximum_number_of_beats = 512>
void pReadDataflowMemTest ( membus_t lcl_mem1,
local_mem_addr_t  max_address_under_test,
ap_uint< 64 > *  reading_cntr,
ap_uint< 32 > *  faulty_addresses_cntr,
local_mem_addr_t first_faulty_address,
unsigned int  burst_size 
)

Definition at line 107 of file memtest_processing.hpp.

114  {
115  #pragma HLS INLINE off
116 
117  static hls::stream<ap_uint<64>> sReadPrfCntr_cmd("sReadPrfCntr_cmd");
118  #pragma HLS STREAM variable=sReadPrfCntr_cmd depth=maximum_number_of_beats dim=1
119  static hls::stream<local_mem_word_t> generatedReadData("generatedReadData");
120  #pragma HLS STREAM variable=generatedReadData depth=maximum_number_of_beats dim=1
121  static hls::stream<local_mem_word_t> sReadData("sReadData");
122  #pragma HLS STREAM variable=sReadData depth=maximum_number_of_beats dim=1
123  static hls::stream<local_mem_word_t> sGoldData("sGoldData");
124  #pragma HLS STREAM variable=sGoldData depth=maximum_number_of_beats dim=1
125 
126  static hls::stream<ap_uint<64>> sComparisonData("sComparisonData");
127  #pragma HLS STREAM variable=sComparisonData depth=64 dim=1
128  // static hls::stream<local_mem_addr_t> sFaultyAddresses("sFaultyAddresses");
129  // #pragma HLS STREAM variable=sFaultyAddresses depth=64 dim=1
130 
131 #pragma HLS DATAFLOW
132 
133 
134  #ifdef SIMPLER_BANDWIDTH_TEST
135  //Step 1 write data
136  pReadSimplerTestMemTest<ap_uint<64>>(sReadPrfCntr_cmd, lcl_mem1, max_address_under_test, burst_size, faulty_addresses_cntr, first_faulty_address);
137  //Step 2 count
138  perfCounterProc2MemCountOnly<ap_uint<64>,ap_uint<64>,64>(sReadPrfCntr_cmd, reading_cntr);
139  #else
140  //Step 1: Generate the data
143  pRDRead2StreamDataVariableBurstNoMemCpy<ap_uint<64>,4000000,maximum_number_of_beats>( sReadPrfCntr_cmd, generatedReadData, lcl_mem1, max_address_under_test,burst_size);
144  //Step 2: write
145  pRDReadDataStreamAndProduceGold<4000000>(generatedReadData, max_address_under_test, sReadData, sGoldData);
146  //Step 2.b: count
147  perfCounterMultipleCounts<ap_uint<64>,ap_uint<64>,64>(sReadPrfCntr_cmd, reading_cntr);
148  //Step 3: compare
150  pRDCmpStreamsCntWordAligned<4000000,maximum_number_of_beats>(max_address_under_test,sReadData, sGoldData,faulty_addresses_cntr, first_faulty_address);
151  #endif
152 }

◆ pReadSimplerTestMemTest()

template<typename Tcntr , const unsigned int max_iterations = 4000000, const unsigned int buff_dim = 64*2>
void pReadSimplerTestMemTest ( hls::stream< Tcntr > &  sOutCmd,
membus_t lcl_mem,
local_mem_addr_t  max_addr_ut,
unsigned int  burst_size,
ap_uint< 32 > *  faulty_addresses_cntr,
local_mem_addr_t first_faulty_address 
)

Simple version of a read memtest that read up to a given maximum address No control on the burst size or on the first faulty address.

Parameters
[out]sOutCmdthe perf counter cmd stream
[in]lcl_memthe virtual memory mapped pointer
[in]max_addr_utthe maximum address to test
[in]burst_sizethe run-time variable burst size NOT MEANINGFUL HERE
[out]faulty_addresses_cntrthe fault cntr
[out]first_faulty_addressthe fairst faulty address NOT MEANINGFUL HERE
Returns
Nothing.

Definition at line 390 of file memtest_pattern_library.hpp.

397 {
398  local_mem_addr_t curr_address_ut;
399  int faults = 0;
400 //Step 1) start counting
401  sOutCmd.write(0);
402  for (curr_address_ut = 0; curr_address_ut < max_addr_ut; curr_address_ut++){
403 #pragma HLS PIPELINE II=1
404 #pragma HLS LOOP_TRIPCOUNT min = 1 max = max_iterations
405  #if DEBUG_LEVEL == TRACE_ALL
406  #ifndef __SYNTHESIS__
407  printf("Tst=%s vs gld=%s\n",lcl_mem[curr_address_ut].to_string().c_str(),(curr_address_ut+1).to_string().c_str());
408  #endif
409  #endif
410 //Step 2) read a simple pattern and fault checks
411  faults += (lcl_mem[curr_address_ut]!=(curr_address_ut+1)) ? 1 : 0;
412  }
413 //Step 3) stop counting
414  sOutCmd.write(0);
415  *faulty_addresses_cntr = faults;
416  *first_faulty_address = 0;
417 }

◆ pRXPath()

void pRXPath ( stream< NetworkWord > &  siSHL_This_Data,
stream< NetworkMetaStream > &  siNrc_meta,
stream< NetworkMetaStream > &  sRxtoProc_Meta,
stream< NetworkWord > &  sRxpToProcp_Data,
NetworkMetaStream  meta_tmp,
bool *  start_stop,
unsigned int *  processed_word_rx,
unsigned int *  processed_bytes_rx 
)

Receive Path - From SHELL to THIS.

Parameters
[in]siSHL_This_Data
[in]siNrc_meta
[out]sRxtoTx_Meta
[out]sRxpToProcp_Data
[out]start_stop
[out]meta_tmp
[out]processed_word
Returns
Nothing.

Definition at line 121 of file memtest_library.hpp.

131 {
132  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
133  #pragma HLS INLINE off
134  //-- LOCAL VARIABLES ------------------------------------------------------
135 
136 
138 #pragma HLS reset variable=enqueueFSM
139 
140 
141  NetworkWord netWord;
142  ap_uint<16> max_iterations;
143  static bool start_stop_local = false;
144  static bool prev_was_start = false;
145 #pragma HLS reset variable=start_stop_local
146 
147  *start_stop = start_stop_local;
148  switch(enqueueFSM)
149  {
150  case WAIT_FOR_META:
151  #if DEBUG_LEVEL == TRACE_ALL
152  printf("DEBUG in pRXPath: enqueueFSM - WAIT_FOR_META, *processed_word_rx=%u, *processed_bytes_rx=%u\n",
153  *processed_word_rx, *processed_bytes_rx);
154  #endif
155  if ( !siNrc_meta.empty() && !sRxtoProc_Meta.full() )
156  {
157  meta_tmp = siNrc_meta.read();//not sure if I have to continue to test or not, hence sending the meta or not is different
158  meta_tmp.tlast = 1; //just to be sure...
159  sRxtoProc_Meta.write(meta_tmp); //valid destination
161  }
162  break;
163 
164  case PROCESSING_PACKET:
165  #if DEBUG_LEVEL == TRACE_ALL
166  printf("DEBUG in pRXPath: enqueueFSM - PROCESSING_PACKET, *processed_word_rx=%u, *processed_bytes_rx=%u\n",
167  *processed_word_rx, *processed_bytes_rx);
168  #endif
169 
170  if ( !siSHL_This_Data.empty() && !sRxpToProcp_Data.full() )
171  {
172  //-- Read incoming data chunk
173  netWord = siSHL_This_Data.read();
174 
175  switch(netWord.tdata.range(MEMTEST_COMMANDS_HIGH_BIT,MEMTEST_COMMANDS_LOW_BIT))//the command is in the first two bits
176  {
177  case(TEST_START_CMD):
178  start_stop_local=true;
179  *start_stop=true;
180  sRxpToProcp_Data.write(netWord);
181  prev_was_start=true;
182  #if DEBUG_LEVEL == TRACE_ALL
183  printf("Hallo, I received a start command :D\n");
184  #endif
185  break;
186  case(TEST_STOP_CMD):
187  start_stop_local=false;
188  *start_stop=false;
189  netWord.tdata=TEST_STOP_CMD;
190  netWord.tlast = 1;
191  sRxpToProcp_Data.write(netWord);
192  prev_was_start=false;
193  #if DEBUG_LEVEL == TRACE_ALL
194  printf("Hallo, I received a stop command D:\n");
195  #endif
196  break;
197 
198  case(TEST_BURSTSIZE_CMD):
199  #if DEBUG_LEVEL == TRACE_ALL
200  printf("Hallo, I received a burst size command :), and prev_was_start=%u\n",prev_was_start);
201  #endif
202  if (prev_was_start)
203  {
204  sRxpToProcp_Data.write(netWord);
205 
206  }else{
207  netWord.tdata=TEST_INVLD_CMD;
208  sRxpToProcp_Data.write(netWord);
209  }
210  prev_was_start=false;
211  break;
212  default:
213  if (start_stop_local)
214  {
215  //some data manipulation here
216  // everything is running and should no sending anything back
217  } else {
218  netWord.tdata=TEST_INVLD_CMD;
219  prev_was_start=false;
220  sRxpToProcp_Data.write(netWord);
221  }
222  break;
223 
224  }
225  //no need to forwarding every packet to the processing, hence commenting out
226  //sRxpToProcp_Data.write(netWord);
227  if(netWord.tlast == 1)
228  {
230  }
231  }
232  break;
233  }
234 
235 
236 }
#define MEMTEST_COMMANDS_HIGH_BIT
Definition: memtest.hpp:67
#define PacketFsmType
Definition: memtest.hpp:76
#define PROCESSING_PACKET
Definition: memtest.hpp:73
#define WAIT_FOR_META
Definition: memtest.hpp:71
#define MEMTEST_COMMANDS_LOW_BIT
Definition: memtest.hpp:68
uint8_t enqueueFSM
Definition: uppercase.cpp:54
ap_uint< 1 > tlast
Definition: network.hpp:111
ap_uint< 64 > tdata
Definition: network.hpp:49
ap_uint< 1 > tlast
Definition: network.hpp:51
Here is the caller graph for this function:

◆ pTHISProcessingData()

template<const unsigned int counter_width = 64>
void pTHISProcessingData ( stream< NetworkWord > &  sRxpToProcp_Data,
stream< NetworkWord > &  sProcpToTxp_Data,
stream< NetworkMetaStream > &  sRxtoProc_Meta,
stream< NetworkMetaStream > &  sProctoTx_Meta,
bool *  start_stop 
)

THIS processing the data once recieved a start command Template function for custom processing.

Parameters
[in]sRxpToProcp_Datastream of data from rx to proc interface
[out]sProcpToTxp_Datastream of data from proc to tx interface
[in]start_stopstart and stop command
[in]lcl_mem0shell-role mp1 memory mapped interfce virtual ptr 0
[in]lcl_mem1shell-role mp1 memory mapped interfce virtual ptr 1
Returns
Nothing.

Definition at line 191 of file memtest_processing.hpp.

205  {
206  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
207 #pragma HLS INLINE off
208  //-- LOCAL VARIABLES ------------------------------------------------------
209  NetworkWord netWord;
210  NetworkWord outNetWord;
211  static NetworkMetaStream outNetMeta = NetworkMetaStream();;
213 
214  static ap_uint<16> max_iterations;
215 
216  static local_mem_addr_t first_faulty_address;
217 
218  static ap_uint<32> faulty_addresses_cntr;
219 
220  static local_mem_addr_t max_address_under_test; // byte addressable;
221  static size_t bytes_sent_for_tx =0;
222 
223 #pragma HLS reset variable=processingFSM
224 #pragma HLS reset variable=outNetMeta
225 #pragma HLS reset variable=max_iterations
226 #pragma HLS reset variable=first_faulty_address
227 #pragma HLS reset variable=faulty_addresses_cntr
228 #pragma HLS reset variable=max_address_under_test
229 #pragma HLS reset variable=processingFSM
230 #pragma HLS reset variable=bytes_sent_for_tx
231 
232  static ap_uint<32> testCounter;
233  static ap_uint<counter_width> reading_cntr = 0;
234  static ap_uint<counter_width> writing_cntr = 0;
235  static unsigned int burst_size=1;
236  static local_mem_addr_t tmp_wordaligned_address = 0;
237  static int emptycntr=0;
238 
239 #pragma HLS reset variable=testCounter
240 #pragma HLS reset variable=tmp_wordaligned_address
241 #pragma HLS reset variable=burst_size
242 
243 
244 //assuming that whnever I send a start I must complete the run and then restart unless a stop
245 // or stopping once done with the run iterations
246  switch(processingFSM)
247  {
249  #if DEBUG_LEVEL == TRACE_ALL
250  printf("DEBUG proc FSM, I am in the WAIT_FOR_META state\n");
251  #endif
252  //resetting once per test suite
253  max_address_under_test = 0;
254  max_iterations=0;
255  bytes_sent_for_tx = 0;
256  burst_size=1;
257  if ( !sRxtoProc_Meta.empty() && !sProctoTx_Meta.full())
258  {
259  outNetMeta = sRxtoProc_Meta.read();
260  sProctoTx_Meta.write(outNetMeta);
262  }
263  break;
264 
266  #if DEBUG_LEVEL == TRACE_ALL
267  printf("DEBUG proc FSM, I am in the PROCESSING_PCKT_PROC state\n");
268  #endif
269 //parse the received data
270  if ( !sRxpToProcp_Data.empty() && !sProcpToTxp_Data.full())
271  {
272  netWord = sRxpToProcp_Data.read();
274  {
275  case TEST_INVLD_CMD:
276  /* FWD an echo of the invalid*/
277  #if DEBUG_LEVEL == TRACE_ALL
278  printf("DEBUG processing the packet with invalid cmd\n");
279  #endif
280  sProcpToTxp_Data.write(netWord);
282  break;
283  case TEST_STOP_CMD:
284  /* call with stop (never started), unset, fwd the stop */
285  #if DEBUG_LEVEL == TRACE_ALL
286  printf("DEBUG processing the packet with stop cmd\n");
287  #endif
288  outNetWord.tdata=TEST_STOP_CMD;
289  outNetWord.tkeep = 0xFF;
290  outNetWord.tlast = 1;
291  sProcpToTxp_Data.write(outNetWord);
293  break;
294  default:
295  /* Execute the test if not invalid or stop*/
296  #if DEBUG_LEVEL == TRACE_ALL
297  printf("DEBUG processing the packet with the address within cmd\n");
298  #endif
299  max_address_under_test = netWord.tdata(MEMTEST_ADDRESS_HIGH_BIT,MEMTEST_ADDRESS_LOW_BIT);
300  max_iterations = netWord.tdata.range(MEMTEST_ITERATIONS_HIGH_BIT,MEMTEST_ITERATIONS_LOW_BIT);
301  #if DEBUG_LEVEL == TRACE_ALL
302  #ifndef __SYNTHESIS__
303  printf("DEBUG processing the packet with the address %s within cmd %s\n", max_address_under_test.to_string().c_str(), max_iterations.to_string().c_str());
304  #endif //__SYNTHESIS__
305  #endif
307  break;
308  }
309  }
310  break;
311 
313  #if DEBUG_LEVEL == TRACE_ALL
314  printf("DEBUG proc FSM, I am in the FSM_PROCESSING_BURST_READING state\n");
315  #endif
316 //parse the received data
317  if ( !sRxpToProcp_Data.empty())
318  {
319  netWord = sRxpToProcp_Data.read();
320  #if DEBUG_LEVEL == TRACE_ALL
321  std::cout << netWord.tdata.to_string() << std::endl;
322  #endif
324  {
325  case TEST_BURSTSIZE_CMD:
326  /* extract the busrt size*/
327  burst_size = netWord.tdata.range(MEMTEST_BURST_HIGH_BIT,MEMTEST_BURST_LOW_BIT);
328 
329  #if DEBUG_LEVEL == TRACE_ALL
330  printf("DEBUG processing the packet with burst cmd, and burst size=%u\n",burst_size);
331  #endif
333  break;
334 
335 
336  default:
337  /*unkown stuff hence using a burst with 1 beat*/
338  #if DEBUG_LEVEL == TRACE_ALL
339  #ifndef __SYNTHESIS__
340  printf("DEBUG processing the packet with smth bad within cmd: %s\n",netWord.tdata.range(MEMTEST_COMMANDS_HIGH_BIT,MEMTEST_COMMANDS_LOW_BIT).to_string().c_str());
341  #endif
342  #endif
343  burst_size=1;
344  sProcpToTxp_Data.write(netWord);
346  break;
347  }
348  }
349  break;
350 
351 //The hw can begin to do something
353  // sOCMDPerfCounter.write(0);//init the counter
354  #if DEBUG_LEVEL == TRACE_ALL
355  printf("DEBUG proc FSM, I am in the START state\n");
356  #endif
357  //setting everything ready to start
358  first_faulty_address = 0;
359  faulty_addresses_cntr = 0;
360  if(max_address_under_test%64==0){
361  tmp_wordaligned_address = max_address_under_test/64;
362  } else {
363  tmp_wordaligned_address = (max_address_under_test/64+1);
364  }
365  #if DEBUG_LEVEL == TRACE_ALL
366  #ifndef __SYNTHESIS__
367  std::cout << " testing the address word aligned" << tmp_wordaligned_address.to_string() << std::endl;
368  #endif
369  #endif
370  reading_cntr = 0;
371  writing_cntr = 0;
372  testCounter = 0;
373  processingFSM = FSM_PROCESSING_DATAFLOW_WRITE;//FSM_PROCESSING_WRITE;
374  break;
375 
376  //run continuously, hence more than once
378  testCounter += 1;
379  reading_cntr = 0;
380  writing_cntr = 0;
381  faulty_addresses_cntr = 0;
382  first_faulty_address = 0;
383 
384  //stopping conditions: either a Stop or the maximum iterations
385  if(*start_stop && testCounter < max_iterations){
386  #if DEBUG_LEVEL == TRACE_ALL
387  #ifndef __SYNTHESIS__
388  printf("DEBUG processing continuous run (still run, iter %s) max iters: %s\n",testCounter.to_string().c_str(),max_iterations.to_string().c_str());
389  #endif //__SYNTHESIS__
390  #endif
391  // check if need another meta to send out!
392  // if already over the MTU size, or with a command (stop case) or with another iteration I need to send out another meta
393  if(bytes_sent_for_tx >= PACK_SIZE){
394  sProctoTx_Meta.write(outNetMeta);
395  #if DEBUG_LEVEL == TRACE_ALL
396  std::cout << "DEBUG: writing an additional meta with bytes sent equal to " << bytes_sent_for_tx << std::endl;
397  #endif
398  bytes_sent_for_tx = 0;
399  }
401 
402  break;
403  }else{
404  #if DEBUG_LEVEL == TRACE_ALL
405  #ifndef __SYNTHESIS__
406  printf("DEBUG processing continuous run (stop the run at iter %s) max iters: %s \n",testCounter.to_string().c_str(),max_iterations.to_string().c_str());
407  #endif //__SYNTHESIS__
408  #endif
409  //signal the end of the packet with the iteration of the tests performed
411  outNetWord.tdata.range(NETWORK_WORD_BIT_WIDTH-1,MEMTEST_COMMANDS_HIGH_BIT+1)=testCounter;
412  outNetWord.tkeep = 0xFF;
413  outNetWord.tlast = 1;
414  sProcpToTxp_Data.write(outNetWord);
416  break;
417  }
418 
424  //Begin to process
426  #if DEBUG_LEVEL == TRACE_ALL
427  printf("DEBUG processing write dataflow\n");
428  #endif
429  pWriteDataflowMemTest<top_param_maximum_number_of_beats>( lcl_mem0,
430  tmp_wordaligned_address , &writing_cntr,&testCounter,burst_size);
432  break;
433 
435  #if DEBUG_LEVEL == TRACE_ALL
436  printf("DEBUG processing the output of a run\n");
437  #endif
438  emptycntr++;
439  if(emptycntr==DDR_LATENCY+1){
441  emptycntr=0;
442  }
443  break;
444 
446 #if DEBUG_LEVEL == TRACE_ALL
447  printf("DEBUG processing read dataflow\n");
448 #endif
449  pReadDataflowMemTest<top_param_maximum_number_of_beats>(lcl_mem1,
450  tmp_wordaligned_address ,&reading_cntr,&faulty_addresses_cntr, &first_faulty_address,burst_size);
452  break;
453 
460  #if DEBUG_LEVEL == TRACE_ALL
461  printf("DEBUG processing the output of a run\n");
462  #endif
463  if(!sProcpToTxp_Data.full()){
464  outNetWord.tdata = max_address_under_test;
465  outNetWord.tkeep = 0xFF;
466  outNetWord.tlast = 0;
467  sProcpToTxp_Data.write(outNetWord);
468  bytes_sent_for_tx += 8;
470  }
471  break;
472 
474  #if DEBUG_LEVEL == TRACE_ALL
475  #ifndef __SYNTHESIS__
476  printf("DEBUG processing the output of a run part 2; faulty address cntr %s\n",faulty_addresses_cntr.to_string().c_str());
477  #endif
478  #endif
479  if(!sProcpToTxp_Data.full()){
480  outNetWord.tdata=faulty_addresses_cntr;
481  outNetWord.tkeep = 0xFF;
482  outNetWord.tlast = 0;
483  sProcpToTxp_Data.write(outNetWord);
484  bytes_sent_for_tx += 8 ;
486  }
487  break;
489  #if DEBUG_LEVEL == TRACE_ALL
490  #ifndef __SYNTHESIS__
491  printf("DEBUG processing the output of a run part 3: first faulty address %s\n",first_faulty_address.to_string().c_str());
492  #endif
493  #endif
494  if(!sProcpToTxp_Data.full()){
495  outNetWord.tdata=first_faulty_address;
496  outNetWord.tkeep = 0xFF;
497  outNetWord.tlast = 0;
498  sProcpToTxp_Data.write(outNetWord);
499  bytes_sent_for_tx += 8;
501  }
502  break;
504  #if DEBUG_LEVEL == TRACE_ALL
505  printf("DEBUG processing the output of a run part 4\n");
506  #endif
507  if(!sProcpToTxp_Data.full()){
508  outNetWord.tdata = writing_cntr;
509  outNetWord.tkeep = 0xFF;
510  outNetWord.tlast = 0;
511  sProcpToTxp_Data.write(outNetWord);
512  bytes_sent_for_tx += 8;
514  }
515  break;
517  #if DEBUG_LEVEL == TRACE_ALL
518  printf("DEBUG processing the output of a run part 4\n");
519  #endif
520  if(!sProcpToTxp_Data.full()){
521  outNetWord.tdata= reading_cntr;
522  outNetWord.tkeep = 0xFF;
523  outNetWord.tlast = 0;
524  sProcpToTxp_Data.write(outNetWord);
525  bytes_sent_for_tx += 8;
527  }
528  break;
529 
530  }
531 };
#define FSM_PROCESSING_OUTPUT_2
#define FSM_PROCESSING_WAIT_FOR_META
#define MEMTEST_ADDRESS_HIGH_BIT
#define ProcessingFsmType
#define FSM_PROCESSING_OUTPUT_3
#define FSM_PROCESSING_WAIT_FOR_DDR_CONTROLLER_EMPTYNESS
#define FSM_PROCESSING_OUTPUT
#define FSM_PROCESSING_CONTINUOUS_RUN
#define FSM_PROCESSING_DATAFLOW_WRITE
#define MEMTEST_ITERATIONS_HIGH_BIT
#define FSM_PROCESSING_OUTPUT_4
#define MEMTEST_BURST_HIGH_BIT
#define FSM_PROCESSING_START
#define MEMTEST_BURST_LOW_BIT
#define MEMTEST_ADDRESS_LOW_BIT
#define FSM_PROCESSING_DATAFLOW_READ
#define FSM_PROCESSING_BURST_READING
#define MEMTEST_ITERATIONS_LOW_BIT
#define FSM_PROCESSING_OUTPUT_5
#define FSM_PROCESSING_PCKT_PROC
#define PACK_SIZE
Definition: config.h:51
uint8_t processingFSM
Definition: uppercase.cpp:57
#define NETWORK_WORD_BIT_WIDTH
Definition: network.hpp:46
ap_uint< 8 > tkeep
Definition: network.hpp:50

◆ pTXPath()

void pTXPath ( stream< NetworkWord > &  soTHIS_Shl_Data,
stream< NetworkMetaStream > &  soNrc_meta,
stream< NetworkWord > &  sProcpToTxp_Data,
stream< NetworkMetaStream > &  sRxtoTx_Meta,
stream< NodeId > &  sDstNode_sig,
unsigned int *  processed_word_tx,
ap_uint< 32 > *  pi_rank 
)

Transmit Path - From THIS to SHELL.

Parameters
[out]soTHIS_Shl_Data
[out]soNrc_meta
[in]sProcpToTxp_Data
[in]sRxtoTx_Meta
[in]pi_rank
[in]sDstNode_sig
Returns
Nothing.

Definition at line 251 of file memtest_library.hpp.

260 {
261  //-- DIRECTIVES FOR THIS PROCESS ------------------------------------------
262  //#pragma HLS DATAFLOW interval=1
263  #pragma HLS INLINE off
264  //-- LOCAL VARIABLES ------------------------------------------------------
265  NetworkWord netWordTx;
266  NetworkMeta meta_in = NetworkMeta();
267  static NodeId dst_rank;
269  #pragma HLS reset variable=dequeueFSM
270 
271  switch(dequeueFSM)
272  {
273  case WAIT_FOR_META:
274  if(!sDstNode_sig.empty())
275  {
276  dst_rank = sDstNode_sig.read();
278  //Triangle app needs to be reset to process new rank
279  }
280  break;
282  #if DEBUG_LEVEL == TRACE_ALL
283  printf("DEBUG in pTXPath: dequeueFSM=%d - WAIT_FOR_STREAM_PAIR, *processed_word_tx=%u\n",
284  dequeueFSM, *processed_word_tx);
285  #endif
286  //-- Forward incoming chunk to SHELL
287  *processed_word_tx = 0;
288 
289  if (( !sProcpToTxp_Data.empty() && !sRxtoTx_Meta.empty()
290  && !soTHIS_Shl_Data.full() && !soNrc_meta.full() ))
291  {
292  netWordTx = sProcpToTxp_Data.read();
293 
294  // in case MTU=8 ensure tlast is set in WAIT_FOR_STREAM_PAIR and don't visit PROCESSING_PACKET
295  if (PACK_SIZE == 8)
296  {
297  netWordTx.tlast = 1;
298  }
299  soTHIS_Shl_Data.write(netWordTx);
300 
301  meta_in = sRxtoTx_Meta.read().tdata;
302  NetworkMetaStream meta_out_stream = NetworkMetaStream();
303  meta_out_stream.tlast = 1;
304  meta_out_stream.tkeep = 0xFF; //just to be sure
305 
306  meta_out_stream.tdata.dst_rank = dst_rank;
307  meta_out_stream.tdata.src_rank = (NodeId) *pi_rank;
308  meta_out_stream.tdata.dst_port = meta_in.src_port;
309  meta_out_stream.tdata.src_port = meta_in.dst_port;
310 
311  soNrc_meta.write(meta_out_stream);
312 
313  (*processed_word_tx)++;
314 
315  if(netWordTx.tlast != 1)
316  {
318  }
319  }
320  break;
321 
322  case PROCESSING_PACKET:
323  #if DEBUG_LEVEL == TRACE_ALL
324  printf("DEBUG in pTXPath: dequeueFSM=%d - PROCESSING_PACKET, *processed_word_tx=%u\n",
325  dequeueFSM, *processed_word_tx);
326  #endif
327  if( !sProcpToTxp_Data.empty() && !soTHIS_Shl_Data.full())
328  {
329  netWordTx = sProcpToTxp_Data.read();
330 
331  // This is a normal termination of the axi stream from vitis functions
332  if(netWordTx.tlast == 1)
333  {
335  }
336 
337  // This is our own termination based on the custom MTU we have set in PACK_SIZE.
338  // TODO: We can map PACK_SIZE to a dynamically assigned value either through MMIO or header
339  // in order to have a functional bitstream for any MTU size
340  (*processed_word_tx)++;
341  if (((*processed_word_tx)*8) % PACK_SIZE == 0)
342  {
343  netWordTx.tlast = 1;
345  }
346 
347  soTHIS_Shl_Data.write(netWordTx);
348  }
349  break;
350  }
351 }
#define WAIT_FOR_STREAM_PAIR
Definition: memtest.hpp:72
uint8_t dequeueFSM
Definition: uppercase.cpp:55
ap_uint< 8 > tkeep
Definition: network.hpp:110
NetworkMeta tdata
Definition: network.hpp:109
NodeId dst_rank
Definition: network.hpp:95
NodeId src_rank
Definition: network.hpp:97
NrcPort src_port
Definition: network.hpp:98
NrcPort dst_port
Definition: network.hpp:96
Here is the caller graph for this function:

◆ pWRGenerateData2WriteOnStream()

template<const unsigned int max_iterations = 4000000, const unsigned int buff_dim = 16>
void pWRGenerateData2WriteOnStream ( hls::stream< local_mem_word_t > &  sOutGeneratedData,
ap_uint< 32 > *  testCounter,
local_mem_addr_t  max_addr_ut 
)

A function that generate a streams of data according to function and writes them on a stream CHECK: FAULT_INJECTION define insert after the third test some faults.

Parameters
[out]sOutGeneratedDatathe output stream for deta generation
[in]max_addr_utthe maximum address to test
[in]testCounterthe current times of re-executing this test
Returns
Nothing.

Definition at line 164 of file memtest_pattern_library.hpp.

168 {
169 #pragma HLS INLINE off
170  static local_mem_word_t tmp_out [buff_dim];
171 #pragma HLS array_partition variable=tmp_out cyclic factor=2 dim=1
172 
173  static local_mem_addr_t curr_address_ut=0;
174  generate_loop:
175  for (; curr_address_ut < max_addr_ut; )
176  {
177 #pragma HLS PIPELINE II=1
178 #pragma HLS LOOP_TRIPCOUNT min = 1 max = max_iterations
179 //if free to generate or need backpressure
180  if (!sOutGeneratedData.full())
181  {
182  //Step 1) Generated the data according to a function
183 
184  // genXoredSequentialNumbersSecondVersion
185  // <local_mem_addr_non_byteaddressable_t, LOCAL_MEM_WORD_SIZE/32, local_mem_word_t,
186  // ap_uint<32>,32>(maddr_non_byte,
187  // tmp_out+(maddr_non_byte));
188  //genSequentialNumbers<local_mem_addr_non_byteaddressable_t,local_mem_word_t>(curr_address_ut*64, tmp_out+(maddr_non_byte));
190  local_mem_word_t>(curr_address_ut, tmp_out+(curr_address_ut%buff_dim));
191 
192 //Step 2) Optional fault injection
193  local_mem_word_t tmp_out_scalar;
194  #ifdef FAULT_INJECTION
195  //TODO: place for control fault injection with a function?
196  if(*testCounter >= 2 && curr_address_ut > 0){
197  tmp_out_scalar = tmp_out[curr_address_ut%buff_dim] & static_cast<local_mem_word_t>(0);
198  }else{
199  tmp_out_scalar = tmp_out[curr_address_ut%buff_dim];
200  }
201  #else // FAULT_INJECTION
202  tmp_out_scalar = tmp_out[curr_address_ut%buff_dim];
203  #endif // FAULT_INJECTION
204  //Step 3) write out to the next macrostep and going to the next element
205  sOutGeneratedData.write(tmp_out_scalar);
206  curr_address_ut++;
207  }
208  //else account for a newer cycle to write
209  }
210  curr_address_ut=0;
211 
212 
213 }
Here is the call graph for this function:

◆ pWriteDataflowMemTest()

template<const unsigned int maximum_number_of_beats = 512>
void pWriteDataflowMemTest ( membus_t lcl_mem0,
local_mem_addr_t  max_address_under_test,
ap_uint< 64 > *  writing_cntr,
ap_uint< 32 > *  testCounter,
unsigned int  burst_size 
)

Definition at line 76 of file memtest_processing.hpp.

82 {
83  #pragma HLS INLINE off
84  static hls::stream<ap_uint<64>> sWritePrfCntr_cmd("sWritePrfCntr_cmd");
85  #pragma HLS STREAM variable=sWritePrfCntr_cmd depth=64 dim=1
86  static hls::stream<local_mem_word_t> generatedWriteData("generatedWriteData");
87  #pragma HLS STREAM variable=generatedWriteData depth=64 dim=1
88  #pragma HLS DATAFLOW
89 
90  #ifdef SIMPLER_BANDWIDTH_TEST
91  //Step 1 write data
92  pWriteSimplerTestMemTest<ap_uint<64>>(sWritePrfCntr_cmd, lcl_mem0, max_address_under_test, burst_size);
93  //Step 2 count
94  perfCounterProc2MemCountOnly<ap_uint<64>,ap_uint<64>,64>(sWritePrfCntr_cmd, writing_cntr);
95  #else
96  //Step 1: Generate the data
97  pWRGenerateData2WriteOnStream<4000000>(generatedWriteData,testCounter,max_address_under_test);
98  //Step 2: write
99  pWRStream2WriteMainMemory<ap_uint<64>,4000000,maximum_number_of_beats>(sWritePrfCntr_cmd, generatedWriteData, lcl_mem0, max_address_under_test, burst_size);
100  //Step 2.b: count
101  perfCounterMultipleCounts<ap_uint<64>,ap_uint<64>,64>(sWritePrfCntr_cmd, writing_cntr);
102  #endif
103 }

◆ pWriteSimplerTestMemTest()

template<typename Tcntr , const unsigned int max_iterations = 4000000, const unsigned int buff_dim = 64*2>
void pWriteSimplerTestMemTest ( hls::stream< Tcntr > &  sOutCmd,
membus_t lcl_mem,
local_mem_addr_t  max_addr_ut,
unsigned int  burst_size 
)

Simple version of a write memtest that write up to a given maximum address No control on the burst size or on the first faulty address.

Parameters
[out]sOutCmdthe perf counter cmd stream
[in]lcl_memthe virtual memory mapped pointer
[in]max_addr_utthe maximum address to test
[in]burst_sizethe run-time variable burst size NOT MEANINGFUL HERE
Returns
Nothing.

Definition at line 343 of file memtest_pattern_library.hpp.

348 {
349 //Step 1) start counting
350  sOutCmd.write(0);
351  local_mem_addr_t curr_address_ut;
352 //Step 2) write a simple pattern
353  for (curr_address_ut = 0; curr_address_ut < max_addr_ut; curr_address_ut++)
354  {
355 #pragma HLS PIPELINE II=1
356 #pragma HLS LOOP_TRIPCOUNT min = 1 max = max_iterations
357  #if DEBUG_LEVEL == TRACE_ALL
358  #ifndef __SYNTHESIS__
359  printf("Writing address %s with max %s\n",curr_address_ut.to_string().c_str(), max_addr_ut.to_string().c_str());
360  #endif
361  #endif
362  lcl_mem[curr_address_ut]=curr_address_ut+1;
363  }
364 //Step 3) stop counting
365  sOutCmd.write(0);
366 }

◆ pWRStream2WriteMainMemory()

template<typename Tcntr , const unsigned int max_iterations = 4000000, const unsigned int buff_dim = 64*2>
void pWRStream2WriteMainMemory ( hls::stream< Tcntr > &  sOutCmd,
hls::stream< local_mem_word_t > &  sInGeneratedData,
membus_t lcl_mem,
local_mem_addr_t  max_addr_ut,
unsigned int  burst_size 
)

A function that read a stream of data and write them in a run-time variable burst-size.

Parameters
[out]sOutCmdthe output stream for cmd generation
[in]sInGeneratedDatathe input stream of generated data
[out]lcl_memthe memory mapped ptr
[in]max_addr_utthe maximum address to test
[in]burst_sizethe run-time variable burst size to write
Returns
Nothing.

Definition at line 228 of file memtest_pattern_library.hpp.

234 {
235 #pragma HLS INLINE off
236  local_mem_addr_t curr_address_ut;
237  local_mem_addr_t curr_writing_addr;
238  static local_mem_word_t tmp_out[buff_dim];
239  static unsigned int end_distance=0;
240  static bool last_iteration = false;
241  static bool activated_cntr = false;
242 #pragma HLS array_partition variable=tmp_out block factor=2 dim=1
243 
244  int idx, written_i;
245  int ptrs_difference=0;
246  unsigned int last_words=max_addr_ut;
247  unsigned int maximum_usable_fifo_words=buff_dim-buff_dim%burst_size;
248  read_and_write:
249  for (curr_address_ut = 0, idx=0, curr_writing_addr=0, written_i=0; curr_address_ut < max_addr_ut; curr_address_ut++)
250  {
251 #pragma HLS PIPELINE II=1
252 #pragma HLS LOOP_TRIPCOUNT min = 1 max = max_iterations
253  if (!sInGeneratedData.empty())
254  {
255  tmp_out[idx] = sInGeneratedData.read();
256  #if DEBUG_LEVEL == TRACE_ALL
257  #ifndef __SYNTHESIS__
258  std::cout << tmp_out[idx] << std::endl;
259  #endif//synth
260  #endif//debug lvl
261  //if stored enough data to begin the bursting OR this is last iteration
262  end_distance = max_addr_ut-curr_address_ut;
263  last_iteration = 1>=end_distance;
264  #if DEBUG_LEVEL == TRACE_ALL
265  #ifndef __SYNTHESIS__
266  std::cout << "test addr " << idx << " current address " << curr_address_ut << " max addr " << max_addr_ut << std::endl;
267  std::cout << "ptrs_difference " << ptrs_difference << " last_iteration " << last_iteration <<std::endl;
268  #endif
269  #endif
270 //accumulated a burst or last iteration
271  if ((ptrs_difference>0 && ptrs_difference>=burst_size-1) || (last_iteration))
272  {
273  #if DEBUG_LEVEL == TRACE_ALL
274  #ifndef __SYNTHESIS__
275  std::cout << "Burst filled or last iteration, end distance will be= " << end_distance << std::endl;
276  #endif
277  #endif
278  if (!last_iteration)
279  {
280  #if DEBUG_LEVEL == TRACE_ALL
281  #ifndef __SYNTHESIS__
282  std::cout << "BURST transferring " << burst_size << " words at " << curr_writing_addr << " address, from " << written_i << std::endl;
283  #endif
284  #endif
285  if(!activated_cntr){
286  sOutCmd.write(0);
287  activated_cntr = true;
288  }else{
289  sOutCmd.write(1);
290  }
291  memcpy(lcl_mem+curr_writing_addr, tmp_out+written_i, sizeof(local_mem_word_t)*burst_size);
292  sOutCmd.write(1);
293  curr_writing_addr+=burst_size;
294  written_i= (written_i+burst_size)%maximum_usable_fifo_words;
295  ptrs_difference-=burst_size;
296  last_words=end_distance;
297  }else{
298  #if DEBUG_LEVEL == TRACE_ALL
299  //#ifndef __SYNTHESIS__
300  std::cout << "LAST transferring " << last_words << " words at " << curr_writing_addr << " address, from " << written_i << std::endl;
301  //#endif
302  #endif
303  if(!activated_cntr){
304  sOutCmd.write(0);
305  activated_cntr = true;
306  }else{
307  sOutCmd.write(1);
308  }
309  memcpy(lcl_mem+curr_writing_addr, tmp_out+written_i, sizeof(local_mem_word_t)*(last_words));
310  sOutCmd.write(1);
311  curr_writing_addr+=(last_words);
312  written_i=(written_i+last_words)%maximum_usable_fifo_words;
313  ptrs_difference-=last_words;
314  }
315  }
316  if(idx==maximum_usable_fifo_words-1){
317  idx=0;
318  }else{
319  idx++;
320  }
321  ptrs_difference++;
322  }else{
323  curr_address_ut--;
324  }
325  }
326  sOutCmd.write(0);//quit everything
327  end_distance=0;
328  last_iteration = false;
329 }

Variable Documentation

◆ max_counter_cc

const unsigned long int max_counter_cc = 4000000

Definition at line 540 of file memtest_library.hpp.

◆ top_param_maximum_number_of_beats

const unsigned int top_param_maximum_number_of_beats = 4096

Definition at line 69 of file memtest_processing.hpp.