-
Notifications
You must be signed in to change notification settings - Fork 399
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Quartus Stream Variable Converter & Backend io_stream enabled
- Loading branch information
Showing
6 changed files
with
108 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#ifndef NNET_TYPES_H_ | ||
#define NNET_TYPES_H_ | ||
|
||
#include <assert.h> | ||
#include <cstddef> | ||
#include <cstdio> | ||
|
||
namespace nnet { | ||
|
||
// Fixed-size array | ||
template<typename T, unsigned N> | ||
struct array { | ||
typedef T value_type; | ||
static const unsigned size = N; | ||
|
||
T data[N]; | ||
|
||
T& operator[](size_t pos) { | ||
return data[pos]; | ||
} | ||
|
||
const T& operator[](size_t pos) const { | ||
return data[pos]; | ||
} | ||
|
||
array& operator=(const array &other) { | ||
if(&other == this) | ||
return *this; | ||
|
||
assert(N == other.size && "Array sizes must match."); | ||
|
||
#pragma unroll | ||
for (unsigned i = 0; i < N; i++) { | ||
data[i] = other[i]; | ||
} | ||
return *this; | ||
} | ||
}; | ||
|
||
} | ||
|
||
#endif |