16 #ifndef SCRATCHPAD_TYPES_H
17 #define SCRATCHPAD_TYPES_H
19 #include <nvhls_int.h>
20 #include <nvhls_types.h>
21 #include <nvhls_message.h>
22 #include <comptrees.h>
26 enum ScratchpadOpcode_enum {LOAD, STORE, ScratchpadOpcode_Length};
27 static const unsigned int kScratchpadOpcodeSize = ac::log2_ceil<ScratchpadOpcode_Length>::val;
28 typedef NVUINTW(kScratchpadOpcodeSize) ScratchpadOpcode;
30 template <
typename T,
unsigned int AddrW
idth,
unsigned int N>
34 static const unsigned int type_width = Wrapped<T>::width;
35 static const unsigned int width = kScratchpadOpcodeSize + N + N * (AddrWidth + type_width);
37 ScratchpadOpcode opcode;
39 NVUINTW(AddrWidth) addr [N];
42 template<
unsigned int Size>
43 void Marshall(Marshaller<Size>& m) {
46 #pragma hls_unroll yes
47 for (
unsigned int i=0; i<N; i++) m & addr[i];
48 #pragma hls_unroll yes
49 for (
unsigned int i=0; i<N; i++) m & data[i];
54 template <
typename T,
unsigned int N>
60 static const unsigned int type_width = Wrapped<T>::width;
61 static const unsigned int width = N + type_width * N;
62 template <
unsigned int Size>
63 void Marshall(Marshaller<Size>& m) {
65 #pragma hls_unroll yes
66 for (
unsigned int i=0; i<N; i++) m & data[i];
NVUINTW(Wrapped< T >::width) TypeToNVUINT(T in)
Convert Type to NVUINT.