Commit b5150aa2 authored by Andrey Filippov's avatar Andrey Filippov

merged with maqster, added odd/even HACT shift for parallel sensors

parents a2528fa9 74db0472
VivadoBitstream_@_PreBitstreamTCL=set_property BITSTREAM.STARTUP.MATCH_CYCLE NoWait [current_design]<-@\#\#@->
VivadoBitstream_@_force=true
VivadoBitstream_@_rawfile=x393_hispi
VivadoBitstream_@_rawfile=x393_parallel
com.elphel.store.context.VivadoBitstream=VivadoBitstream_@_rawfile<-@\#\#@->VivadoBitstream_@_force<-@\#\#@->VivadoBitstream_@_PreBitstreamTCL<-@\#\#@->
eclipse.preferences.version=1
......@@ -35,7 +35,8 @@
* contains all the components and scripts required to completely simulate it
* with at least one of the Free Software programs.
*/
parameter FPGA_VERSION = 32'h039300bd; //hispi, trying the same -0.173/36, 80.95%
parameter FPGA_VERSION = 32'h039300be; //parallel - adding odd/even pixels shift -0.066/12, 80.26%
// parameter FPGA_VERSION = 32'h039300bd; //hispi, trying the same -0.173/36, 80.95%
// parameter FPGA_VERSION = 32'h039300bc; //parallel, 100kHz min i2c speed -0.076/8, 79.69%
// parameter FPGA_VERSION = 32'h039300bb; //parallel, adding i2c almost full. -0.101/8, 79.37%
// parameter FPGA_VERSION = 32'h039300ba; //parallel, fixing introduced by debug bug in sens_parallel12.v: met, 80.03%
......
......@@ -480,9 +480,10 @@
parameter SENS_CTRL_GP0= 12, // 13:12
parameter SENS_CTRL_GP1= 14, // 15:14
//`else
parameter SENS_CTRL_QUADRANTS = 12, // 17:12, enable - 20
parameter SENS_CTRL_QUADRANTS_WIDTH = 6,
parameter SENS_CTRL_QUADRANTS_EN = 20, // 17:12, enable - 20 (2 bits reserved)
parameter SENS_CTRL_QUADRANTS = 12, // 17:12, enable - 20
parameter SENS_CTRL_QUADRANTS_WIDTH = 7, // 6,
parameter SENS_CTRL_ODD = 6, //
parameter SENS_CTRL_QUADRANTS_EN = 20, // 18:12, enable - 20 (1 bits reserved)
//`endif
parameter SENSIO_STATUS = 'h1,
parameter SENSIO_JTAG = 'h2,
......
......@@ -2015,7 +2015,7 @@ class X393ExportC(object):
dw.append(("ext_clk", vrlg.SENS_CTRL_EXT_CLK, 1, 0, "MMCM clock input: 0: clock to the sensor, 1 - clock from the sensor"))
dw.append(("ext_clk_set", vrlg.SENS_CTRL_EXT_CLK + 1, 1, 0, "Set MMCM clock input to 'ext_clk' field"))
dw.append(("set_dly", vrlg.SENS_CTRL_LD_DLY, 1, 0, "Set all pre-programmed delays to the sensor port input delays"))
dw.append(("quadrants", vrlg.SENS_CTRL_QUADRANTS, vrlg. SENS_CTRL_QUADRANTS_WIDTH, 1, "90-degree shifts for data [1:0], hact [3:2] and vact [5:4]"))
dw.append(("quadrants", vrlg.SENS_CTRL_QUADRANTS, vrlg. SENS_CTRL_QUADRANTS_WIDTH, 1, "90-degree shifts for data [1:0], hact [3:2] and vact [5:4], [6] - extra period delay for hact"))
dw.append(("quadrants_set",vrlg.SENS_CTRL_QUADRANTS_EN, 1, 0, "Set 'quadrants' values"))
return dw
def _enc_sensio_ctrl_hispi(self):
......
......@@ -407,7 +407,7 @@ class X393Sensor(object):
@param mmcm_rst - True - activate MMCM reset, False - deactivate MMCM reset, None - no change (needed after clock change/interruption)
@param clk_sel - True - use pixel clock from the sensor, False - use internal clock (provided to the sensor), None - no chnage
@param set_delays - (self-clearing) load all pre-programmed delays for the sensor pad inputs
@param quadrants - 90-degree shifts for data [1:0], hact [3:2] and vact [5:4] (6'h01), None - no change
@param quadrants - 90-degree shifts for data [1:0], hact [3:2] and vact [5:4] [6] - extra hact delay by 1 pixel (7'h01), None - no change
@return sensor i/o control word
"""
rslt = 0
......
......@@ -61,8 +61,9 @@ module sens_parallel12 #(
parameter SENS_CTRL_EXT_CLK= 8, // 9: 8
parameter SENS_CTRL_LD_DLY= 10, // 10
parameter SENS_CTRL_QUADRANTS = 12, // 17:12, enable - 20
parameter SENS_CTRL_QUADRANTS_WIDTH = 6,
parameter SENS_CTRL_QUADRANTS_EN = 20, // 17:12, enable - 20 (2 bits reserved)
parameter SENS_CTRL_QUADRANTS_WIDTH = 7, // 6,
parameter SENS_CTRL_ODD = 6, //
parameter SENS_CTRL_QUADRANTS_EN = 20, // 18:12, enable - 20 (1 bits reserved)
parameter LINE_WIDTH_BITS = 16,
......@@ -189,7 +190,7 @@ module sens_parallel12 #(
reg iarst = 0;
reg imrst = 0;
reg rst_mmcm=1; // rst and command - en/dis
reg [SENS_CTRL_QUADRANTS_WIDTH-1:0] quadrants=0; //90-degree shifts for data {1:0], hact [3:2] and vact [5:4]
reg [SENS_CTRL_QUADRANTS_WIDTH-1:0] quadrants=0; //90-degree shifts for data [1:0], hact [3:2] and vact [5:4], [6] odd/even
reg ld_idelay=0;
reg sel_ext_clk=0; // select clock source from the sensor (0 - use internal clock - to sensor)
......@@ -214,8 +215,10 @@ module sens_parallel12 #(
reg xfpgatck=0; // TCK to be sent to external FPGA
reg xfpgatms=0; // TMS to be sent to external FPGA
reg xfpgatdi=0; // TDI to be sent to external FPGA
wire hact_ext; // received hact signal
reg hact_ext_r; // received hact signal, delayed by 1 clock
wire hact_ext_direct; // received hact signal
reg hact_ext_d; // external hact delayed by 1 pixel
wire hact_ext = quadrants[SENS_CTRL_ODD]? hact_ext_d: hact_ext_direct; // selected between
reg hact_ext_r; // received hact signal, delayed by 1 and 2 clocks
reg hact_r; // received or regenerated hact
// for debug/test alive
......@@ -341,8 +344,13 @@ module sens_parallel12 #(
if (irst) line_width_internal_ipclk <= 0;
else if (set_width_ipclk) line_width_internal_ipclk <= line_width_internal;
// generate delayed hact to switch between original/delayed
if (irst) hact_ext_d <= 0;
else hact_ext_d <= hact_ext_direct;
// regenerate/propagate HACT
if (irst) hact_ext_r <= 1'b0;
if (irst) hact_ext_r <= 0;
else hact_ext_r <= hact_ext;
if (irst) hact_r <= 0;
......@@ -576,20 +584,20 @@ module sens_parallel12 #(
.REFCLK_FREQUENCY (SENS_REFCLK_FREQUENCY),
.HIGH_PERFORMANCE_MODE (SENS_HIGH_PERFORMANCE_MODE)
) pxd_hact_i (
.pxd (hact), // inout
.pxd_out (1'b0), // input
.pxd_en (1'b0), // input
.pxd_async (), // output
.pxd_in (hact_ext), // output
.ipclk (ipclk), // input
.ipclk2x (ipclk2x), // input
.mrst (mclk_rst), // input
.irst (irst), // input
.mclk (mclk), // input
.pxd (hact), // inout
.pxd_out (1'b0), // input
.pxd_en (1'b0), // input
.pxd_async (), // output
.pxd_in (hact_ext_direct),// output
.ipclk (ipclk), // input
.ipclk2x (ipclk2x), // input
.mrst (mclk_rst), // input
.irst (irst), // input
.mclk (mclk), // input
.dly_data (data_r[7:0]), // input[7:0]
.set_idelay (set_other_delay),// input
.ld_idelay (ld_idelay), // input
.quadrant (quadrants[3:2]) // input[1:0]
.ld_idelay (ld_idelay), // input
.quadrant (quadrants[3:2]) // input[1:0]
);
pxd_single #(
......
......@@ -173,9 +173,10 @@ module sensor_channel#(
parameter SENS_CTRL_GP0= 12, // 13:12
parameter SENS_CTRL_GP1= 14, // 15:14
`else
parameter SENS_CTRL_QUADRANTS = 12, // 17:12, enable - 20
parameter SENS_CTRL_QUADRANTS_WIDTH = 6,
parameter SENS_CTRL_QUADRANTS_EN = 20, // 17:12, enable - 20 (2 bits reserved)
parameter SENS_CTRL_QUADRANTS = 12, // 17:12, enable - 20
parameter SENS_CTRL_QUADRANTS_WIDTH = 7, // 6,
parameter SENS_CTRL_ODD = 6, //
parameter SENS_CTRL_QUADRANTS_EN = 20, // 18:12, enable - 20 (1 bits reserved)
`endif
parameter SENSIO_STATUS = 'h1,
parameter SENSIO_JTAG = 'h2,
......@@ -893,6 +894,7 @@ module sensor_channel#(
.SENS_CTRL_EXT_CLK (SENS_CTRL_EXT_CLK),
.SENS_CTRL_LD_DLY (SENS_CTRL_LD_DLY),
.SENS_CTRL_QUADRANTS (SENS_CTRL_QUADRANTS),
.SENS_CTRL_ODD (SENS_CTRL_ODD),
.SENS_CTRL_QUADRANTS_WIDTH (SENS_CTRL_QUADRANTS_WIDTH),
.SENS_CTRL_QUADRANTS_EN (SENS_CTRL_QUADRANTS_EN),
.IODELAY_GRP (IODELAY_GRP),
......
......@@ -172,9 +172,10 @@ module sensors393 #(
parameter SENS_CTRL_GP0= 12, // 13:12
parameter SENS_CTRL_GP1= 14, // 15:14
`else
parameter SENS_CTRL_QUADRANTS = 12, // 17:12, enable - 20
parameter SENS_CTRL_QUADRANTS_WIDTH = 6,
parameter SENS_CTRL_QUADRANTS_EN = 20, // 17:12, enable - 20 (2 bits reserved)
parameter SENS_CTRL_QUADRANTS = 12, // 17:12, enable - 20
parameter SENS_CTRL_QUADRANTS_WIDTH = 7, // 6,
parameter SENS_CTRL_ODD = 6, //
parameter SENS_CTRL_QUADRANTS_EN = 20, // 18:12, enable - 20 (1 bits reserved)
`endif
parameter SENSIO_STATUS = 'h1,
parameter SENSIO_JTAG = 'h2,
......@@ -580,6 +581,7 @@ module sensors393 #(
.SENS_CTRL_GP1 (SENS_CTRL_GP1),
`else
.SENS_CTRL_QUADRANTS (SENS_CTRL_QUADRANTS),
.SENS_CTRL_ODD (SENS_CTRL_ODD),
.SENS_CTRL_QUADRANTS_WIDTH (SENS_CTRL_QUADRANTS_WIDTH),
.SENS_CTRL_QUADRANTS_EN (SENS_CTRL_QUADRANTS_EN),
`endif
......
......@@ -64,7 +64,7 @@
`define PRELOAD_BRAMS
`define DISPLAY_COMPRESSED_DATA
// if HISPI is not defined, parallel sensor interface is used for all channels
`define HISPI /*************** CHANGE here and x393_hispi/x393_parallel in bitstream tool settings ****************/
// `define HISPI /*************** CHANGE here and x393_hispi/x393_parallel in bitstream tool settings ****************/
// `define USE_OLD_XDCT393
// `define USE_PCLK2X
// `define USE_XCLK2X
......
......@@ -1721,6 +1721,7 @@ assign axi_grst = axi_rst_pre;
.SENS_CTRL_GP1 (SENS_CTRL_GP1),
`else
.SENS_CTRL_QUADRANTS (SENS_CTRL_QUADRANTS),
.SENS_CTRL_ODD (SENS_CTRL_ODD),
.SENS_CTRL_QUADRANTS_WIDTH (SENS_CTRL_QUADRANTS_WIDTH),
.SENS_CTRL_QUADRANTS_EN (SENS_CTRL_QUADRANTS_EN),
`endif
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment