cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
memtest.hpp
Go to the documentation of this file.
1 
22 #ifndef _ROLE_MEMTEST_H_
23 #define _ROLE_MEMTEST_H_
24 
25 #include <stdio.h>
26 #include <iostream>
27 #include <fstream>
28 #include <string>
29 #include <string.h>
30 #include <math.h>
31 #include <hls_stream.h>
32 #include "ap_int.h"
33 #include <stdint.h>
34 #include <bitset>
35 
36 #include "network.hpp"
37 
38 using namespace hls;
39 
40 
41 // Define this option to load data from network to DDR memory before calling the kernel.
42 #define ENABLE_DDR
43 //
44 #define ROLE_IS_MEMTEST
45 
46 
49 enum EchoCtrl {
52  ECHO_OFF = 2
53 };
54 
55 
58 enum MemTestCmd {
63  TEST_INVLD_CMD = 0
64 };
65 
66 //CMD 8 bitwdith up to 255 commands (0 is invalid)
67 #define MEMTEST_COMMANDS_HIGH_BIT MEMTEST_COMMANDS_BITWIDTH-1
68 #define MEMTEST_COMMANDS_LOW_BIT 0
69 #define MEMTEST_COMMANDS_BITWIDTH 8
70 
71 #define WAIT_FOR_META 0
72 #define WAIT_FOR_STREAM_PAIR 1
73 #define PROCESSING_PACKET 2
74 #define MEMTEST_RETURN_RESULTS 3
75 
76 #define PacketFsmType uint8_t
77 
78 #define FSM_WRITE_NEW_DATA 0
79 #define FSM_DONE 1
80 #define PortFsmType uint8_t
81 
82 #define DEFAULT_TX_PORT 2718
83 #define DEFAULT_RX_PORT 2718
84 
85 
86 //------------------------------------ Declarations for DDR ----------------------------------------
87 
88 /* General memory Data Width is set as a parameter*/
89 /* 512-bit host AXI data width*/
90 #define MEMDW_512 512 // 512 Bus width in bits for cF DDR memory
91 typedef ap_uint<MEMDW_512> membus_512_t; /* 512-bit ddr memory access */
93 #define TOTMEMDW_512 16384 //1MB
94 
95 // The maximum number of cycles allowed to acknowledge a write to DDR (i.e. read the status stream)
96 #define CYCLES_UNTIL_TIMEOUT 0x0100
97 #define TYPICAL_DDR_LATENCY 4
98 #define DDR_LATENCY 52 // The latency cycles of cF DDR
99 #define EXTRA_DDR_LATENCY_DUE_II (64 + 8) // 8 is the write from input stream to local stream, 64 is read from local stream to DDR
100 
101 
102 
103 void memtest(
104 
105  ap_uint<32> *pi_rank,
106  ap_uint<32> *pi_size,
107  //------------------------------------------------------
108  //-- SHELL / This / Udp/TCP Interfaces
109  //------------------------------------------------------
110  stream<NetworkWord> &siSHL_This_Data,
111  stream<NetworkWord> &soTHIS_Shl_Data,
112  stream<NetworkMetaStream> &siNrc_meta,
113  stream<NetworkMetaStream> &soNrc_meta,
114  ap_uint<32> *po_rx_ports
115  #ifdef ENABLE_DDR
116  ,
117  //------------------------------------------------------
118  //-- SHELL / Role / Mem / Mp1 Interface
119  //------------------------------------------------------
122  #endif
123 );
124 
125 
126 #endif
127 
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.
Definition: memtest.cpp:39
#define ENABLE_DDR
Definition: memtest.hpp:42
membus_512_t membus_t
Definition: memtest.hpp:92
ap_uint< 512 > membus_512_t
Definition: memtest.hpp:91
EchoCtrl
Definition: memtest.hpp:49
MemTestCmd
Definition: memtest.hpp:58
membus_t lcl_mem0[16384]
membus_t lcl_mem1[16384]
@ 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
@ ECHO_STORE_FWD
Definition: memtest.hpp:51
@ ECHO_OFF
Definition: memtest.hpp:52
@ ECHO_PATH_THRU
Definition: memtest.hpp:50