16#ifndef SCRATCHPAD_TYPES_H
17#define SCRATCHPAD_TYPES_H
20#include <nvhls_types.h>
21#include <nvhls_message.h>
26enum ScratchpadOpcode_enum {LOAD, STORE, ScratchpadOpcode_Length};
27static const unsigned int kScratchpadOpcodeSize = ac::log2_ceil<ScratchpadOpcode_Length>::val;
28typedef NVUINTW(kScratchpadOpcodeSize) ScratchpadOpcode;
30template <
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;
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];
54template <
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];