File indexing completed on 2022-06-10 01:53:50
0001 #ifndef PARAMETERS_H_
0002 #define PARAMETERS_H_
0003
0004 #include <complex>
0005 #include "ap_int.h"
0006 #include "ap_fixed.h"
0007 #include "L1Trigger/Phase2L1ParticleFlow/interface/common/nnet_layer.h"
0008 #include "L1Trigger/Phase2L1ParticleFlow/interface/common/nnet_activation.h"
0009 #include "L1Trigger/Phase2L1ParticleFlow/interface/common/nnet_common.h"
0010
0011
0012 #define N_INPUTS 80
0013 #define N_LAYER_1 25
0014 #define N_LAYER_2 10
0015 #define N_LAYER_3 10
0016 #define N_OUTPUTS 1
0017
0018
0019
0020 typedef ap_fixed<24, 12> input2_t;
0021 typedef ap_fixed<16, 8> input_t;
0022 typedef ap_fixed<16, 8> layer1_t;
0023 typedef ap_fixed<16, 8> layer2_t;
0024 typedef ap_fixed<16, 8> layer3_t;
0025 typedef ap_fixed<16, 8> result_t;
0026 typedef ap_fixed<16, 8> accum_default_t;
0027 typedef ap_fixed<16, 8> weight_default_t;
0028 typedef ap_fixed<16, 8> bias_default_t;
0029
0030
0031 struct config1 : nnet::layer_config {
0032 static const unsigned n_in = N_INPUTS;
0033 static const unsigned n_out = N_LAYER_1;
0034 static const unsigned io_type = nnet::io_parallel;
0035 static const unsigned reuse_factor = 1;
0036
0037 static const unsigned n_zeros = 0;
0038 static const bool store_weights_in_bram = false;
0039 typedef accum_default_t accum_t;
0040 typedef bias_default_t bias_t;
0041 typedef weight_default_t weight_t;
0042 };
0043 struct relu_config1 : nnet::activ_config {
0044 static const unsigned n_in = N_LAYER_1;
0045 static const unsigned table_size = 1024;
0046 static const unsigned io_type = nnet::io_parallel;
0047 };
0048 struct config2 : nnet::layer_config {
0049 static const unsigned n_in = N_LAYER_1;
0050 static const unsigned n_out = N_LAYER_2;
0051 static const unsigned io_type = nnet::io_parallel;
0052 static const unsigned reuse_factor = 1;
0053
0054 static const unsigned n_zeros = 0;
0055 static const bool store_weights_in_bram = false;
0056 typedef accum_default_t accum_t;
0057 typedef bias_default_t bias_t;
0058 typedef weight_default_t weight_t;
0059 };
0060 struct relu_config2 : nnet::activ_config {
0061 static const unsigned n_in = N_LAYER_2;
0062 static const unsigned table_size = 1024;
0063 static const unsigned io_type = nnet::io_parallel;
0064 };
0065 struct config3 : nnet::layer_config {
0066 static const unsigned n_in = N_LAYER_2;
0067 static const unsigned n_out = N_LAYER_3;
0068 static const unsigned io_type = nnet::io_parallel;
0069 static const unsigned reuse_factor = 1;
0070
0071 static const unsigned n_zeros = 0;
0072 static const bool store_weights_in_bram = false;
0073 typedef accum_default_t accum_t;
0074 typedef bias_default_t bias_t;
0075 typedef weight_default_t weight_t;
0076 };
0077 struct relu_config3 : nnet::activ_config {
0078 static const unsigned n_in = N_LAYER_3;
0079 static const unsigned table_size = 1024;
0080 static const unsigned io_type = nnet::io_parallel;
0081 };
0082 struct config4 : nnet::layer_config {
0083 static const unsigned n_in = N_LAYER_3;
0084 static const unsigned n_out = N_OUTPUTS;
0085 static const unsigned io_type = nnet::io_parallel;
0086 static const unsigned reuse_factor = 1;
0087
0088 static const unsigned n_zeros = 0;
0089 static const bool store_weights_in_bram = false;
0090 typedef accum_default_t accum_t;
0091 typedef bias_default_t bias_t;
0092 typedef weight_default_t weight_t;
0093 };
0094 struct sigmoid_config4 : nnet::activ_config {
0095 static const unsigned n_in = N_OUTPUTS;
0096 static const unsigned table_size = 1024;
0097 static const unsigned io_type = nnet::io_parallel;
0098 };
0099
0100 #endif