Commit 0631243b authored by Andrey Filippov's avatar Andrey Filippov

Added bayer input to histograms, separated bayer, page, en and repet control in gamma modules

parent fe0f5941
...@@ -416,12 +416,16 @@ ...@@ -416,12 +416,16 @@
parameter SENS_GAMMA_HEIGHT01 = 'h2, // bits [15:0] - height minus 1 of image 0, [31:16] - height-1 of image1 parameter SENS_GAMMA_HEIGHT01 = 'h2, // bits [15:0] - height minus 1 of image 0, [31:16] - height-1 of image1
parameter SENS_GAMMA_HEIGHT2 = 'h3, // bits [15:0] - height minus 1 of image 2 ( no need for image 3) parameter SENS_GAMMA_HEIGHT2 = 'h3, // bits [15:0] - height minus 1 of image 2 ( no need for image 3)
// bits of the SENS_GAMMA_CTRL mode register // bits of the SENS_GAMMA_CTRL mode register
parameter SENS_GAMMA_MODE_WIDTH = 5, // does not include trig // parameter SENS_GAMMA_MODE_WIDTH = 5, // does not include trig
parameter SENS_GAMMA_MODE_BAYER = 0, parameter SENS_GAMMA_MODE_BAYER = 0,
parameter SENS_GAMMA_MODE_PAGE = 2, parameter SENS_GAMMA_MODE_BAYER_SET = 2,
parameter SENS_GAMMA_MODE_EN = 3, parameter SENS_GAMMA_MODE_PAGE = 3,
parameter SENS_GAMMA_MODE_REPET = 4, parameter SENS_GAMMA_MODE_PAGE_SET = 4,
parameter SENS_GAMMA_MODE_TRIG = 5, parameter SENS_GAMMA_MODE_EN = 5,
parameter SENS_GAMMA_MODE_EN_SET = 6,
parameter SENS_GAMMA_MODE_REPET = 7,
parameter SENS_GAMMA_MODE_REPET_SET = 8,
parameter SENS_GAMMA_MODE_TRIG = 9,
// Vignetting correction / pixel value scaling - controlled via single data word (same as in 252), some of bits [23:16] // Vignetting correction / pixel value scaling - controlled via single data word (same as in 252), some of bits [23:16]
// are used to select register, bits 25:24 - select sub-frame // are used to select register, bits 25:24 - select sub-frame
...@@ -498,6 +502,7 @@ ...@@ -498,6 +502,7 @@
parameter HISTOGRAM_LEFT_TOP = 'h0, parameter HISTOGRAM_LEFT_TOP = 'h0,
parameter HISTOGRAM_WIDTH_HEIGHT = 'h1, // 1.. 2^16, 0 - use HACT parameter HISTOGRAM_WIDTH_HEIGHT = 'h1, // 1.. 2^16, 0 - use HACT
parameter [1:0] XOR_HIST_BAYER = 2'b00,// invert bayer setting
//sensor_i2c_io other parameters //sensor_i2c_io other parameters
parameter integer SENSI2C_DRIVE= 12, parameter integer SENSI2C_DRIVE= 12,
parameter SENSI2C_IBUF_LOW_PWR= "TRUE", parameter SENSI2C_IBUF_LOW_PWR= "TRUE",
......
...@@ -123,6 +123,7 @@ SS_EN__RAW = str ...@@ -123,6 +123,7 @@ SS_EN__RAW = str
CLKIN_PERIOD_PCLK = int CLKIN_PERIOD_PCLK = int
SENSI2C_STATUS_REG_REL__TYPE = str SENSI2C_STATUS_REG_REL__TYPE = str
SENSI2C_CMD_RUN_PBITS__RAW = str SENSI2C_CMD_RUN_PBITS__RAW = str
XOR_HIST_BAYER__TYPE = str
HIST_SAXI_AWCACHE__RAW = str HIST_SAXI_AWCACHE__RAW = str
CLK_STATUS_REG_ADDR__TYPE = str CLK_STATUS_REG_ADDR__TYPE = str
MCONTR_TOP_16BIT_STATUS_CNTRL__TYPE = str MCONTR_TOP_16BIT_STATUS_CNTRL__TYPE = str
...@@ -340,7 +341,7 @@ WINDOW_WIDTH = int ...@@ -340,7 +341,7 @@ WINDOW_WIDTH = int
CLK_CNTRL__RAW = str CLK_CNTRL__RAW = str
MCONTR_LINTILE_EXTRAPG_BITS = int MCONTR_LINTILE_EXTRAPG_BITS = int
MCONTR_LINTILE_RST_FRAME__TYPE = str MCONTR_LINTILE_RST_FRAME__TYPE = str
HISTOGRAM_TOP = int LAST_BUF_FRAME__RAW = str
FCLK1_PERIOD = float FCLK1_PERIOD = float
CMPRS_AFIMUX_RADDR1__RAW = str CMPRS_AFIMUX_RADDR1__RAW = str
MCNTRL_TEST01_CHN1_STATUS_CNTRL__RAW = str MCNTRL_TEST01_CHN1_STATUS_CNTRL__RAW = str
...@@ -451,7 +452,7 @@ CMDFRAMESEQ_ADDR_BASE__RAW = str ...@@ -451,7 +452,7 @@ CMDFRAMESEQ_ADDR_BASE__RAW = str
MCONTR_LINTILE_SKIP_LATE__TYPE = str MCONTR_LINTILE_SKIP_LATE__TYPE = str
DEBUG_ADDR__RAW = str DEBUG_ADDR__RAW = str
CONTROL_ADDR__RAW = str CONTROL_ADDR__RAW = str
TILED_STARTY__RAW = str SENSI2C_CMD_RESET = int
RTC_BITC_PREDIV = int RTC_BITC_PREDIV = int
CMPRS_FRMT_MBCM1_BITS__TYPE = str CMPRS_FRMT_MBCM1_BITS__TYPE = str
SENS_CTRL_QUADRANTS_EN__RAW = str SENS_CTRL_QUADRANTS_EN__RAW = str
...@@ -605,7 +606,7 @@ SENSI2C_TBL_SA__TYPE = str ...@@ -605,7 +606,7 @@ SENSI2C_TBL_SA__TYPE = str
BUF_IPCLK_SENS3__TYPE = str BUF_IPCLK_SENS3__TYPE = str
MCNTRL_TILED_MODE = int MCNTRL_TILED_MODE = int
MCNTRL_TILED_WINDOW_STARTXY__TYPE = str MCNTRL_TILED_WINDOW_STARTXY__TYPE = str
HISTOGRAM_HEIGHT = int CMPRS_COLOR20__TYPE = str
MCNTRL_TEST01_CHN2_STATUS_CNTRL__RAW = str MCNTRL_TEST01_CHN2_STATUS_CNTRL__RAW = str
LOGGER_CONF_SYN = int LOGGER_CONF_SYN = int
MCNTRL_TILED_CHN4_ADDR__RAW = str MCNTRL_TILED_CHN4_ADDR__RAW = str
...@@ -624,6 +625,7 @@ SIMULATE_CMPRS_CMODE1 = int ...@@ -624,6 +625,7 @@ SIMULATE_CMPRS_CMODE1 = int
MULT_SAXI_CNTRL_ADDR = int MULT_SAXI_CNTRL_ADDR = int
MULTICLK_BUF_SYNC__TYPE = str MULTICLK_BUF_SYNC__TYPE = str
HIST_SAXI_ADDR_REL__RAW = str HIST_SAXI_ADDR_REL__RAW = str
SENS_GAMMA_MODE_PAGE_SET__RAW = str
CMPRS_CBIT_CMODE_MONO4__TYPE = str CMPRS_CBIT_CMODE_MONO4__TYPE = str
HIST_SAXI_MODE_WIDTH__RAW = str HIST_SAXI_MODE_WIDTH__RAW = str
SENS_LENS_AX = int SENS_LENS_AX = int
...@@ -667,13 +669,14 @@ SENS_LENS_AX__TYPE = str ...@@ -667,13 +669,14 @@ SENS_LENS_AX__TYPE = str
PXD_DRIVE__TYPE = str PXD_DRIVE__TYPE = str
HIST_SAXI_NRESET = int HIST_SAXI_NRESET = int
MULT_SAXI_HALF_BRAM_IN__RAW = str MULT_SAXI_HALF_BRAM_IN__RAW = str
HISTOGRAM_HEIGHT = int
SENSI2C_TBL_SA__RAW = str SENSI2C_TBL_SA__RAW = str
CMPRS_CBIT_CMODE_JP4__RAW = str CMPRS_CBIT_CMODE_JP4__RAW = str
MULTICLK_BUF_AXIHP__RAW = str MULTICLK_BUF_AXIHP__RAW = str
CLK_STATUS__TYPE = str CLK_STATUS__TYPE = str
GPIO_SET_STATUS__RAW = str GPIO_SET_STATUS__RAW = str
SENS_JTAG_TCK = int SENS_JTAG_TCK = int
CMPRS_COLOR20__TYPE = str XOR_HIST_BAYER__RAW = str
DEBUG_STATUS_REG_ADDR__TYPE = str DEBUG_STATUS_REG_ADDR__TYPE = str
REFRESH_OFFSET__TYPE = str REFRESH_OFFSET__TYPE = str
SENS_CTRL_ARST__RAW = str SENS_CTRL_ARST__RAW = str
...@@ -690,7 +693,6 @@ SDCLK_PHASE__RAW = str ...@@ -690,7 +693,6 @@ SDCLK_PHASE__RAW = str
SENS_SYNC_RADDR__TYPE = str SENS_SYNC_RADDR__TYPE = str
BUF_IPCLK_SENS0__TYPE = str BUF_IPCLK_SENS0__TYPE = str
SENSI2C_CMD_RUN__RAW = str SENSI2C_CMD_RUN__RAW = str
SENS_GAMMA_MODE_WIDTH__TYPE = str
MCNTRL_TILED_STARTADDR__TYPE = str MCNTRL_TILED_STARTADDR__TYPE = str
DLY_LD_MASK = int DLY_LD_MASK = int
MCONTR_LINTILE_BYTE32 = int MCONTR_LINTILE_BYTE32 = int
...@@ -797,7 +799,7 @@ HISPI_CAPACITANCE__TYPE = str ...@@ -797,7 +799,7 @@ HISPI_CAPACITANCE__TYPE = str
MCONTR_LINTILE_KEEP_OPEN__TYPE = str MCONTR_LINTILE_KEEP_OPEN__TYPE = str
SENS_LENS_POST_SCALE = int SENS_LENS_POST_SCALE = int
LOGGER_STATUS_REG_ADDR__TYPE = str LOGGER_STATUS_REG_ADDR__TYPE = str
SS_MODE = str MEMBRIDGE_LO_ADDR64__TYPE = str
MCONTR_CMD_WR_ADDR__RAW = str MCONTR_CMD_WR_ADDR__RAW = str
CMDFRAMESEQ_CTRL = int CMDFRAMESEQ_CTRL = int
DLY_LD__TYPE = str DLY_LD__TYPE = str
...@@ -842,9 +844,11 @@ PXD_CLK_DIV_BITS__RAW = str ...@@ -842,9 +844,11 @@ PXD_CLK_DIV_BITS__RAW = str
CMPRS_FRMT_LMARG_BITS = int CMPRS_FRMT_LMARG_BITS = int
CMDSEQMUX_ADDR = int CMDSEQMUX_ADDR = int
CMPRS_CBIT_CMODE_JP4DIFFHDR__TYPE = str CMPRS_CBIT_CMODE_JP4DIFFHDR__TYPE = str
SENS_GAMMA_MODE_PAGE_SET = int
MCNTRL_SCANLINE_PENDING_CNTR_BITS__TYPE = str MCNTRL_SCANLINE_PENDING_CNTR_BITS__TYPE = str
SENSI2C_TBL_NBWR = int SENSI2C_TBL_NBWR = int
DLY_DQS_IDELAY__RAW = str DLY_DQS_IDELAY__RAW = str
SENS_SYNC_RADDR = int
CONTROL_RBACK_ADDR_MASK__TYPE = str CONTROL_RBACK_ADDR_MASK__TYPE = str
MCONTR_BUF4_WR_ADDR = int MCONTR_BUF4_WR_ADDR = int
SENS_DIVCLK_DIVIDE__RAW = str SENS_DIVCLK_DIVIDE__RAW = str
...@@ -955,13 +959,13 @@ MCNTRL_SCANLINE_STATUS_REG_CHN1_ADDR = int ...@@ -955,13 +959,13 @@ MCNTRL_SCANLINE_STATUS_REG_CHN1_ADDR = int
RTC_SET_USEC__TYPE = str RTC_SET_USEC__TYPE = str
MULT_SAXI_BSLOG3__RAW = str MULT_SAXI_BSLOG3__RAW = str
CMPRS_TIMEOUT_BITS__TYPE = str CMPRS_TIMEOUT_BITS__TYPE = str
SENS_GAMMA_MODE_WIDTH__RAW = str
PHASE_CLK2X_PCLK__TYPE = str PHASE_CLK2X_PCLK__TYPE = str
FFCLK1_DIFF_TERM__TYPE = str FFCLK1_DIFF_TERM__TYPE = str
WRITELEV_OFFSET = int WRITELEV_OFFSET = int
MCONTR_PHY_0BIT_ADDR_MASK__TYPE = str MCONTR_PHY_0BIT_ADDR_MASK__TYPE = str
MULT_SAXI_ADV_RD__RAW = str MULT_SAXI_ADV_RD__RAW = str
SENS_SYNC_RADDR = int SENS_GAMMA_MODE_EN_SET__RAW = str
SENS_GAMMA_MODE_BAYER_SET__TYPE = str
T_RFC__RAW = str T_RFC__RAW = str
WBUF_DLY_DFLT__TYPE = str WBUF_DLY_DFLT__TYPE = str
HISPI_DELAY_CLK0__RAW = str HISPI_DELAY_CLK0__RAW = str
...@@ -991,6 +995,7 @@ MEMBRIDGE_SIZE64 = int ...@@ -991,6 +995,7 @@ MEMBRIDGE_SIZE64 = int
SENSOR_IMAGE_TYPE1__RAW = str SENSOR_IMAGE_TYPE1__RAW = str
MCONTR_PHY_0BIT_CKE_EN__TYPE = str MCONTR_PHY_0BIT_CKE_EN__TYPE = str
CMPRS_FRMT_MBCM1_BITS = int CMPRS_FRMT_MBCM1_BITS = int
SENS_GAMMA_MODE_REPET_SET__TYPE = str
HISTOGRAM_RAM_MODE__TYPE = str HISTOGRAM_RAM_MODE__TYPE = str
AFI_LO_ADDR64 = int AFI_LO_ADDR64 = int
NUM_CYCLES_07__TYPE = str NUM_CYCLES_07__TYPE = str
...@@ -1082,6 +1087,7 @@ MCONTR_PHY_0BIT_DLY_RST__TYPE = str ...@@ -1082,6 +1087,7 @@ MCONTR_PHY_0BIT_DLY_RST__TYPE = str
TILED_KEEP_OPEN__RAW = str TILED_KEEP_OPEN__RAW = str
AXI_WRADDR_LATENCY__TYPE = str AXI_WRADDR_LATENCY__TYPE = str
MULT_SAXI_IRQLEN_ADDR = int MULT_SAXI_IRQLEN_ADDR = int
XOR_HIST_BAYER = int
MULTICLK_BUF_XCLK__TYPE = str MULTICLK_BUF_XCLK__TYPE = str
MCONTR_TOP_0BIT_ADDR__TYPE = str MCONTR_TOP_0BIT_ADDR__TYPE = str
CLKFBOUT_PHASE_SENSOR__RAW = str CLKFBOUT_PHASE_SENSOR__RAW = str
...@@ -1097,7 +1103,6 @@ CAMSYNC_EXTERNAL_BIT__RAW = str ...@@ -1097,7 +1103,6 @@ CAMSYNC_EXTERNAL_BIT__RAW = str
HISTOGRAM_WIDTH = int HISTOGRAM_WIDTH = int
MCNTRL_SCANLINE_WINDOW_X0Y0__TYPE = str MCNTRL_SCANLINE_WINDOW_X0Y0__TYPE = str
HISPI_IBUF_LOW_PWR__RAW = str HISPI_IBUF_LOW_PWR__RAW = str
MCNTRL_PS_STATUS_REG_ADDR = int
SENSI2C_TBL_NBRD__TYPE = str SENSI2C_TBL_NBRD__TYPE = str
SENSI2C_CMD_ACIVE_SDA = int SENSI2C_CMD_ACIVE_SDA = int
MCONTR_PHY_0BIT_ADDR__TYPE = str MCONTR_PHY_0BIT_ADDR__TYPE = str
...@@ -1124,7 +1129,7 @@ CMPRS_CBIT_FOCUS_BITS = int ...@@ -1124,7 +1129,7 @@ CMPRS_CBIT_FOCUS_BITS = int
LOGGER_CONF_SYN__RAW = str LOGGER_CONF_SYN__RAW = str
CMPRS_COLOR20 = int CMPRS_COLOR20 = int
SENSI2C_CMD_TABLE__RAW = str SENSI2C_CMD_TABLE__RAW = str
LAST_BUF_FRAME__RAW = str SENSIO_DELAYS__TYPE = str
ADDRESS_NUMBER__TYPE = str ADDRESS_NUMBER__TYPE = str
WSEL__TYPE = str WSEL__TYPE = str
CMPRS_AFIMUX_CYCBITS__RAW = str CMPRS_AFIMUX_CYCBITS__RAW = str
...@@ -1258,6 +1263,7 @@ CAMSYNC_POST_MAGIC__TYPE = str ...@@ -1258,6 +1263,7 @@ CAMSYNC_POST_MAGIC__TYPE = str
NUM_CYCLES_29__TYPE = str NUM_CYCLES_29__TYPE = str
RTC_SET_SEC__TYPE = str RTC_SET_SEC__TYPE = str
CAMSYNC_ADDR = int CAMSYNC_ADDR = int
FFCLK1_CAPACITANCE__RAW = str
RTC_SET_CORR__TYPE = str RTC_SET_CORR__TYPE = str
PHASE_WIDTH__RAW = str PHASE_WIDTH__RAW = str
SLEW_DQ__RAW = str SLEW_DQ__RAW = str
...@@ -1268,7 +1274,7 @@ MEMBRIDGE_START64__TYPE = str ...@@ -1268,7 +1274,7 @@ MEMBRIDGE_START64__TYPE = str
CMPRS_CBIT_CMODE_JP46 = int CMPRS_CBIT_CMODE_JP46 = int
MEMCLK_CAPACITANCE__TYPE = str MEMCLK_CAPACITANCE__TYPE = str
MCONTR_BUF0_WR_ADDR__RAW = str MCONTR_BUF0_WR_ADDR__RAW = str
SENS_GAMMA_MODE_WIDTH = int HISTOGRAM_TOP = int
SENS_SS_MODE = str SENS_SS_MODE = str
SENSOR12BITS_TDDO = int SENSOR12BITS_TDDO = int
CAMSYNC_TRIG_DST = int CAMSYNC_TRIG_DST = int
...@@ -1553,6 +1559,7 @@ DLY_LANE1_DQS_WLV_IDELAY = long ...@@ -1553,6 +1559,7 @@ DLY_LANE1_DQS_WLV_IDELAY = long
MULTICLK_PHASE_DLYREF = float MULTICLK_PHASE_DLYREF = float
HIST_SAXI_ADDR_REL = int HIST_SAXI_ADDR_REL = int
CMDFRAMESEQ_ADDR_BASE = int CMDFRAMESEQ_ADDR_BASE = int
STATUS_SEQ_SHFT__RAW = str
SENS_SS_MODE__TYPE = str SENS_SS_MODE__TYPE = str
CMPRS_AFIMUX_RADDR0 = int CMPRS_AFIMUX_RADDR0 = int
CMPRS_FRMT_MBCM1_BITS__RAW = str CMPRS_FRMT_MBCM1_BITS__RAW = str
...@@ -1618,6 +1625,7 @@ PXD_SLEW__RAW = str ...@@ -1618,6 +1625,7 @@ PXD_SLEW__RAW = str
MULT_SAXI_STATUS_REG = int MULT_SAXI_STATUS_REG = int
CLKIN_PERIOD_SENSOR__TYPE = str CLKIN_PERIOD_SENSOR__TYPE = str
QUADRANTS_PXD_HACT_VACT__TYPE = str QUADRANTS_PXD_HACT_VACT__TYPE = str
SENS_GAMMA_MODE_BAYER_SET__RAW = str
SENSOR_PRIORITY__TYPE = str SENSOR_PRIORITY__TYPE = str
SENS_LENS_BY__RAW = str SENS_LENS_BY__RAW = str
MCNTRL_PS_CMD__TYPE = str MCNTRL_PS_CMD__TYPE = str
...@@ -1695,7 +1703,7 @@ WRITELEV_OFFSET__RAW = str ...@@ -1695,7 +1703,7 @@ WRITELEV_OFFSET__RAW = str
READ_PATTERN_OFFSET = int READ_PATTERN_OFFSET = int
CLK_PHASE__TYPE = str CLK_PHASE__TYPE = str
SENSOR_16BIT_BIT = int SENSOR_16BIT_BIT = int
SENSIO_DELAYS__TYPE = str MCNTRL_PS_STATUS_REG_ADDR = int
SENS_CTRL_EXT_CLK__RAW = str SENS_CTRL_EXT_CLK__RAW = str
SENSOR_CHN_EN_BIT_SET = int SENSOR_CHN_EN_BIT_SET = int
WOI_HEIGHT = int WOI_HEIGHT = int
...@@ -1782,8 +1790,9 @@ SENSI2C_IBUF_LOW_PWR__RAW = str ...@@ -1782,8 +1790,9 @@ SENSI2C_IBUF_LOW_PWR__RAW = str
SENSI2C_STATUS_REG_REL = int SENSI2C_STATUS_REG_REL = int
AXI_RDADDR_LATENCY__RAW = str AXI_RDADDR_LATENCY__RAW = str
SENSOR_CTRL_ADDR_MASK = int SENSOR_CTRL_ADDR_MASK = int
SENS_GAMMA_MODE_BAYER_SET = int
NUM_CYCLES_16__TYPE = str NUM_CYCLES_16__TYPE = str
MEMBRIDGE_LO_ADDR64__TYPE = str SS_MODE = str
CMDFRAMESEQ_MASK__RAW = str CMDFRAMESEQ_MASK__RAW = str
SENSOR12BITS_TMD__TYPE = str SENSOR12BITS_TMD__TYPE = str
SENS_CTRL_LD_DLY__TYPE = str SENS_CTRL_LD_DLY__TYPE = str
...@@ -1978,7 +1987,7 @@ TABLE_CORING_INDEX__TYPE = str ...@@ -1978,7 +1987,7 @@ TABLE_CORING_INDEX__TYPE = str
HISTOGRAM_RADDR1__RAW = str HISTOGRAM_RADDR1__RAW = str
SENSI2C_CMD_TAND__TYPE = str SENSI2C_CMD_TAND__TYPE = str
MCONTR_LINTILE_EXTRAPG_BITS__RAW = str MCONTR_LINTILE_EXTRAPG_BITS__RAW = str
SENS_BANDWIDTH = str HISTOGRAM_HEIGHT__RAW = str
MCNTRL_SCANLINE_MODE__RAW = str MCNTRL_SCANLINE_MODE__RAW = str
LOGGER_BIT_HALF_PERIOD__TYPE = str LOGGER_BIT_HALF_PERIOD__TYPE = str
FRAME_START_ADDRESS_INC__RAW = str FRAME_START_ADDRESS_INC__RAW = str
...@@ -2006,7 +2015,7 @@ MCONTR_PHY_STATUS_CNTRL__RAW = str ...@@ -2006,7 +2015,7 @@ MCONTR_PHY_STATUS_CNTRL__RAW = str
DLY_LANE0_DQS_WLV_IDELAY = long DLY_LANE0_DQS_WLV_IDELAY = long
MCNTRL_SCANLINE_STATUS_CNTRL = int MCNTRL_SCANLINE_STATUS_CNTRL = int
CMDSEQMUX_MASK__TYPE = str CMDSEQMUX_MASK__TYPE = str
SENSI2C_CMD_RESET = int TILED_STARTY__RAW = str
SENSI2C_TBL_NABRD__TYPE = str SENSI2C_TBL_NABRD__TYPE = str
NUM_CYCLES_01__RAW = str NUM_CYCLES_01__RAW = str
WINDOW_HEIGHT__RAW = str WINDOW_HEIGHT__RAW = str
...@@ -2017,6 +2026,7 @@ PHASE_CLK2X_PCLK__RAW = str ...@@ -2017,6 +2026,7 @@ PHASE_CLK2X_PCLK__RAW = str
MCNTRL_TEST01_STATUS_REG_CHN1_ADDR__TYPE = str MCNTRL_TEST01_STATUS_REG_CHN1_ADDR__TYPE = str
MCONTR_TOP_0BIT_ADDR__RAW = str MCONTR_TOP_0BIT_ADDR__RAW = str
HISPI_IBUF_LOW_PWR = str HISPI_IBUF_LOW_PWR = str
SENS_GAMMA_MODE_REPET_SET = int
HISPI_KEEP_IRST__RAW = str HISPI_KEEP_IRST__RAW = str
LOGGER_CONF_DBG__TYPE = str LOGGER_CONF_DBG__TYPE = str
AFI_SIZE64__RAW = str AFI_SIZE64__RAW = str
...@@ -2045,7 +2055,7 @@ DLY_CMDA__TYPE = str ...@@ -2045,7 +2055,7 @@ DLY_CMDA__TYPE = str
CLKFBOUT_MULT__TYPE = str CLKFBOUT_MULT__TYPE = str
DEBUG_MASK = int DEBUG_MASK = int
MCONTR_PHY_0BIT_CMDA_EN__RAW = str MCONTR_PHY_0BIT_CMDA_EN__RAW = str
STATUS_SEQ_SHFT__RAW = str SENS_GAMMA_MODE_PAGE_SET__TYPE = str
IDELAY_VALUE = int IDELAY_VALUE = int
DQSTRI_LAST__TYPE = str DQSTRI_LAST__TYPE = str
HISTOGRAM_RADDR2__TYPE = str HISTOGRAM_RADDR2__TYPE = str
...@@ -2153,7 +2163,7 @@ BUF_IPCLK2X_SENS0__TYPE = str ...@@ -2153,7 +2163,7 @@ BUF_IPCLK2X_SENS0__TYPE = str
MULTICLK_BUF_SYNC__RAW = str MULTICLK_BUF_SYNC__RAW = str
MCONTR_PHY_0BIT_DLY_SET__RAW = str MCONTR_PHY_0BIT_DLY_SET__RAW = str
NUM_CYCLES_11__RAW = str NUM_CYCLES_11__RAW = str
FFCLK1_CAPACITANCE__RAW = str SENS_GAMMA_MODE_REPET_SET__RAW = str
SENSI2C_DRIVE__RAW = str SENSI2C_DRIVE__RAW = str
SENSOR_HIST_BITS_SET__TYPE = str SENSOR_HIST_BITS_SET__TYPE = str
CMPRS_CBIT_CMODE_MONO1__TYPE = str CMPRS_CBIT_CMODE_MONO1__TYPE = str
...@@ -2194,6 +2204,7 @@ MULTICLK_IN_PERIOD = int ...@@ -2194,6 +2204,7 @@ MULTICLK_IN_PERIOD = int
MCONTR_TOP_0BIT_MCONTR_EN__RAW = str MCONTR_TOP_0BIT_MCONTR_EN__RAW = str
MULTICLK_PHASE_FB__RAW = str MULTICLK_PHASE_FB__RAW = str
TABLE_HUFFMAN_INDEX__TYPE = str TABLE_HUFFMAN_INDEX__TYPE = str
SENS_GAMMA_MODE_EN_SET__TYPE = str
RTC_SET_STATUS__RAW = str RTC_SET_STATUS__RAW = str
SENS_CTRL_QUADRANTS = int SENS_CTRL_QUADRANTS = int
LD_DLY_PHASE__TYPE = str LD_DLY_PHASE__TYPE = str
...@@ -2228,6 +2239,7 @@ CMDFRAMESEQ_DEPTH__RAW = str ...@@ -2228,6 +2239,7 @@ CMDFRAMESEQ_DEPTH__RAW = str
SENS_LENS_BX_MASK__RAW = str SENS_LENS_BX_MASK__RAW = str
SENSI2C_TBL_NBWR_BITS__RAW = str SENSI2C_TBL_NBWR_BITS__RAW = str
WRITE_BLOCK_OFFSET__RAW = str WRITE_BLOCK_OFFSET__RAW = str
SENS_GAMMA_MODE_EN_SET = int
MCONTR_LINTILE_SINGLE__RAW = str MCONTR_LINTILE_SINGLE__RAW = str
MCNTRL_TILED_FRAME_PAGE_RESET__RAW = str MCNTRL_TILED_FRAME_PAGE_RESET__RAW = str
SENS_GAMMA_BUFFER__TYPE = str SENS_GAMMA_BUFFER__TYPE = str
...@@ -2264,7 +2276,7 @@ DEBUG_SET_STATUS__TYPE = str ...@@ -2264,7 +2276,7 @@ DEBUG_SET_STATUS__TYPE = str
HISTOGRAM_START_PAGE = int HISTOGRAM_START_PAGE = int
RTC_SEC_USEC_ADDR__RAW = str RTC_SEC_USEC_ADDR__RAW = str
MCNTRL_PS_ADDR = int MCNTRL_PS_ADDR = int
HISTOGRAM_HEIGHT__RAW = str SENS_BANDWIDTH = str
MEMCLK_IBUF_LOW_PWR = str MEMCLK_IBUF_LOW_PWR = str
HISPI_DELAY_CLK3__RAW = str HISPI_DELAY_CLK3__RAW = str
CAMSYNC_TRIG_DST__TYPE = str CAMSYNC_TRIG_DST__TYPE = str
......
...@@ -1951,10 +1951,14 @@ class X393ExportC(object): ...@@ -1951,10 +1951,14 @@ class X393ExportC(object):
def _enc_gamma_ctl(self): def _enc_gamma_ctl(self):
dw=[] dw=[]
dw.append(("bayer", 0, 2, 0, "Bayer color shift (pixel to gamma table)")) dw.append(("bayer", 0, 2, 0, "Bayer color shift (pixel to gamma table)"))
dw.append(("page", 2, 1, 0, "Table page (only available if SENS_GAMMA_BUFFER in Verilog)")) dw.append(("bayer_set", 2, 1, 0, "Set 'bayer' field"))
dw.append(("en", 3, 1, 1, "Enable module")) dw.append(("page", 3, 1, 0, "Table page (only available if SENS_GAMMA_BUFFER in Verilog)"))
dw.append(("repet", 4, 1, 1, "Repetitive (normal) mode. Set 0 for testing of the single-frame mode")) dw.append(("page_set", 4, 1, 0, "Set 'page' field"))
dw.append(("trig", 5, 1, 0, "Single trigger used when repetitive mode is off (self clearing bit)")) dw.append(("en", 5, 1, 1, "Enable module"))
dw.append(("en_set", 6, 1, 1, "Set 'en' field"))
dw.append(("repet", 7, 1, 1, "Repetitive (normal) mode. Set 0 for testing of the single-frame mode"))
dw.append(("repet_set", 8, 1, 1, "Set 'repet' field"))
dw.append(("trig", 9, 1, 0, "Single trigger used when repetitive mode is off (self clearing bit)"))
return dw return dw
def _enc_gamma_tbl_addr(self): def _enc_gamma_tbl_addr(self):
......
...@@ -457,11 +457,11 @@ class X393Sensor(object): ...@@ -457,11 +457,11 @@ class X393Sensor(object):
return rslt return rslt
def func_sensor_gamma_ctl(self, def func_sensor_gamma_ctl(self,
bayer = 0, bayer = None,
table_page = 0, table_page = None,
en_input = True, en_input = None,
repet_mode = True, # Normal mode, single trigger - just for debugging TODO: re-assign? repet_mode = None, # Normal mode, single trigger - just for debugging TODO: re-assign?
trig = False): trig = False):
""" """
@param bayer - Bayer shift (0..3) @param bayer - Bayer shift (0..3)
@param table_page - Gamma table page @param table_page - Gamma table page
...@@ -471,10 +471,22 @@ class X393Sensor(object): ...@@ -471,10 +471,22 @@ class X393Sensor(object):
@return combined control word @return combined control word
""" """
rslt = 0 rslt = 0
rslt |= (bayer & 3) << vrlg.SENS_GAMMA_MODE_BAYER if not bayer is None:
rslt |= (0,1)[table_page] << vrlg.SENS_GAMMA_MODE_PAGE rslt |= (bayer & 3) << vrlg.SENS_GAMMA_MODE_BAYER
rslt |= (0,1)[en_input] << vrlg.SENS_GAMMA_MODE_EN rslt |= 1 << vrlg.SENS_GAMMA_MODE_BAYER_SET
rslt |= (0,1)[repet_mode] << vrlg.SENS_GAMMA_MODE_REPET
if not table_page is None:
rslt |= (0,1)[table_page] << vrlg.SENS_GAMMA_MODE_PAGE
rslt |= 1 << vrlg.SENS_GAMMA_MODE_PAGE_SET
if not en_input is None:
rslt |= (0,1)[en_input] << vrlg.SENS_GAMMA_MODE_EN
rslt |= 1 << vrlg.SENS_GAMMA_MODE_EN_SET
if not repet_mode is None:
rslt |= (0,1)[repet_mode] << vrlg.SENS_GAMMA_MODE_REPET
rslt |= 1 << vrlg.SENS_GAMMA_MODE_REPET_SET
rslt |= (0,1)[trig] << vrlg.SENS_GAMMA_MODE_TRIG rslt |= (0,1)[trig] << vrlg.SENS_GAMMA_MODE_TRIG
return rslt return rslt
......
...@@ -48,12 +48,26 @@ module sens_gamma #( ...@@ -48,12 +48,26 @@ module sens_gamma #(
parameter SENS_GAMMA_ADDR_DATA = 'h1, // bit 20 ==1 - table address, bit 20==0 - table data (18 bits) parameter SENS_GAMMA_ADDR_DATA = 'h1, // bit 20 ==1 - table address, bit 20==0 - table data (18 bits)
parameter SENS_GAMMA_HEIGHT01 = 'h2, // bits [15:0] - height minus 1 of image 0, [31:16] - height-1 of image1 parameter SENS_GAMMA_HEIGHT01 = 'h2, // bits [15:0] - height minus 1 of image 0, [31:16] - height-1 of image1
parameter SENS_GAMMA_HEIGHT2 = 'h3, // bits [15:0] - height minus 1 of image 2 ( no need for image 3) parameter SENS_GAMMA_HEIGHT2 = 'h3, // bits [15:0] - height minus 1 of image 2 ( no need for image 3)
parameter SENS_GAMMA_MODE_WIDTH = 5, // does not include trig
parameter SENS_GAMMA_MODE_BAYER = 0,
parameter SENS_GAMMA_MODE_PAGE = 2, // parameter SENS_GAMMA_MODE_WIDTH = 5, // does not include trig
parameter SENS_GAMMA_MODE_EN = 3, // parameter SENS_GAMMA_MODE_BAYER = 0,
parameter SENS_GAMMA_MODE_REPET = 4, // parameter SENS_GAMMA_MODE_PAGE = 2,
parameter SENS_GAMMA_MODE_TRIG = 5, // parameter SENS_GAMMA_MODE_EN = 3,
// parameter SENS_GAMMA_MODE_REPET = 4,
// parameter SENS_GAMMA_MODE_TRIG = 5,
parameter SENS_GAMMA_MODE_BAYER = 0,
parameter SENS_GAMMA_MODE_BAYER_SET = 2,
parameter SENS_GAMMA_MODE_PAGE = 3,
parameter SENS_GAMMA_MODE_PAGE_SET = 4,
parameter SENS_GAMMA_MODE_EN = 5,
parameter SENS_GAMMA_MODE_EN_SET = 6,
parameter SENS_GAMMA_MODE_REPET = 7,
parameter SENS_GAMMA_MODE_REPET_SET = 8,
parameter SENS_GAMMA_MODE_TRIG = 9,
parameter [1:0] XOR_GAMMA_BAYER = 2'b11 // invert bayer setting - just for gamma tables (to match 353) parameter [1:0] XOR_GAMMA_BAYER = 2'b11 // invert bayer setting - just for gamma tables (to match 353)
) ( ) (
...@@ -104,17 +118,22 @@ module sens_gamma #( ...@@ -104,17 +118,22 @@ module sens_gamma #(
reg [17:0] tdata; reg [17:0] tdata;
// wire set_taddr_data_w; // wire set_taddr_data_w;
reg [12:0] taddr; // two high bits - select channnel (in buffered mode), in non-buffered - 1 bit less, only 10 bits each table reg [12:0] taddr; // two high bits - select channnel (in buffered mode), in non-buffered - 1 bit less, only 10 bits each table
reg [SENS_GAMMA_MODE_WIDTH-1:0] mode=0; // reg [SENS_GAMMA_MODE_WIDTH-1:0] mode=0;
reg [SENS_GAMMA_MODE_WIDTH-1:0] mode_mclk=0; // reg [SENS_GAMMA_MODE_WIDTH-1:0] mode_mclk=0;
reg [15:0] height0_m1; // set @ posedge mclk, used at pclk, but should be OK reg [15:0] height0_m1; // set @ posedge mclk, used at pclk, but should be OK
reg [15:0] height1_m1; reg [15:0] height1_m1;
reg [15:0] height2_m1; reg [15:0] height2_m1;
wire [1:0] bayer; reg [1:0] bayer;
wire table_page; //part of the mode register reg table_page; //part of the mode register
wire en_input; reg en_input;
wire repet_mode; reg repet_mode;
reg [1:0] bayer_mclk;
reg table_page_mclk;
reg en_input_mclk;
reg repet_mode_mclk;
reg [1:0] sensor_subchn; // select sensor from the multiplexed ones reg [1:0] sensor_subchn; // select sensor from the multiplexed ones
reg sof_r; reg sof_r;
...@@ -196,10 +215,10 @@ module sens_gamma #( ...@@ -196,10 +215,10 @@ module sens_gamma #(
(ram_chn_d2[0]?table_rdata1:table_rdata0); (ram_chn_d2[0]?table_rdata1:table_rdata0);
// assign {table_diff_w[7:0],table_base_w[9:0]} = table_rdata; // assign {table_diff_w[7:0],table_base_w[9:0]} = table_rdata;
assign bayer = mode[SENS_GAMMA_MODE_BAYER +: 2]; // assign bayer = mode[SENS_GAMMA_MODE_BAYER +: 2];
assign table_page = mode[SENS_GAMMA_MODE_PAGE]; // TODO: re-assign? // assign table_page = mode[SENS_GAMMA_MODE_PAGE]; // TODO: re-assign?
assign en_input = mode[SENS_GAMMA_MODE_EN]; // assign en_input = mode[SENS_GAMMA_MODE_EN];
assign repet_mode = mode[SENS_GAMMA_MODE_REPET]; // TODO: re-assign? // assign repet_mode = mode[SENS_GAMMA_MODE_REPET]; // TODO: re-assign?
//AF2015 assign sync_bayer=hact_d[1] && ~hact_d[2]; //AF2015 assign sync_bayer=hact_d[1] && ~hact_d[2];
assign interp_data[9:0] = table_base_r[9:0]+table_mult_r[17:8]+table_mult_r[7]; //round assign interp_data[9:0] = table_base_r[9:0]+table_mult_r[17:8]+table_mult_r[7]; //round
...@@ -224,8 +243,20 @@ module sens_gamma #( ...@@ -224,8 +243,20 @@ module sens_gamma #(
else if (set_taddr_w) taddr <= cmd_data[12:0]; else if (set_taddr_w) taddr <= cmd_data[12:0];
else if (set_tdata_r) taddr <= taddr + 1; else if (set_tdata_r) taddr <= taddr + 1;
if (mrst) mode_mclk <= 0; // if (mrst) mode_mclk <= 0;
else if (set_ctrl_w) mode_mclk <= cmd_data[SENS_GAMMA_MODE_WIDTH-1:0]; // else if (set_ctrl_w) mode_mclk <= cmd_data[SENS_GAMMA_MODE_WIDTH-1:0];
if (mrst) bayer_mclk <= 0;
else if (set_ctrl_w && cmd_data[SENS_GAMMA_MODE_BAYER_SET]) bayer_mclk <= cmd_data[SENS_GAMMA_MODE_BAYER +: 2];
if (mrst) table_page_mclk <= 0;
else if (set_ctrl_w && cmd_data[SENS_GAMMA_MODE_PAGE_SET]) table_page_mclk <= cmd_data[SENS_GAMMA_MODE_PAGE];
if (mrst) en_input_mclk <= 0;
else if (set_ctrl_w && cmd_data[SENS_GAMMA_MODE_EN_SET]) en_input_mclk <= cmd_data[SENS_GAMMA_MODE_EN];
if (mrst) repet_mode_mclk <= 0;
else if (set_ctrl_w && cmd_data[SENS_GAMMA_MODE_REPET_SET]) repet_mode_mclk <= cmd_data[SENS_GAMMA_MODE_REPET];
if (mrst) set_tdata_ram <=0; if (mrst) set_tdata_ram <=0;
else set_tdata_ram <= {4{set_tdata_w}} & else set_tdata_ram <= {4{set_tdata_w}} &
...@@ -247,7 +278,12 @@ module sens_gamma #( ...@@ -247,7 +278,12 @@ module sens_gamma #(
always @ (posedge pclk) begin always @ (posedge pclk) begin
if (prst) begin if (prst) begin
mode <= 0; // mode <= 0;
bayer <= 0;
table_page <= 0;
en_input <= 0;
repet_mode <= 0;
hact_d <= 0; hact_d <= 0;
// bayer_nset <= 0; // bayer_nset <= 0;
// bayer0_latched <= 0; // bayer0_latched <= 0;
...@@ -258,7 +294,12 @@ module sens_gamma #( ...@@ -258,7 +294,12 @@ module sens_gamma #(
frame_run <= 0; frame_run <= 0;
end else begin end else begin
mode <= mode_mclk; // mode <= mode_mclk;
bayer <= bayer_mclk;
table_page <= table_page_mclk;
en_input <= en_input_mclk;
repet_mode <= repet_mode_mclk;
hact_d <= {hact_d[4:0],hact_in}; hact_d <= {hact_d[4:0],hact_in};
// bayer_nset <= frame_run && (bayer_nset || hact_in); // bayer_nset <= frame_run && (bayer_nset || hact_in);
// bayer0_latched <= bayer_nset? bayer0_latched : bayer[0]; // bayer0_latched <= bayer_nset? bayer0_latched : bayer[0];
......
...@@ -61,7 +61,7 @@ module sens_histogram #( ...@@ -61,7 +61,7 @@ module sens_histogram #(
input eof, input eof,
input hact, input hact,
input [7:0] hist_di, // 8-bit pixel data input [7:0] hist_di, // 8-bit pixel data
input [1:0] bayer,
input mclk, input mclk,
input hist_en, // @mclk - gracefully enable/disable histogram input hist_en, // @mclk - gracefully enable/disable histogram
input hist_rst, // @mclk - immediately disable if true input hist_rst, // @mclk - immediately disable if true
...@@ -277,10 +277,10 @@ module sens_histogram #( ...@@ -277,10 +277,10 @@ module sens_histogram #(
if (monochrome_pclk) bayer_pclk[1] <= 0; if (monochrome_pclk) bayer_pclk[1] <= 0;
else if (!hact && hact_d[0]) bayer_pclk[1] <= !bayer_pclk[1]; else if (!hact && hact_d[0]) bayer_pclk[1] <= !bayer_pclk[1];
else if (pre_first_line && !hact) bayer_pclk[1] <= XOR_HIST_BAYER[1]; else if (pre_first_line && !hact) bayer_pclk[1] <= XOR_HIST_BAYER[1] ^ bayer[1];
if (monochrome_pclk) bayer_pclk[0] <= 0; if (monochrome_pclk) bayer_pclk[0] <= 0;
else if (!hact) bayer_pclk[0] <= XOR_HIST_BAYER[0]; else if (!hact) bayer_pclk[0] <= XOR_HIST_BAYER[0] ^ bayer[0];
else bayer_pclk[0] <= ~bayer_pclk[0]; else bayer_pclk[0] <= ~bayer_pclk[0];
end end
......
...@@ -60,7 +60,7 @@ module sens_histogram_snglclk #( ...@@ -60,7 +60,7 @@ module sens_histogram_snglclk #(
input eof, input eof,
input hact, input hact,
input [7:0] hist_di, // 8-bit pixel data input [7:0] hist_di, // 8-bit pixel data
input [1:0] bayer,
input mclk, input mclk,
input hist_en, // @mclk - gracefully enable/disable histogram input hist_en, // @mclk - gracefully enable/disable histogram
input hist_rst, // @mclk - immediately disable if true input hist_rst, // @mclk - immediately disable if true
...@@ -232,9 +232,9 @@ module sens_histogram_snglclk #( ...@@ -232,9 +232,9 @@ module sens_histogram_snglclk #(
en_new <= !hist_rst_pclk && hist_en_pclk; en_new <= !hist_rst_pclk && hist_en_pclk;
if (!hact && hact_d[0]) bayer_pclk[1] <= !bayer_pclk[1]; if (!hact && hact_d[0]) bayer_pclk[1] <= !bayer_pclk[1];
else if (pre_first_line && !hact) bayer_pclk[1] <= XOR_HIST_BAYER[1]; else if (pre_first_line && !hact) bayer_pclk[1] <= XOR_HIST_BAYER[1] ^ bayer[1];
if (!hact) bayer_pclk[0] <= XOR_HIST_BAYER[0]; if (!hact) bayer_pclk[0] <= XOR_HIST_BAYER[0] ^ bayer[0];
else bayer_pclk[0] <= ~bayer_pclk[0]; else bayer_pclk[0] <= ~bayer_pclk[0];
end end
...@@ -281,12 +281,12 @@ module sens_histogram_snglclk #( ...@@ -281,12 +281,12 @@ module sens_histogram_snglclk #(
if (!hist_en_pclk || !(|hor_woi)) odd_pix <= 0; if (!hist_en_pclk || !(|hor_woi)) odd_pix <= 0;
else odd_pix <= ~odd_pix; else odd_pix <= ~odd_pix;
if (!hist_en_pclk || !((XOR_HIST_BAYER[0] ^ left[0])? hor_woi[1] : hor_woi[0])) memen_even[0] <= 0; if (!hist_en_pclk || !((bayer[0] ^ XOR_HIST_BAYER[0] ^ left[0])? hor_woi[1] : hor_woi[0])) memen_even[0] <= 0;
else memen_even[0] <= ~memen_even[0]; else memen_even[0] <= ~memen_even[0];
memen_even[6:1] <= memen_even[5:0]; memen_even[6:1] <= memen_even[5:0];
if (!hist_en_pclk || !((XOR_HIST_BAYER[0] ^ left[0])? hor_woi[0] : hor_woi[1])) memen_odd[0] <= 0; if (!hist_en_pclk || !((bayer[0] ^ XOR_HIST_BAYER[0] ^ left[0])? hor_woi[0] : hor_woi[1])) memen_odd[0] <= 0;
else memen_odd[0] <= ~memen_odd[0]; else memen_odd[0] <= ~memen_odd[0];
memen_odd[6:1] <= memen_odd[5:0]; memen_odd[6:1] <= memen_odd[5:0];
......