Changed around line 1
+ # sensorcalc.scroll.pub
+ Website generated by Claude from prompt: implement web app that calculate in the backend those formulas and can edit it (each row has different mode) it refer to sensor setting.CPHY_MIPI_TO_WORD_CLK_RATIO = 28 = (7/16)/BITS_PER_WORD DPHY_MIPI_TO_WORD_CLK_RATIO = 16 = BITS_PER_WORD DPHY_TX_MIPI_TIME_PCLK TX_BYTES_PAY_LOAD = TX_BITS_PAYLOAD / 8 TX_BYTES_HEADER_OVERHEAD = DPHY_OVERHEAD["HEADER [BYTES]".LOWER()] + DPHY_OVERHEAD["FOOTER [BYTES]".LOWER()] TX_BYTES_PER_LANE = (TX_BYTES_PAY_LOAD + TX_BYTES_HEADER_OVERHEAD) / MIPI_LANES PCLK_TO_MIPI_RATIO = SPEC_PIXEL_CLOCK_MULT_BY_16CH / (MIPI_FREQ_MHZ / 8) DPHY_TX_MIPI_TIME_PCLK = TX_BYTES_PER_LANE * PCLK_TO_MIPI_RATIO CPHY_TX_MIPI_TIME_PCLK TX_BYTES_HEADER_OVERHEAD = CPHY_OVERHEAD["HEADER [BYTES]".LOWER()] TX_BITS_HEADER_OVERHEAD = TX_BYTES_HEADER_OVERHEAD * 8 PCLK_TO_MIPI_RATIO = SPEC_PIXEL_CLOCK_MULT_BY_16CH / MIPI_FREQ_MHZ CPHY_SYMBOL_TO_BITS_RATIO = 7/16 TX_BYTES_PER_LANE = ((TX_BITS_PAYLOAD + TX_BITS_HEADER_OVERHEAD * (MIPI_LANES + 1)) * CPHY_SYMBOL_TO_BITS_RATIO) / MIPI_LANES CPHY_TX_MIPI_TIME_PCLK = TX_BYTES_PER_LANE * PCLK_TO_MIPI_RATIO Parameters Calculation AF SCALING H: DIGITAL_HBIN_PRE_BIN * DIGITAL_HBIN_PRE_SUM V: DIGITAL_VBIN_PRE_SUM H: DIGITAL_HBIN_PRE_BIN * DIGITAL_HBIN_PRE_SUM V: DIGITAL_VBIN_PRE_SUM H_WDR_SPLIT V_WDR_SPLIT FEMIXER H_ANALOG_SCALE = ANALOG_HBIN * ANALOG_HSUM V_ANALOG_SCALE = ANALOG_VBIN * ANALOG_VSUM H: DIGITAL_HBIN_PRE_BIN * DIGITAL_HBIN_PRE_SUM V: DIGITAL_VBIN_PRE_SUM WDR_SPLIT H: DIGITAL_HBIN_POST_SUM H: DIGITAL_HBIN_POST_SUM H: DIGITAL_HBIN_POST_SUM APS HORIZONTAL_ACTUAL_WIDTH TG_OUT_COLUMNS_PER_EXP General Explanations 16CH When two chains are required to implement 16 interleaved channels, use this scenario Chain0: is 8 channels (0,2,4,6...,14) Chain1: is 8 channels (1,3,5,7...,15) SPEC_SPLIT_MODE_ON Fast readout scenario with 16 channels performed as a concatenation of two image halves Chain0: is 8 channels (1st half of line) Chain1: is 8 channels (2nd half of line) 1. VERTICAL CHAINS set_vertical_analog_scale VERTICAL_ANALOG_SCALE = VERTICAL_ANALOG_BIN * VERTICAL_ANALOG_SUM set_vertical_staggered_factor VERTICAL_STAGGERED_FACTOR = (SPEC_WDR_MODE == 3) ? 3 : (SPEC_WDR_MODE == 2 || IDCG) ? 2 : 1 set_vertical_digital_if_scale VERTICAL_DIGITAL_IF_SCALE = VERTICAL_DIGITAL_V_SUM * VERTICAL_DIGITAL_SCALING 2. HORIZONTAL CHAINS set_horizontal_analog_scale HORIZONTAL_ANALOG_SCALE = HORIZONTAL_ANALOG_SUM * HORIZONTAL_ANALOG_BIN set_horizontal_concat_interleave_scale_due_parallel_rss HORIZONTAL_CONCAT_INTERLEAVE_SCALE_DUE_PARALLEL_RSS = (SPEC_RSS_MODE+1) set_horizontal_digital_if_scale HORIZONTAL_DIGITAL_IF_SCALE = HORIZONTAL_DIGITAL_IF_SCALE_OUT_FROM_SUMMATION * HORIZONTAL_DIGITAL_BIN_POST_SUMMATION set_horizontal_digital_if_scale_out_from_summation HORIZONTAL_DIGITAL_IF_SCALE_OUT_FROM_SUMMATION = HORIZONTAL_DIGITAL_BIN_PRE_SUMMATION * HORIZONTAL_DIGITAL_H_SUM * HORIZONTAL_CONCAT_INTERLEAVE_SCALE_DUE_PARALLEL_RSS set_horizontal_adbus_tg_chain_nof_concat_streams HORIZONTAL_ADBUS_TG_CHAIN_NOF_CONCAT_STREAMS = (((SPEC_RSS_MODE + 1) * VERTICAL_STAGGERED_FACTOR) - HORIZONTAL_RSS_HDR_REDUCE_STREAM) set_horizontal_nof_chains_for_parallel_rss HORIZONTAL_NOF_CHAINS_FOR_PARALLEL_RSS = (HORIZONTAL_NOF_CHAINS_FOR_RS * (SPEC_RSS_MODE + 1)) set_horizontal_used_chains NEW: HORIZONTAL_USED_CHAINS =IF(SPEC_RSS_MODE== 0, HORIZONTAL_NOF_CHAINS_FOR_RS, HORIZONTAL_NOF_CHAINS_FOR_PARALLEL_RSS) * (1 + OR(SPEC_16CH_FE_SPLIT_AND_ISP_16CH, SPEC_SPLIT_MODE_ON)) - AND(SPEC_16CH_FE_SPLIT_AND_ISP_16CH, (SPEC_WDR != "OFF")) set_horizontal_alignment_due_split_to_parallel_chains HORIZONTAL_ALIGNMENT_DUE_SPLIT_TO_PARALLEL_CHAINS = IF(AND(SPEC_WDR_MODE="OFF",OR(SPEC_16CH_FE_SPLIT_AND_ISP_16CH,SPEC_SPLIT_MODE_ON)),HORIZONTAL_USED_CHAINS,1)* PPC_ISP set_horizontal_pck_scale_down_due_parallel_rss_or_split HORIZONTAL_PCK_SCALE_DOWN_DUE_PARALLEL_RSS_OR_SPLIT= HORIZONTAL_CONCAT_INTERLEAVE_SCALE_DUE_PARALLEL_RSS * ( OR(SPEC_16CH_FE_SPLIT_AND_ISP_16CH, AND(SPEC_SPLIT_MODE_ON, OR(HORIZONTAL_DIGITAL_BIN_PRE_SUMMATION >1, HORIZONTAL_DIGITAL_H_SUM >1) ) )+1) 3. HORIZONTAL set_horizontal_tg_parameters HORIZONTAL_TG_H_BLANK_ISP_CLK = H_TG_MODE[ANA_SCALE_STR] HORIZONTAL_TG_H_LADLC_PCLK = H_TG_LADLC[ANA_SCALE_STR] HORIZONTAL_TG_H_PIP_MODE = H_TG_PIP_MODE[ANA_SCALE_STR] set_horizontal_adbus_ladlc_reduction_per_exposure HORIZONTAL_ADBUS_LADLC_REDUCTION_PER_EXPOSURE = HORIZONTAL_USE_LADLC ? (HORIZONTAL_TG_H_LADLC_PCLK[ANA_SCALE_STR] - HORIZONTAL_REDUCE_LADLC) * (1+SPEC_RSS_MODE)/ANALOG_SCALE : 0 set_horizontal_readout_split_aligned HORIZONTAL_READOUT_SPLIT_ALIGNED = ((FLOOR((((((SPEC_IMAGE_SIZE_H + HORIZONTAL_DIGITAL_CROPPING) * HORIZONTAL_DIGITAL_BIN_PRE_SUMMATION) * HORIZONTAL_DIGITAL_BIN_POST_SUMMATION) + (HORIZONTAL_ALIGNMENT_DUE_SPLIT_TO_PARALLEL_CHAINS - 1)) / HORIZONTAL_ALIGNMENT_DUE_SPLIT_TO_PARALLEL_CHAINS), 1) * HORIZONTAL_ALIGNMENT_DUE_SPLIT_TO_PARALLEL_CHAINS) * HORIZONTAL_ANALOG_SCALE) set_horizontal_readout_tg_aligned HORIZONTAL_READOUT_TG_ALIGNED = (FLOOR(((((((SPEC_IMAGE_SIZE_H + HORIZONTAL_DIGITAL_CROPPING) * HORIZONTAL_DIGITAL_BIN_PRE_SUMMATION) * HORIZONTAL_DIGITAL_BIN_POST_SUMMATION) * HORIZONTAL_ANALOG_SCALE) + (WIDTH_ALIGN_MIN_FOR_TG - 1)) / WIDTH_ALIGN_MIN_FOR_TG), 1) * WIDTH_ALIGN_MIN_FOR_TG) set_horizontal_readout_cropping HORIZONTAL_READOUT_CROPPING"= APS_ACTIVE_WIDTH - MAX( HORIZONTAL_READOUT_SPLIT_ALIGNED , HORIZONTAL_READOUT_TG_ALIGNED ) set_horizontal_adbus_tg_chain_total_readout_pck HORIZONTAL_ADBUS_TG_CHAIN_TOTAL_READOUT_PCK =((((HORIZONTAL_APS_ACTIVE_WIDTH-HORIZONTAL_READOUT_CROPPING - (HORIZONTAL_USE_LADLC * (HORIZONTAL_TG_H_LADLC_PCLK[ANA_SCALE_STR] - HORIZONTAL_REDUCE_LADLC)) )/HORIZONTAL_ANALOG_SCALE))*HORIZONTAL_ADBUS_TG_CHAIN_NOF_CONCAT_STREAMS)/(PPC_TG_ISP/PPC_ISP)+(DBUS_TO_PIXALIGN_PIPE+ TOTAL_H_TMC_SHBN_PIXALIGN_AND_WAIT_VALIDS_WO_DBUS - PIXALIGN_OUTPUT_PIPE_WORST_CASE)*PPC_ISP set_tg_out_columns_per_exposure TBD –# EFF_CHAINS = WDR_MODE != IDCG ? (USED_CHAINS/(SPLIT_MODE_ON + 1)) : 1 EFF_CHAINS = (USED_CHAINS/(SPLIT_MODE_ON + 1)) TG_COLUMNS = (PRJ_APS_ACTIVE_WIDTH-HORIZONTAL_APS_CROPPING)*EFF_CHAINS/ANALOG_SCALE TG_OUT_COLUMNS_PER_EXP = TG_COLUMNS + HORIZONTAL_EXTRA_SPLIT_COLUMNS set_horizontal_tg_extra_split_columns HORIZONTAL_TG_EXTRA_SPLIT_COLUMNS = 2 * SPEC_SPLIT_MODE_ON * HORIZONTAL_DIGITAL_BIN_PRE_SUMMATION * SPLIT_MODE_DEFAULT set_horizontal_tg_out_columns_per_exposure HORIZONTAL_TG_OUT_COLUMNS_PER_EXPOSURE = ((APS_ACTIVE_WIDTH-HORIZONTAL_APS_CROPPING )/ANALOG_SCALE*(1+SPEC_RSS_MODE)+HORIZONTAL_TG_EXTRA_SPLIT_COLUMNS set_tg_out_columns_all_exposures H_SUM_2PD = (PRJ_2PD_PRODUCT == YES) ? HORIZONTAL_DIGITAL_H_SUM :1 TG_OUT_COLUMNS_ALL_EXPS = (HORIZONTAL_TG_OUT_COLUMNS_PER_EXPOSURE * VERTICAL_STAGGERED_FACTOR)/H_SUM_2PD + HORIZONTAL_WDR_REPLICATION set_horizontal_ladlc_reduction_per_exp_isp HORIZONTAL_LADLC_REDUCTION_PER_EXP_ISP= HORIZONTAL_LADLC_REDUCTION_PER_EXP / (PRJ_ISP_REAL_CLOCK / SPEC_PIXEL_CLOCK_MULT_BY_16CH) set_horizontal_blank_isp_pipe HORIZONTAL_BLANK_ISP_PIPE = MAX( MERGER_PIPE*MERGER_ENABLE, GOS_PIPE*GOS_ENABLE, BPC_PIPE*BPC_ENABLE, REMOSAIC_PIPE_REMOSAIC_ENABLE)*PPC_ISP set_horizontal_blank_tg_pipe HORIZONTAL_BLANK_TG_PIPE = (HORIZONTAL_LADLC_REDUCTION_PER_EXP*VERTICAL_STAGGERED_FACTOR/HORIZONTAL_USED_CHAINS/(SPEC_16CH_FE_SPLIT_AND_ISP_16CH?2:1))+TOTAL_H_TMC_SHBN_PIXALIGN_AND_WAIT_VALIDS_WO_DBUS * PRJ_PPC_ISP * VERTICAL_STAGGERED_FACTOR) set_horizontal_blank HORIZONTAL_BLANK = MAX( HORIZONTAL_BLANK_ISP_PIPE , HORIZONTAL_BLANK_TG_PIPE) * (HORIZONTAL_DIGITAL_IF_SCALE / HORIZONTAL_CONCAT_INTERLEAVE_SCALE_DUE_PARALLEL_RSS) set_horizontal_fe_readout_pck HORIZONTAL_FE_READOUT_PCK =(((HORIZONTAL_TG_OUT_COLUMNS_PER_EXPOSURE*VERTICAL_STAGGERED_FACTOR/IF(IS_2PD="No",1,HORIZONTAL_DIGITAL_H_SUM) +HORIZONTAL_WDR_REPLICATION)+IF(IS_2PD="No",0,HORIZONTAL_DUPLICATED_PIXELS_AFTER_FESUM))/ HORIZONTAL_PCK_SCALE_DOWN_DUE_TO_PARALLEL_RSS_OR_SPLIT )+HORIZONTAL_BLANK set_horizontal_total_readout_pck HORIZONTAL_TOTAL_READOUT_PCK = MAX( HORIZONTAL_FE_READOUT_PCK , HORIZONTAL_ADBUS_TG_CHAIN_TOTAL_READOUT_PCK ) set_cis_output_width_per_exp HORIZONTAL_CIS_OUTPUT_WIDTH_PER_EXP = (FLOOR((TG_OUT_COLUMNS_PER_EXP - TG_EXTRA_SPLIT_COLUMNS) / HORIZONTAL_DIGITAL_IF_SCALE),1) - HORIZONTAL_DIGITAL_CROPPING 4. VERTICAL set_vertical_binning_mode_name TG_MODE_NAME = (FADLC_ANALOG_BINNING_ON == 0) ? “NORMAL” : (VERTICAL_ANALOG_SCALE == 1) ? “NORMAL” : (VERTICAL_ANALOG_SCALE == 2) ? “X2_ANA” : (VERTICAL_ANALOG_SCALE == 4) ? “X4_ANA” : /*(VERTICAL_ANALOG_SCALE == 8) ?*/ “X8_ANA” set_vertical_tg_blank_lines VERTICAL_TG_BLANK_LINES = FADLC_ANALOG_BINNING_ON ? V_TG_VBLANK[TG_MODE_NAME] - SPEC_SLIDING_READOUT * V_TG_SLIDDING_LINES[TG_MODE_NAME] : V_TG_VBLANK[TG_MODE_NAME] SPEC_SLIDING_READOUT * V_TG_SLIDDING_LINES[TG_MODE_NAME] (It includes tg sliding lines) set_vertical_blank_lines VERTICAL_BLANK_SPEC = SPEC_MIN_BLANK_US / (SPEC_PCLK_PERIOD * ACTUAL_TIMING_H_SIZE) FADLC_REDUCE_LINES = VERTICAL_FADLC_REDUCTION / VERTICAL_ANALOG_SCALE EXTRA_FOR_SCALE = IF((HORIZONTAL_DIGITAL_IF_SCALE <> 1), 2, 0)) VERTICAL_BLANK_CALC = ARM_PROCESS_LINES + VERTICAL_TG_BLANK_LINES + TOTAL_ISP_DELAY_LINES + EXTRA_FOR_SCALE - FADLC_REDUCE_LINES + FADLC_WAIT2START_LINES VERTICAL_BLANK = MAX(VERTICAL_BLANK_CALC, VERTICAL_BLANK_SPEC) set_vertical_readout_cropping VERTICAL_READOUT_CROPPING = FLOOR(PRJ_APS_ACTIVE_HEIGHT - ((SPEC_IMAGE_SIZE_V + VERTICAL_DIGITAL_CROPPING) * VERTICAL_DIGITAL_IF_SCALE * VERTICAL_ANALOG_SCALE) , HEIGHT_ALIGN_MIN_FOR_TG) set_vertical_readout_lines VERTICAL_READOUT_LINES = (PRJ_APS_ACTIVE_HEIGHT - VERTICAL_READOUT_CROPPING) / VERTICAL_ANALOG_SCALE set_vertical_total_lines VERTICAL_TOTAL_LINES = FLOOR((VERTICAL_BLANK_LINES + VERTICAL_READOUT_LINES + 1)/2) *2 set_vertical_binning_lines needed? VERTICAL_BINNING_LINES = FADLC_ANALOG_BINNING_ON ? V_TG_VBLANK[MODE_NAME] + V_TG_CSR[MODE_NAME] * (VERTICAL_STAGGERED_FACTOR - 1) : V_TG_VBLANK[MODE_NAME] set_vertical_if_output_height VERTICAL_IF_OUTPUT_HEIGHT = VERTICAL_READOUT_LINES / VERTICAL_DIGITAL_IF_SCALE - VERTICAL_DIGITAL_CROPPING 5. ADC Timing set_adc_timing_rs_rss_rsss ADC_TIMING_RS_RSS_RSSS = (SPEC_RSS_MODE == (RSSS)) ? 3 : (SPEC_RSS_MODE == (RSS)) ? 2 : 1 set_adc_timing_mode_string Concat Quality Mode and RS MODE set_adc_timing_cds_time_pclk ADC_TIMING_CDS_TIME_PCLK = The function sets extracting the CDS timing from the CDS table based on adc_timing_mode set_adc_timing_cds_time_us ADC_TIMING_CDS_TIME_US = ADC_TIMING_CDS_TIME_PCLK * PCLK_PERIOD 6. FADLC set_fadlc_us FADLC_US = FADLC_WAIT2START[ADLC_TYPE] set_vertical_fadlc_wait2start VERTICAL_FADLC_WAIT2START = FADLC_US / ACTUAL_TIMING_H_SIZE_US 7. Y set_yparam_actual_y_1line_pixels_per_side TBD - Actual Y pixels per side per exp set_yparam_nof_video_lines_per_y_line NOF_VIDEO_LINES_PER_Y_LINE = (Y_ENABLE==0) ? 0 : BAYER_TO_Y_VERTICAL_RATIO * Y_BINNING_VERTICAL set_yparam_y_1line_pixels_per_side Y_HORIZONTAL_SCALE = (Y_ENABLE==0) ? 0 : BAYER_TO_Y_HORIZONAL_RATIO * Y_BINNING_HORIZONTAL Y_1LINE_PIXELS_PER_SIDE = FLOOR(HORIZONTAL_CIS_OUTPUT_WIDTH_PER_EXP / Y_HORIZONTAL_SCALE) set_yparam_y_1line_mipi_time_pclk Y_LINE_MIPI_TIME_PCLK = Y_ENABLE ? GET_PHY_TX_MIPI_PCLK(ACTUAL_1LINE_PIXELS_PER_SIDE * Y_LINE_BITS) : 0 set_yparam_total_y_line_mipi_time_pclk TOTAL_Y_LINE_MIPI_TIME_PCLK = Y_ENABLE ? Y_1LINE_MIPI_TIME_PCLK * 2 : 0 8. PDAF set_pdaf_actual_af_pixels_per_side TBD set_pdaf_nof_video_lines_per_af_line NOF_VIDEO_LINES_PER_AF_LINE = SPEC_PDAF_ON_TAIL ? (AF_PER_LINE_SAME_TYPE * PDAF_V_UNIT_SIZE * PDAF_V_BINNING) / PDAF_PAIRS_IN_UNIT : 0 set_pdaf_pixels_per_phase MAX_SCALE = MAX(HORIZONTAL_ANALOG_SCALE , HORIZONTAL_DIGITAL_IF_SCALE) PDAF_H_BIN = (PDAF_H_UNIT_SIZE * PDAF_H_BINNING) AF_PIXELS_PER_PHASE_PER_EXP = SPEC_PDAF_ON_TAIL ? ((CIS_OUTPUT_WIDTH_PER_EXP - 2 * AF_PATTERN_PHYSICAL_START_ADDR) / MAX_SCALE ) / PDAF_H_BIN set_pdaf_af_mipi_time_pclk PDAF_1LINE_MIPI_TYPE_PCLK = get_phy_tx_mipi_pclk(PDAF_TX_BIT * ACTUAL_AF_PIXELS_PER_SIDE_LR_PER_EXP) set_pdaf_total_af_line_mipi_time_pclk TOTAL_AF_LINE_MIPI_TIME_PCLK = SPEC_PDAF_ON_TAIL ? PDAF_1LINE_MIPI_TIME_PCLK * 2 : 0 9. PHY set_phy_outif_overhead_delay_byteclk SYS_CLK_PERIOD_NS = 1000 * (PRJ_PPC_ISP / PRJ_PIXEL_CLOCK) DPHY_WORD_CLK_FREQ_MHZ = MIPI["MIPI CLK [MHZ]".LOWER()] / DPHY_MIPI_TO_WORD_CLK_RATIO DPHY_WORD_CLK_PERIOD_NS = 1000 / DPHY_WORD_CLK_FREQ_MHZ CPHY_WORD_CLK_FREQ_MHZ = MIPI["MIPI CLK [MHZ]".LOWER()] / CPHY_MIPI_TO_WORD_CLK_RATIO CPHY_WORD_CLK_PERIOD_NS = 1000 / CPHY_MIPI_TO_WORD_CLK_RATIO IF (IS_DPHY): FIXED_OUTIF_DELAY_SYSCLK_NSEC = DPHY_OVERHEAD["FIXED OUTIF DELAY [SYS CLK]".LOWER()] * SYS_CLK_PERIOD_NS # CONVERT TO NSEC FIXED_OUTIF_DELAY_BYTECLK_NSEC = DPHY_OVERHEAD["FIXED OUTIF DELAY [BYTECLK]".LOWER()] * DPHY_WORD_CLK_PERIOD_NS # CONVERT TO NSEC FIXED_OUTIF_DELAY_NSEC = FIXED_OUTIF_DELAY_SYSCLK_NSEC + FIXED_OUTIF_DELAY_BYTECLK_NSEC IF (STR(MIPI["MIPI CONT. CLK".LOWER()]).LOWER() == "YES"): DATA_DELAY_MUST_NSEC = PHY_OVERHEAD_DELAY["DAT (CONT CLK) MUST [NSEC]".LOWER()] DATA_DELAY_OPT_NSEC = PHY_OVERHEAD_DELAY["DAT (CONT CLK) OPT [NSEC]".LOWER()] ELSE: DATA_DELAY_MUST_NSEC = PHY_OVERHEAD_DELAY["DAT & CLK (NON CONT CLK) MUST [NSEC]".LOWER()] DATA_DELAY_OPT_NSEC = PHY_OVERHEAD_DELAY["DAT & CLK (NON CONT CLK) OPT [NSEC]".LOWER()] # NOF_CLKS = TOTAL_TIME / (BCLK_PERIOD ) TOTAL_DELAY_NS = (DATA_DELAY_MUST_NSEC + MAX(DATA_DELAY_OPT_NSEC, FIXED_OUTIF_DELAY_NSEC)) PHY_OVERHEAD_DELAY["OUTIF OVERHEAD DELAY [BYTECLK]".LOWER()] = INT((TOTAL_DELAY_NS / DPHY_WORD_CLK_PERIOD_NS ) + 0.5) # CONVERT TO BYTECLK ELSE: FIXED_OUTIF_DELAY_SYSCLK_NSEC = CPHY_OVERHEAD["FIXED OUTIF DELAY [SYS CLK]".LOWER()] * SYS_CLK_PERIOD_NS # CONVERT TO NSEC FIXED_OUTIF_DELAY_BYTECLK = FIXED_OUTIF_DELAY_SYSCLK_NSEC * CPHY_WORD_CLK_FREQ_MHZ //TBD!!!! FIXED_OUTIF_DELAY_BYTECLK += CPHY_OVERHEAD["FIXED OUTIF DELAY [BYTECLK]".LOWER()] * CPHY_OVERHEAD["BYTES PER WORD CLOCK".LOWER()] OUTIF_OVERHEAD_DELAY_POST_PACKET_BYTECLK = PHY_OVERHEAD_DELAY["POST - PACKET[NSEC]".LOWER()] * CPHY_WORD_CLK_PERIOD_NS OUTIF_OVERHEAD_DELAY_PRE_PACKET_BYTECLK = PHY_OVERHEAD_DELAY["PRE - PACKET[NSEC]".LOWER()] * CPHY_WORD_CLK_PERIOD_NS OUTIF_OVERHEAD_DELAY_PRE_PACKET_BYTECLK = INT(OUTIF_OVERHEAD_DELAY_PRE_PACKET_BYTECLK+0.5) IF (INT(PHY_OVERHEAD_DELAY["CPHY HS MODE".LOWER()]) == 1 ): PHY_OVERHEAD_DELAY["OUTIF OVERHEAD DELAY [BYTECLK]".LOWER()] = OUTIF_OVERHEAD_DELAY_PRE_PACKET_BYTECLK + INT(MAX(OUTIF_OVERHEAD_DELAY_POST_PACKET_BYTECLK, FIXED_OUTIF_DELAY_BYTECLK)+0.5) ELSE: PHY_OVERHEAD_DELAY["OUTIF OVERHEAD DELAY [BYTECLK]".LOWER()] = OUTIF_OVERHEAD_DELAY_PRE_PACKET_BYTECLK + INT(OUTIF_OVERHEAD_DELAY_POST_PACKET_BYTECLK+0.5) + INT(FIXED_OUTIF_DELAY_BYTECLK+0.5) PHY_OVERHEAD_DELAY["OUTIF OVERHEAD DELAY [BYTECLK]".LOWER()] += 5 10. MIPI set_mipi_overhead_delay_pclk PHY_OVERHEAD = IS_DPHY ? DPHY_OVERHEAD : CPHY_OVERHEAD MIPI_TO_WORD_CLK_RATIO = FREQ_MIPI / (IS_DPHY ? DPHY_MIPI_TO_WORD_CLK_RATIO : CPHY_MIPI_TO_WORD_CLK_RATIO ) EXTRA_OUTIF_DELAY_SYS_CLK = PHY_OVERHEAD["EXTRA_OUT_DELAY [SYS CLK]"] EXTRA_OUTIF_DELAY_BYTE_CLK = PHY_OVERHEAD["EXTRA_OUT_DELAY [BYTECLK]"] EXTRA_OUTIF_OVERHEAD_SCLK_TO_PCLK = ROUND_DOWN_NO_HALF(EXTRA_OUTIF_DELAY_SYSCLK,SPEC_PIXEL_CLOCK_MULT_BY_16CH) / PRJ_PPC_ISP EXTRA_OUTIF_OVERHEAD_BCLK_TO_PCLK = EXTRA_OUTIF_DELAY_BYTECLK * SPEC_PIXEL_CLOCK_MULT_BY_16CH / MIPI_TO_WORD_CLK_RATIO FIXED_OUTIF_OVERHEAD_BCLK_TO_PCLK = OUTIF_OVERHEAD_DELAY_BYTECLK * SPEC_PIXEL_CLOCK_MULT_BY_16CH) / MIPI_TO_WORD_CLK_RATIO MIPI_OVERHEAD_DELAY_PCLK = MIPI_OVERRIDE_MIPI_OVERHEAD > 0 ? MIPI_OVERRIDE_MIPI_OVERHEAD : (EXTRA_OUTIF_OVERHEAD_SCLK_TO_PCLK + EXTRA_OUTIF_OVERHEAD_BCLK_TO_PCLK + FIXED_OUTIF_OVERHEAD_BCLK_TO_PCLK) set_mipi_htime_pclk_per_exp OUTPUT_Y_AND_2PD_ENABLE = (PRJ_2PD_PRODUCT == "yes") and SPEC_OUTPUT_Y PDAF_ON_TAIL_AND_NOT_2PD_ENABLE = !(PRJ_2PD_PRODUCT == "yes") and SPEC_PDAF_ON_TAIL MIPI_OUTPUT_Y_2PD_W_OH =OUTPUT_Y_AND_2PD_ENABLE ? (YPARAM_Y_TOTAL_Y_LINE_MIPI_TIME_PCLK + YPARAM_NUMBER_OF_HEADERS_FOR_Y*MIPI_OVERHEAD_DELAY_PCLK) / YPARAM_NOF_VIDEO_LINES_PER_Y_LINE : 0 MIPI_MAIN_PCLK_W_OH = MIPI_TX_TIME_PCLK + (NOF_HEADERS_FOR_MAIN_FRAME * MIPI_OVERHEAD_DELAY_PCLK) MIPI_PDAF_ON_TAIL_NOT_2PD_W_OH = PDAF_ON_TAIL_AND_NOT_2PD_ENABLE ? (PDAF_TAIL_TOTAL_AF_LINE_MIPI_PCLK + PDAF_TAIL_NOF_HEADERS_FOR_AF*MIPI_OVERHEAD_DELAY_PCLK) / PDAF_TAIL_NOF_VIDEO_LINES_PER_AF_LINE : 0 MIPI_H_TIME_PER_EXP_PCLK = int(MIPI_MAIN_PCLK_W_OH + MIPI_OUTPUT_Y_2PD_W_OH + MIPI_PDAF_ON_TAIL_NOT_2PD_W_OH + 0.5) set_mipi_tx_time_pclk MIPI_TX_TIME_PCLK = GET_PHY_TX_MIPI_PCLK(HORIZONTAL_CIS_OUTPUT_WIDTH_PER_EXP * MIPI_OUT_BITS) 11. FRAME TIMING 11.1 CDS Calculates Max HTIME set_frame_timing_max_htime_pclk FRAME_TIMING_MAX_HTIME_PCLK = ROWS_HTIME / (PCLK_PERIOD * SPEC_FPS * FRAME_TIMING_TG_LINES) set_frame_timing_max_htime_us FRAME_TIMING_MAX_HTIME_US = FRAME_TIMING_MAX_HTIME_PCLK * PCLK_PERIOD set_frame_timing_max_cds_time_us FRAME_TIMING_MAX_CDS_TIME_US = FRAME_TIMING_MAX_HTIME_US * ADC_TIMING_RSR_METHOD 11.2 Horizontal set_frame_timing_tg_lines FRAME_TIMING_TG_LINES = VERTICAL_TOTAL_LINES set_frame_timing_cds_staggered_time_pclk FRAME_TIMING_CDS_STAGGERED_TIME_PCLK= ROUND_HALF(ADC_TIMING_CDS_TIME_PCLK * CDS_STAGGERED_FACTOR),PRJ_PPC_ISP)/ ADC_TIMING_RSR_METHOD set_frame_timing_tg_htime_pclk The function calculates TG H-Time [PCLK] FRAME_TIMING_TG_HTIME_PCLK = MAX( FRAME_TIMING_CDS_STAGGERED_TIME_PCLK , (ROWS_HTIME * HORIZONTAL_TOTAL_READOUT_PCK)) set_frame_timing_tg_fps FRAME_TIMING_TG_FPS = CALC_FPS(SPEC_PCLK_PERIOD , FRAME_TIMING_TG_HTIME_PCLK , FRAME_TIMING_TG_LINES, ROWS_PER_HTIME) set_frame_timing_h_size STAGGERED_FACTOR = IF(WDR_MODE==IDCG,1,STAGGERED_FACTOR) MIPI_HTIME_PCLK_PER_EXP_FACTORED = IF(CONSIDER_MIPI_FOR_HTIME==0, 0, STAGGERED_FACTOR *(MIPI_HTIME_PER_EXP / VERTICAL_DIGITAL_IF_SCALE)) FRAME_TIMING_ACTUAL_H_SIZE = CEIL((MAX(FRAME_TIMING_TG_HTIME_PCLK , MIPI_HTIME_PCLK_PER_EXP_FACTORED) + MANUAL_HBLANK),PPC_ISP*2) set_frame_timing_best_fps FRAME_TIMING_BEST_FRAME_RATE =(((PIXEL_CLOCK * 1000000) / (CEILING(MAX(((FRAME_TIMING_MIPI_H_TIME_PCLK_PER_EXP * IF((SPEC_WDR <> \"IDCG\"), VERTICAL_STAGGERED_FACTOR, 1)) / VERTICAL_DIGITAL_IF_SCALE), FRAME_TIMING_TG_HTIME_PCLK), (PPC_ISP * 2)) * FRAME_TIMING_TG_LINES)) * ROWS_TO_HTIME)" 11.3 Vertical set_frame_timing_block_delay FRAME_TIMING_BLOCK_DELAY_LINES = SUM(BLOCK_DELAYS) * SPLIT_SCALING set_frame_timing_embedded_delay ELG_EIS_DELAY_LINES = (EIS_EN) ? CEIL(ELG_MAX_EIS_DATA_BYTES / CIS OUTPUT WIDTH PER EXP) : 0 ELG_DATA_DELAY_LINES = (STAT_EN) ? CEIL(ELG_MAX_DATA_DATA_BYTES * (1-STAT_REDUCTION_PERCENTAGE) / CIS OUTPUT WIDTH PER EXP) : 0 ELG_GAP_DELAY_LINES = (STAT_EN || EIS_EN) ? PRJ_LINE_DELAY_FOR_ELG : 0 FRAME_TIMING_ELG_TOTAL_DELAY_LINES = CEIL(ELG_EIS_DELAY_LINES + ELG_DATA_DELAY_LINES + ELG_GAP_DELAY_LINES)*VERTICAL_DIGITAL_IF_SCALE set_frame_timing_total_isp_delay FRAME_TIMING_TOTAL_ISP_DELAY_LINES = ELG_TOTAL_DELAY_LINES + BLOCK_DELAY_LINES set_arm_process_time MODE = WDR_MODE_ENABLED ? STAGGERED: FULL ARM_PROCESS_TIME = ARM_PROCESS_TIME[MODE] / (SPEC_PCLK_PERIOD_US * FRAME_TIMING_ACTUAL_H_SIZE) set_frame_timing_total_spec_lines FRAME_TIMING_TOTAL_SPEC_LINES = ROUND(1/(PCLK_PERIOD * SPEC_FPS * ACTUAL_H_SIZE)) set_frame_timing_v_size FRAME_TIMING_ACTUAL_V_SIZE = MAX(TOTAL_SPEC_LINES ,FRAME_TIMING_TG_LINES) 11.4 FINAL set_frame_timing_tg_frame_rate TG_FRAME_RATE = 1sec * ROW_PER_HTIME / (PCLK_PERIOD * TG_HTIME_PCLK * FRAME_TIMING_TG_LINES ) set_actual_frame_time ACTUAL_FRAME_TIME = (PCLK_PERIOD * ACTUAL_V_SIZE * ACTUAL_H_SIZE) / ROWS_HTIME set_actual_frame_rate ACTUAL_FRAME_RATE = 1 / ACTUAL_FRAME_TIME 11.5 Staggered - HDR SUM_RATIO_ALL_EXP SUM_RATIO_ALL_EXP = STAGGERED_RATIO_LONG+STAGGERED_RATIO_MEDIUM+STAGGERED_RATIO_SHORT SUM_RATIO_SHORT_AND_MEDIUM_EXP SUM_RATIO_SHORT_AND_MEDIUM_EXP= STAGGERED_RATIO_MEDIUM+STAGGERED_RATIO_SHORT SUM_RATIO_SHORT_AND_LONG_EXP SUM_RATIO_SHORT_AND_LONG_EXP= STAGGERED_RATIO_MEDIUM+STAGGERED_RATIO_SHORT set_staggered_max_short_exp_in_coarse STAGGERED_MAX_SHORT_EXP_COARSE = =STAGGERED_RATIO_SHORT*MIN(FLOOR((ACTUAL_V_SIZE-10)/IF(SPEC_WDR_MODE=="2ST",SUM_RATIO_SHORT_AND_LONG_EXP, SUM_ALL_EXP),1), FLOOR((ACTUAL_V_SIZE-VERTICAL_TOTAL_LINES-10)/IF(SPEC_WDR_MODE=="2ST",1,SUM_RATIO_SHORT_AND_MEDIUM_EXP),1)) set_staggered_max_medium_exp_in_coarse STAGGERED_MAX_MEDIUM_EXP_COARSE = STAGGERED_RATIO_MEDIUM*IF(SPEC_WDR_MODE="2ST",0,MIN( FLOOR((ACTUAL_V_SIZE-10)/(SUM_ALL_EXP),1), FLOOR((ACTUAL_V_SIZE-VERTICAL_TOTAL_LINES-10)/SUM_RATIO_SHORT_AND_MEDIUM_EXP),1)) set_staggered_max_long_exp_in_coarse STAGGERED_MAX_LONG_EXP_COARSE = STAGGERED_RATIO_LONG*IF(SPEC_WDR_MODE="2ST",MIN(FLOOR((ACTUAL_V_SIZE-10)/(SUM_RATIO_SHORT_AND_LONG_EXP),1), FLOOR((ACTUAL_V_SIZE-VERTICAL_TOTAL_LINES-10),1)), MIN(FLOOR((ACTUAL_V_SIZE-10)/SUM_ALL_EXP,1),FLOOR((ACTUAL_V_SIZE-VERTICAL_TOTAL_LINES-10)/(SUM_RATIO_SHORT_AND_MEDIUM_EXP),1)))