diff --git a/common/Definitions.h b/common/Definitions.h index 2a2bca8a..1b618bd1 100644 --- a/common/Definitions.h +++ b/common/Definitions.h @@ -21,7 +21,6 @@ #define MIN_FRAME_TIME_HALF_SPEED_IN_US 1000 #define MIN_FRAME_TIME_FULL_SPEED_IN_US 470 #define MAX_FRAME_TIME 2000 -#define MAX_SUMMATION 5000 #define MIN_STORAGE_CELL_DELAY_IN_NS 2100 #define READOUT_TIME_IN_US 20 @@ -134,7 +133,7 @@ #define FPGA_INTEGRATION_BIN_COUNT 1024 #define MAX_MODULES_FPGA 32 -#define MAX_FPGA_SUMMATION 128 +#define MAX_FPGA_SUMMATION 256 #define ADU_HISTO_BIN_WIDTH 32 #define ADU_HISTO_BIN_COUNT (65536/ ADU_HISTO_BIN_WIDTH) diff --git a/fpga/hdl/action_config.v b/fpga/hdl/action_config.v index 6cef147c..88d2a502 100644 --- a/fpga/hdl/action_config.v +++ b/fpga/hdl/action_config.v @@ -91,7 +91,7 @@ module action_config output reg [31:0] nframes , output reg [4:0] nmodules , output reg [3:0] nstorage_cells , - output reg [6:0] nsummation , + output reg [7:0] nsummation , output wire [31:0] hbm_size_bytes , output reg [15:0] spot_finder_count_threshold, output reg [7:0] spot_finder_snr_threshold, @@ -529,7 +529,7 @@ always @(posedge clk) begin nsummation <= 0; else if (reg_data_collection_idle) begin if (w_hs && waddr == `ADDR_NSUMMATION) - nsummation <= (s_axi_WDATA[6:0] & wmask[6:0]) | (nsummation & !wmask[6:0]); + nsummation <= (s_axi_WDATA[7:0] & wmask[7:0]) | (nsummation & !wmask[7:0]); end end diff --git a/fpga/hls/data_collection_fsm.cpp b/fpga/hls/data_collection_fsm.cpp index 05feb231..6efb8ab8 100644 --- a/fpga/hls/data_collection_fsm.cpp +++ b/fpga/hls/data_collection_fsm.cpp @@ -15,7 +15,7 @@ void data_collection_fsm(AXI_STREAM ð_in, ap_uint<32> nframes, ap_uint<5> nmodules, ap_uint<4> nstorage_cells, - ap_uint<7> nsummation) { + ap_uint<8> nsummation) { #pragma HLS INTERFACE ap_ctrl_none port=return #pragma HLS INTERFACE axis register both port=eth_in diff --git a/fpga/hls/frame_summation.cpp b/fpga/hls/frame_summation.cpp index c0ed203f..42ae1463 100644 --- a/fpga/hls/frame_summation.cpp +++ b/fpga/hls/frame_summation.cpp @@ -36,7 +36,7 @@ void frame_summation(STREAM_576 &data_in, STREAM_768 &data_out, packet_768_t packet_out; data_in >> packet_in; - ap_uint<7> sum = ACT_REG_NSUMMATION(packet_in.data); // 0..127 + ap_uint<8> sum = ACT_REG_NSUMMATION(packet_in.data); // 0..255 data_out << packet_768_t{.data = packet_in.data, .user = 0, .last = 0}; data_in >> packet_in; diff --git a/fpga/hls/frame_summation_reorder_compl.cpp b/fpga/hls/frame_summation_reorder_compl.cpp index 6e230527..d00d19f4 100644 --- a/fpga/hls/frame_summation_reorder_compl.cpp +++ b/fpga/hls/frame_summation_reorder_compl.cpp @@ -13,12 +13,12 @@ void frame_summation_reorder_compl(STREAM_512 &data_in, packet_512_t packet_in; data_in >> packet_in; - ap_uint<7> sum = ACT_REG_NSUMMATION(packet_in.data); // 0..127 + ap_uint<8> sum = ACT_REG_NSUMMATION(packet_in.data); // 0..255 data_out << packet_in; axis_completion completions[MAX_FPGA_SUMMATION * MAX_MODULES_FPGA]; ap_uint completion_mask[MAX_MODULES_FPGA]; - ap_uint<5> completion_count[MAX_MODULES_FPGA]; + ap_uint<9> completion_count[MAX_MODULES_FPGA]; // must represent 256 ap_uint<64> curr_frame_number_prefix[MAX_MODULES_FPGA]; @@ -33,7 +33,7 @@ void frame_summation_reorder_compl(STREAM_512 &data_in, while (!c.last) { #pragma HLS PIPELINE II=16 ap_uint<64> frame_number_prefix = c.frame_number / (sum + 1); - ap_uint<5> frame_number_loc = c.frame_number % (sum + 1); + ap_uint<8> frame_number_loc = c.frame_number % (sum + 1); // 0..255 ap_uint<7> module = c.module; if (frame_number_prefix > curr_frame_number_prefix[module]) { for (int i = 0; i <= sum; i++) { diff --git a/fpga/hls/hls_jfjoch.h b/fpga/hls/hls_jfjoch.h index a4eb84a8..5a365ca2 100644 --- a/fpga/hls/hls_jfjoch.h +++ b/fpga/hls/hls_jfjoch.h @@ -58,7 +58,7 @@ typedef hls::stream STREAM_768; #define ACT_REG_NFRAMES(x) ((x)(95 , 64)) // 32 bit #define ACT_REG_NMODULES(x) ((x)(132, 128)) // 5 bit (0..31) #define ACT_REG_NSTORAGE_CELLS(x) ((x)(148, 144)) // 5 bit -#define ACT_REG_NSUMMATION(x) ((x)(166, 160)) // 7 bit (0..127) +#define ACT_REG_NSUMMATION(x) ((x)(167, 160)) // 7 bit (0..255) struct axis_datamover_ctrl { ap_uint<40+64> data; @@ -279,7 +279,7 @@ void data_collection_fsm(AXI_STREAM ð_in, ap_uint<32> nframes, ap_uint<5> nmodules, ap_uint<4> nstorage_cells, - ap_uint<7> nsummation); + ap_uint<8> nsummation); void host_writer(STREAM_512 &data_in, hls::stream> &adu_histo_in,