// Copyright 2020-2024 Intel Corporation. // // This software and the related documents are Intel copyrighted materials, // and your use of them is governed by the express license under which they // were provided to you ("License"). Unless the License provides otherwise, // you may not use, modify, copy, publish, distribute, disclose or transmit // this software or the related documents without Intel's prior written // permission. // // This software and the related documents are provided as is, with no express // or implied warranties, other than those that are expressly stated in the // License. `resetall `undefineall `default_nettype none package dla_lt_pkg; import dla_common_pkg::*; function int calc_max_partitions; input int height, width, channels, stride_height, stride_width, elem_per_ddr; static int max_s[1:0] = '{default :'0}; static int init_s[1:0] = '{default :'0}; static int distance = 0; static int partitions = 0; static int s_w = 0; static int s_h = 0; static int in_w = 0; static int in_h = 0; static int c = 0; static int h = 0; static int w = 0; begin if (elem_per_ddr > height * width * channels) elem_per_ddr = height * width * channels - 1; for (integer i = 0; i < (height * width * channels); i++) begin if (i % elem_per_ddr == 0) begin distance = max_s[0] - init_s[0] + ((max_s[1] - init_s[1]) * (width / stride_width)); partitions = (distance > partitions) ? distance : partitions; init_s[0] = s_w; init_s[1] = s_h; max_s = init_s; end if (s_w > max_s[0]) begin max_s[0] = s_w; end if (s_h > max_s[1]) begin max_s[1] = s_h; end c += 1; if (c >= channels) begin c = 0; w += 1; in_w += 1; end if (w >= width) begin w = 0; in_w = 0; s_w = 0; h += 1; in_h += 1; end if (h >= height) begin h = 0; s_h = 0; in_h = 0; end if (in_w >= stride_width) begin in_w = 0; s_w += 1; end if (in_h >= stride_height) begin in_h = 0; s_h += 1; end end calc_max_partitions = (partitions + 1) < 2? 2 : (partitions + 1); end endfunction typedef struct { int ENABLE_LT; int DATA_ELEMENT_WIDTH; int CNT_BITS; int DO_U8_CONV; int DDR_BYTES; int CONFIG_BYTES; int MAX_CHANNELS; int MAX_FEATURE_HEIGHT; int MAX_FEATURE_WIDTH; int MAX_FEATURE_DEPTH; int MAX_STRIDE_HEIGHT; int MAX_STRIDE_WIDTH; int MAX_STRIDE_DEPTH; int CVEC; int MAX_PAD_FRONT; int MAX_PAD_LEFT; int MAX_PAD_TOP; int MAX_FILTER_HEIGHT; int MAX_FILTER_WIDTH; int MAX_FILTER_DEPTH; int MAX_DILATION_WIDTH; int MAX_DILATION_HEIGHT; int MAX_DILATION_DEPTH; device_family_t DEVICE; // device } lt_arch_t; enum {VALID, INNER_LINE, CVEC_IDX, STRIDE_IDX, C_STRIDE, NEW_LINE} address_info_e; `include "dla_layout_transform_config.svh" endpackage