Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
x393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
x393
Commits
fe0f5941
Commit
fe0f5941
authored
Aug 04, 2016
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made separate control for sesnort histograms, channel enable and bit width
parent
35cce7c8
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
137 additions
and
78 deletions
+137
-78
x393_parameters.vh
includes/x393_parameters.vh
+8
-5
mcntrl_tiled_rw.v
memctrl/mcntrl_tiled_rw.v
+1
-1
vrlg.py
py393/vrlg.py
+14
-8
x393_export_c.py
py393/x393_export_c.py
+4
-2
x393_sens_cmprs.py
py393/x393_sens_cmprs.py
+1
-1
x393_sensor.py
py393/x393_sensor.py
+22
-12
sensor_channel.v
sensor/sensor_channel.v
+26
-15
sensors393.v
sensor/sensors393.v
+11
-6
x393.v
x393.v
+7
-5
x393_testbench03.tf
x393_testbench03.tf
+43
-23
No files found.
includes/x393_parameters.vh
View file @
fe0f5941
...
...
@@ -355,11 +355,14 @@
parameter SENSOR_CTRL_RADDR = 0, // relative to SENSOR_GROUP_ADDR
parameter SENSOR_CTRL_ADDR_MASK = 'h7ff, //
// bits of the SENSOR mode register
parameter SENSOR_MODE_WIDTH = 10,
parameter SENSOR_HIST_EN_BITS = 0, // 0..3 1 - enable histogram modules, disable after processing the started frame
parameter SENSOR_HIST_NRST_BITS = 4, // 0 - immediately reset all histogram modules
parameter SENSOR_CHN_EN_BIT = 8, // 1 - this enable channel
parameter SENSOR_16BIT_BIT = 9, // 0 - 8 bpp mode, 1 - 16 bpp (bypass gamma). Gamma-processed data is still used for histograms
parameter SENSOR_HIST_EN_BITS = 0, // 0..3 1 - enable histogram modules, disable after processing the started frame
parameter SENSOR_HIST_NRST_BITS = 4, // 0 - immediately reset all histogram modules
parameter SENSOR_HIST_BITS_SET = 8, // 1 - set bits 0..7 (en and nrst)
parameter SENSOR_CHN_EN_BIT = 9, // 1 - this enable channel
parameter SENSOR_CHN_EN_BIT_SET = 10, // set SENSOR_CHN_EN_BIT bit
parameter SENSOR_16BIT_BIT = 11, // 0 - 8 bpp mode, 1 - 16 bpp (bypass gamma). Gamma-processed data is still used for histograms
parameter SENSOR_16BIT_BIT_SET = 12, // set 8/16 bit mode
// parameter SENSOR_MODE_WIDTH = 13,
parameter SENSI2C_CTRL_RADDR = 2, // 302..'h303
parameter SENSI2C_CTRL_MASK = 'h7fe,
...
...
memctrl/mcntrl_tiled_rw.v
View file @
fe0f5941
...
...
@@ -244,7 +244,7 @@ module mcntrl_tiled_rw#(
reg
[
4
:
0
]
frame_start_r
;
// increased length to have time from line_unfinished to suspend (external)
// reg rst_frame_num_d;
reg
[
MAX_TILE_WIDTH
:
0
]
tile_cols
;
// full number of columns in a tile
reg
[
MAX_TILE_WIDTH
:
0
]
tile_cols
;
// full number of columns in a tile
(in bursts?)
// reg [MAX_TILE_HEIGHT:0] tile_rows; // full number of rows in a tile
// reg [MAX_TILE_HEIGHT-1:0] tile_rows; // full number of rows in a tile
reg
[
MAX_TILE_HEIGHT
:
0
]
tile_rows
;
// full number of rows in a tile
...
...
py393/vrlg.py
View file @
fe0f5941
...
...
@@ -128,6 +128,7 @@ CLK_STATUS_REG_ADDR__TYPE = str
MCONTR_TOP_16BIT_STATUS_CNTRL__TYPE
=
str
HIST_SAXI_ADDR_MASK
=
int
CONTROL_RBACK_ADDR_MASK
=
int
SENSOR_CHN_EN_BIT_SET__RAW
=
str
CMPRS_CBIT_QBANK__TYPE
=
str
CLKOUT_DIV_PCLK__RAW
=
str
SENS_GAMMA_CTRL__RAW
=
str
...
...
@@ -313,7 +314,7 @@ MULTICLK_MULT = int
SENS_LENS_POST_SCALE_MASK
=
int
MEMCLK_PERIOD
=
float
BUF_IPCLK2X_SENS1__RAW
=
str
SENSOR_MODE
_WIDTH__RAW
=
str
HISTOGRAM
_WIDTH__RAW
=
str
SENS_LENS_FAT0_OUT_MASK
=
int
SENS_SYNC_MULT__TYPE
=
str
NUM_CYCLES_27__RAW
=
str
...
...
@@ -439,7 +440,7 @@ MULT_SAXI_CNTRL_STATUS__TYPE = str
CMPRS_FRMT_MBRM1_BITS__RAW
=
str
SCANLINE_EXTRA_PAGES
=
int
LD_DLY_LANE1_ODELAY__RAW
=
str
LOGGER_CONF_EN_BITS__RAW
=
str
SENSOR_CHN_EN_BIT_SET__TYPE
=
str
SENS_CTRL_IGNORE_EMBED__TYPE
=
str
SENS_LENS_FAT0_IN_MASK__TYPE
=
str
RSEL
=
int
...
...
@@ -561,6 +562,7 @@ SENSOR_FIFO_DELAY__RAW = str
DLY_SET
=
int
CMDFRAMESEQ_CTRL__TYPE
=
str
HISPI_FIFO_DEPTH__RAW
=
str
SENSOR_HIST_BITS_SET__RAW
=
str
NUM_CYCLES_12
=
int
MCNTRL_SCANLINE_FRAME_PAGE_RESET__TYPE
=
str
MCNTRL_TILED_CHN2_ADDR__TYPE
=
str
...
...
@@ -591,6 +593,7 @@ NUM_CYCLES_16 = int
NUM_CYCLES_15
=
int
NUM_CYCLES_21__TYPE
=
str
CMPRS_CBIT_BAYER
=
int
LOGGER_CONF_EN_BITS__RAW
=
str
SLEW_CLK__TYPE
=
str
MCONTR_PHY_0BIT_DLY_SET
=
int
HISPI_DIFF_TERM__TYPE
=
str
...
...
@@ -631,6 +634,7 @@ RTC_ADDR = int
MCLK_PHASE__RAW
=
str
SENSIO_RADDR__TYPE
=
str
CLKFBOUT_MULT_PCLK__TYPE
=
str
VERBOSE__TYPE
=
str
CLK_ADDR__TYPE
=
str
CMPRS_FORMAT
=
int
SENSIO_STATUS_REG_REL
=
int
...
...
@@ -999,7 +1003,7 @@ HISTOGRAM_ADDR_MASK = int
MCONTR_BUF2_RD_ADDR__RAW
=
str
MCONTR_TOP_16BIT_ADDR_MASK__RAW
=
str
MULTICLK_DIV_DLYREF__RAW
=
str
VERBOSE__TYPE
=
str
MCNTRL_PS_EN_RST__RAW
=
str
BUF_CLK1X_PCLK__TYPE
=
str
MULT_SAXI_BSLOG1__RAW
=
str
CLKFBOUT_MULT_PCLK__RAW
=
str
...
...
@@ -1227,7 +1231,6 @@ PXD_IBUF_LOW_PWR__RAW = str
PXD_DRIVE
=
int
MULT_SAXI_BSLOG2__RAW
=
str
CLK_CNTRL__TYPE
=
str
HISTOGRAM_WIDTH__RAW
=
str
GPIO_MASK__RAW
=
str
DFLT_REFRESH_ADDR__TYPE
=
str
SENS_GAMMA_MODE_REPET__TYPE
=
str
...
...
@@ -1298,7 +1301,6 @@ FFCLK1_IOSTANDARD__RAW = str
CMD_DONE_BIT__TYPE
=
str
SENSOR_DATA_WIDTH__TYPE
=
str
SENS_LENS_SCALES__RAW
=
str
SENSOR_MODE_WIDTH
=
int
RTC_BITC_PREDIV__RAW
=
str
CMPRS_CORING_BITS__TYPE
=
str
STATUS_DEPTH__TYPE
=
str
...
...
@@ -1531,7 +1533,6 @@ MULT_SAXI_IRQLEN_MASK__TYPE = str
PICKLE__TYPE
=
str
SENSI2C_TBL_NBWR__RAW
=
str
TABLE_FOCUS_INDEX__RAW
=
str
SENSOR_MODE_WIDTH__TYPE
=
str
MCONTR_LINTILE_WRITE__RAW
=
str
MCNTRL_TILED_CHN2_ADDR__RAW
=
str
CMPRS_CONTROL_REG__TYPE
=
str
...
...
@@ -1678,6 +1679,7 @@ HIST_SAXI_MODE_ADDR_MASK__RAW = str
FFCLK1_IBUF_LOW_PWR__TYPE
=
str
SENSOR12BITS_NVLO__TYPE
=
str
MCONTR_LINTILE_EXTRAPG__TYPE
=
str
CAMSYNC_SNDEN_BIT__TYPE
=
str
NUM_CYCLES_06__TYPE
=
str
SCANLINE_STARTX__RAW
=
str
SLEW_DQS__RAW
=
str
...
...
@@ -1695,6 +1697,7 @@ CLK_PHASE__TYPE = str
SENSOR_16BIT_BIT
=
int
SENSIO_DELAYS__TYPE
=
str
SENS_CTRL_EXT_CLK__RAW
=
str
SENSOR_CHN_EN_BIT_SET
=
int
WOI_HEIGHT
=
int
LOGGER_PAGE_GPS__TYPE
=
str
T_REFI
=
int
...
...
@@ -1721,7 +1724,7 @@ SENSI2C_CMD_SOFT_SDA = int
SENSI2C_CMD_TAND
=
int
CMPRS_AFIMUX_SA_LEN
=
int
SENS_CTRL_QUADRANTS_EN__TYPE
=
str
MCNTRL_PS_EN_RS
T__RAW
=
str
SENSOR_16BIT_BIT_SE
T__RAW
=
str
HISPI_IFD_DELAY_VALUE__TYPE
=
str
CMPRS_CBIT_BAYER_BITS__RAW
=
str
MULTICLK_BUF_AXIHP__TYPE
=
str
...
...
@@ -1816,6 +1819,7 @@ MCONTR_PHY_16BIT_ADDR__RAW = str
SENS_CTRL_MRST__RAW
=
str
SENS_GAMMA_HEIGHT2__TYPE
=
str
IPCLK2X_PHASE__TYPE
=
str
SENSOR_HIST_BITS_SET
=
int
MCNTRL_SCANLINE_CHN1_ADDR
=
int
MULT_SAXI_HALF_BRAM_IN
=
int
CMDFRAMESEQ_ADDR_INC__RAW
=
str
...
...
@@ -1835,7 +1839,7 @@ CMPRS_GROUP_ADDR__RAW = str
SENS_LENS_AX__RAW
=
str
CMPRS_JP4DIFF__RAW
=
str
SENS_SS_MODE__RAW
=
str
CAMSYNC_SNDEN_BI
T__TYPE
=
str
SENSOR_16BIT_BIT_SE
T__TYPE
=
str
DEBUG_CMD_LATENCY__RAW
=
str
CMPRS_CBIT_CMODE__TYPE
=
str
LOGGER_STATUS_MASK
=
int
...
...
@@ -2080,6 +2084,7 @@ CMPRS_MONO16 = int
REF_JITTER1
=
float
SENSI2C_TBL_DLY
=
int
SENSIO_STATUS__RAW
=
str
SENSOR_16BIT_BIT_SET
=
int
MCONTR_LINTILE_DIS_NEED
=
int
SENS_LENS_BX_MASK
=
int
HISPI_FIFO_START__RAW
=
str
...
...
@@ -2150,6 +2155,7 @@ MCONTR_PHY_0BIT_DLY_SET__RAW = str
NUM_CYCLES_11__RAW
=
str
FFCLK1_CAPACITANCE__RAW
=
str
SENSI2C_DRIVE__RAW
=
str
SENSOR_HIST_BITS_SET__TYPE
=
str
CMPRS_CBIT_CMODE_MONO1__TYPE
=
str
SENS_LENS_C
=
int
SENSOR_CTRL_ADDR_MASK__RAW
=
str
...
...
py393/x393_export_c.py
View file @
fe0f5941
...
...
@@ -147,7 +147,7 @@ class X393ExportC(object):
txt
+=
' #define PARS_FRAMES 16 ///< Number of frames in a sequencer TODO:// move it here from <elphel/c313a.h>
\n
'
txt
+=
' #define PARS_FRAMES_MASK (PARS_FRAMES-1) ///< Maximal frame number (15 for NC393) TODO:// move it here from <elphel/c313a.h>
\n
'
txt
+=
'#endif
\n
'
txt
+=
'typedef enum {DIRECT,ABSOLUTE,RELATIVE} x393cmd_t; ///< How to apply command - directly or through the command sequencer
\n
'
txt
+=
'typedef enum {DIRECT,ABSOLUTE,RELATIVE
,ASAP
} x393cmd_t; ///< How to apply command - directly or through the command sequencer
\n
'
txt
+=
"""// IRQ commands applicable to several targets
#define X393_IRQ_NOP 0
#define X393_IRQ_RESET 1
...
...
@@ -935,7 +935,6 @@ class X393ExportC(object):
((
"X393_CMPRS_CBIT_CMODE_JP4DIFFHDRDIV2"
,
""
,
vrlg
.
CMPRS_CBIT_CMODE_JP4DIFFHDRDIV2
,
0
,
None
,
None
,
""
,
"jp4, 4 blocks, differential, hdr,divide by 2"
)),
((
"X393_CMPRS_CBIT_CMODE_MONO1"
,
""
,
vrlg
.
CMPRS_CBIT_CMODE_MONO1
,
0
,
None
,
None
,
""
,
"Mono JPEG (not yet implemented)"
)),
((
"X393_CMPRS_CBIT_CMODE_MONO4"
,
""
,
vrlg
.
CMPRS_CBIT_CMODE_MONO4
,
0
,
None
,
None
,
""
,
"Mono, 4 blocks (2x2 macroblocks)"
)),
((
"X393_CMPRS_CBIT_CMODE_JPEG18"
,
""
,
vrlg
.
CMPRS_CBIT_CMODE_JPEG18
,
0
,
None
,
None
,
""
,
"Color 4:2:0"
)),
((
"X393_CMPRS_CBIT_FRAMES_SINGLE"
,
""
,
vrlg
.
CMPRS_CBIT_FRAMES_SINGLE
,
0
,
None
,
None
,
""
,
"Use single-frame buffer"
)),
((
"X393_CMPRS_CBIT_FRAMES_MULTI"
,
""
,
1
,
0
,
None
,
None
,
""
,
"Use multi-frame buffer"
))]
...
...
@@ -1898,8 +1897,11 @@ class X393ExportC(object):
dw
=
[]
dw
.
append
((
"hist_en"
,
vrlg
.
SENSOR_HIST_EN_BITS
,
4
,
15
,
"Enable subchannel histogram modules (may be less than 4)"
))
dw
.
append
((
"hist_nrst"
,
vrlg
.
SENSOR_HIST_NRST_BITS
,
4
,
15
,
"Reset off for histograms subchannels (may be less than 4)"
))
dw
.
append
((
"hist_set"
,
vrlg
.
SENSOR_HIST_BITS_SET
,
1
,
0
,
"Apply values in hist_en and hist_nrst fields (0 - ignore)"
))
dw
.
append
((
"chn_en"
,
vrlg
.
SENSOR_CHN_EN_BIT
,
1
,
1
,
"Enable this sensor channel"
))
dw
.
append
((
"chn_en_set"
,
vrlg
.
SENSOR_CHN_EN_BIT_SET
,
1
,
1
,
"Apply chn_en value (0 - ignore)"
))
dw
.
append
((
"bit16"
,
vrlg
.
SENSOR_16BIT_BIT
,
1
,
0
,
"0 - 8 bpp mode, 1 - 16 bpp (bypass gamma). Gamma-processed data is still used for histograms"
))
dw
.
append
((
"bit16_set"
,
vrlg
.
SENSOR_16BIT_BIT_SET
,
1
,
0
,
"Apply bit16 value (0 - ignore)"
))
return
dw
def
_enc_sens_sync_mult
(
self
):
...
...
py393/x393_sens_cmprs.py
View file @
fe0f5941
...
...
@@ -1129,7 +1129,7 @@ class X393SensCmprs(object):
tile_margin
=
0
# 18x18 instead of 16x16
tile_width
=
4
# extra_pages = (0,1)[(compressor_left_margin % 16) != 0] # memory access block border does not cut macroblocks
extra_pages
=
1
# just testing
extra_pages
=
1
# just testing
, 0 should be OK here
tile_vstep
=
16
tile_height
=
tile_vstep
+
tile_margin
...
...
py393/x393_sensor.py
View file @
fe0f5941
...
...
@@ -252,10 +252,10 @@ class X393Sensor(object):
# Functions used by sensor-related tasks
def
func_sensor_mode
(
self
,
hist_en
,
hist_nrst
,
chn_en
,
bits16
):
hist_en
=
None
,
hist_nrst
=
None
,
chn_en
=
None
,
bits16
=
None
):
"""
Combine parameters into sensor mode control word
@param hist_en - bit mask to enable histogram sub-modules, when 0 - disable after processing
...
...
@@ -267,10 +267,16 @@ class X393Sensor(object):
@return: sensor mode control word
"""
rslt
=
0
;
rslt
|=
(
hist_en
&
0xf
)
<<
vrlg
.
SENSOR_HIST_EN_BITS
rslt
|=
(
hist_nrst
&
0xf
)
<<
vrlg
.
SENSOR_HIST_NRST_BITS
rslt
|=
((
0
,
1
)[
chn_en
])
<<
vrlg
.
SENSOR_CHN_EN_BIT
rslt
|=
((
0
,
1
)[
bits16
])
<<
vrlg
.
SENSOR_16BIT_BIT
if
(
not
hist_en
is
None
)
and
(
hist_nrst
is
None
):
rslt
|=
(
hist_en
&
0xf
)
<<
vrlg
.
SENSOR_HIST_EN_BITS
rslt
|=
(
hist_nrst
&
0xf
)
<<
vrlg
.
SENSOR_HIST_NRST_BITS
rslt
|=
1
<<
vrlg
.
SENSOR_HIST_BITS_SET
;
if
not
chn_en
is
None
:
rslt
|=
((
0
,
1
)[
chn_en
])
<<
vrlg
.
SENSOR_CHN_EN_BIT
rslt
|=
1
<<
vrlg
.
SENSOR_CHN_EN_BIT_SET
if
not
bits16
is
None
:
rslt
|=
((
0
,
1
)[
bits16
])
<<
vrlg
.
SENSOR_16BIT_BIT
rslt
|=
1
<<
vrlg
.
SENSOR_16BIT_BIT_SET
return
rslt
def
func_sensor_i2c_command
(
self
,
...
...
@@ -490,10 +496,10 @@ class X393Sensor(object):
def
set_sensor_mode
(
self
,
num_sensor
,
hist_en
,
hist_nrst
,
chn_en
,
bits16
):
hist_en
=
None
,
hist_nrst
=
None
,
chn_en
=
None
,
bits16
=
None
):
"""
Set sensor mode
@param num_sensor - sensor port number (0..3)
...
...
@@ -522,6 +528,10 @@ class X393Sensor(object):
hist_nrst
=
hist_nrst
,
chn_en
=
chn_en
,
bits16
=
bits16
))
def
set_sensor_i2c_command
(
self
,
num_sensor
,
...
...
sensor/sensor_channel.v
View file @
fe0f5941
...
...
@@ -69,11 +69,14 @@ module sensor_channel#(
parameter
SENSOR_CTRL_RADDR
=
0
,
//'h00
parameter
SENSOR_CTRL_ADDR_MASK
=
'h7ff
,
//
// bits of the SENSOR mode register
parameter
SENSOR_MODE_WIDTH
=
10
,
parameter
SENSOR_HIST_EN_BITS
=
0
,
// 0..3 1 - enable histogram modules, disable after processing the started frame
parameter
SENSOR_HIST_NRST_BITS
=
4
,
// 0 - immediately reset all histogram modules
parameter
SENSOR_CHN_EN_BIT
=
8
,
// 1 - this enable channel
parameter
SENSOR_16BIT_BIT
=
9
,
// 0 - 8 bpp mode, 1 - 16 bpp (bypass gamma). Gamma-processed data is still used for histograms
parameter
SENSOR_HIST_NRST_BITS
=
4
,
// 0 - immediately reset all histogram modules
parameter
SENSOR_HIST_BITS_SET
=
8
,
// 1 - set bits 0..7 (en and nrst)
parameter
SENSOR_CHN_EN_BIT
=
9
,
// 1 - this enable channel
parameter
SENSOR_CHN_EN_BIT_SET
=
10
,
// set SENSOR_CHN_EN_BIT bit
parameter
SENSOR_16BIT_BIT
=
11
,
// 0 - 8 bpp mode, 1 - 16 bpp (bypass gamma). Gamma-processed data is still used for histograms
parameter
SENSOR_16BIT_BIT_SET
=
12
,
// set 8/16 bit mode
// parameter SENSOR_MODE_WIDTH = 13,
parameter
SENSI2C_CTRL_RADDR
=
2
,
// 'h02..'h03
parameter
SENSI2C_CTRL_MASK
=
'h7fe
,
...
...
@@ -432,12 +435,12 @@ module sensor_channel#(
wire
[
31
:
0
]
sensor_ctrl_data
;
wire
sensor_ctrl_we
;
reg
[
SENSOR_MODE_WIDTH
-
1
:
0
]
mode
;
wire
[
3
:
0
]
hist_en
;
wire
en_mclk
;
// enable this channel
//
reg [SENSOR_MODE_WIDTH-1:0] mode;
reg
[
3
:
0
]
hist_en
;
reg
en_mclk
;
// enable this channel
wire
en_pclk
;
// enable in pclk domain
wire
[
3
:
0
]
hist_nrst
;
wire
bit16
;
// 16-bit mode, 0 - 8 bit mode
reg
[
3
:
0
]
hist_nrst
;
reg
bit16
;
// 16-bit mode, 0 - 8 bit mode
wire
[
3
:
0
]
hist_rq
;
wire
[
3
:
0
]
hist_gr
;
wire
[
3
:
0
]
hist_dv
;
...
...
@@ -472,10 +475,10 @@ module sensor_channel#(
assign
dav_w
=
bit16
?
gamma_hact_in
:
dav_8bit
;
assign
last_in_line
=
!
(
bit16
?
gamma_hact_in
:
gamma_hact_out
)
;
assign
en_mclk
=
mode
[
SENSOR_CHN_EN_BIT
]
;
assign
hist_en
=
mode
[
SENSOR_HIST_EN_BITS
+:
4
]
;
assign
hist_nrst
=
mode
[
SENSOR_HIST_NRST_BITS
+:
4
]
;
assign
bit16
=
mode
[
SENSOR_16BIT_BIT
]
;
//
assign en_mclk = mode[SENSOR_CHN_EN_BIT];
//
assign hist_en = mode[SENSOR_HIST_EN_BITS +: 4];
//
assign hist_nrst = mode[SENSOR_HIST_NRST_BITS +: 4];
//
assign bit16 = mode[SENSOR_16BIT_BIT];
`ifdef
DEBUG_RING
...
...
@@ -561,8 +564,16 @@ module sensor_channel#(
end
always
@
(
posedge
mclk
)
begin
if
(
mrst
)
mode
<=
0
;
else
if
(
sensor_ctrl_we
)
mode
<=
sensor_ctrl_data
[
SENSOR_MODE_WIDTH
-
1
:
0
]
;
// if (mrst) mode <= 0;
// else if (sensor_ctrl_we) mode <= sensor_ctrl_data[SENSOR_MODE_WIDTH-1:0];
if
(
mrst
)
hist_en
<=
0
;
else
if
(
sensor_ctrl_we
&&
sensor_ctrl_data
[
SENSOR_HIST_BITS_SET
])
hist_en
<=
sensor_ctrl_data
[
SENSOR_HIST_EN_BITS
+:
4
]
;
if
(
mrst
)
hist_nrst
<=
0
;
else
if
(
sensor_ctrl_we
&&
sensor_ctrl_data
[
SENSOR_HIST_BITS_SET
])
hist_nrst
<=
sensor_ctrl_data
[
SENSOR_HIST_NRST_BITS
+:
4
]
;
if
(
mrst
)
en_mclk
<=
0
;
else
if
(
sensor_ctrl_we
&&
sensor_ctrl_data
[
SENSOR_CHN_EN_BIT_SET
])
en_mclk
<=
sensor_ctrl_data
[
SENSOR_CHN_EN_BIT
]
;
if
(
mrst
)
bit16
<=
0
;
else
if
(
sensor_ctrl_we
&&
sensor_ctrl_data
[
SENSOR_16BIT_BIT_SET
])
bit16
<=
sensor_ctrl_data
[
SENSOR_16BIT_BIT
]
;
end
always
@
(
posedge
pclk
)
begin
...
...
sensor/sensors393.v
View file @
fe0f5941
...
...
@@ -61,11 +61,14 @@ module sensors393 #(
parameter
SENSOR_CTRL_RADDR
=
0
,
// relative to SENSOR_GROUP_ADDR
parameter
SENSOR_CTRL_ADDR_MASK
=
'h7ff
,
//
// bits of the SENSOR mode register
parameter
SENSOR_MODE_WIDTH
=
10
,
parameter
SENSOR_HIST_EN_BITS
=
0
,
// 0..3 1 - enable histogram modules, disable after processing the started frame
parameter
SENSOR_HIST_NRST_BITS
=
4
,
// 0 - immediately reset all histogram modules
parameter
SENSOR_CHN_EN_BIT
=
8
,
// 1 - this enable channel
parameter
SENSOR_16BIT_BIT
=
9
,
// 0 - 8 bpp mode, 1 - 16 bpp (bypass gamma). Gamma-processed data is still used for histograms
parameter
SENSOR_HIST_NRST_BITS
=
4
,
// 0 - immediately reset all histogram modules
parameter
SENSOR_HIST_BITS_SET
=
8
,
// 1 - set bits 0..7 (en and nrst)
parameter
SENSOR_CHN_EN_BIT
=
9
,
// 1 - this enable channel
parameter
SENSOR_CHN_EN_BIT_SET
=
10
,
// set SENSOR_CHN_EN_BIT bit
parameter
SENSOR_16BIT_BIT
=
11
,
// 0 - 8 bpp mode, 1 - 16 bpp (bypass gamma). Gamma-processed data is still used for histograms
parameter
SENSOR_16BIT_BIT_SET
=
12
,
// set 8/16 bit mode
// parameter SENSOR_MODE_WIDTH = 13,
parameter
SENSI2C_CTRL_RADDR
=
2
,
// 302..'h303
parameter
SENSI2C_CTRL_MASK
=
'h7fe
,
...
...
@@ -484,11 +487,13 @@ module sensors393 #(
.
SENS_GAMMA_BUFFER
(
SENS_GAMMA_BUFFER
)
,
.
SENSOR_CTRL_RADDR
(
SENSOR_CTRL_RADDR
)
,
.
SENSOR_CTRL_ADDR_MASK
(
SENSOR_CTRL_ADDR_MASK
)
,
.
SENSOR_MODE_WIDTH
(
SENSOR_MODE_WIDTH
)
,
.
SENSOR_CHN_EN_BIT
(
SENSOR_CHN_EN_BIT
)
,
.
SENSOR_HIST_EN_BITS
(
SENSOR_HIST_EN_BITS
)
,
.
SENSOR_HIST_NRST_BITS
(
SENSOR_HIST_NRST_BITS
)
,
.
SENSOR_HIST_BITS_SET
(
SENSOR_HIST_BITS_SET
)
,
.
SENSOR_CHN_EN_BIT
(
SENSOR_CHN_EN_BIT
)
,
.
SENSOR_CHN_EN_BIT_SET
(
SENSOR_CHN_EN_BIT_SET
)
,
.
SENSOR_16BIT_BIT
(
SENSOR_16BIT_BIT
)
,
.
SENSOR_16BIT_BIT_SET
(
SENSOR_16BIT_BIT_SET
)
,
.
SENSI2C_CTRL_RADDR
(
SENSI2C_CTRL_RADDR
)
,
.
SENSI2C_CTRL_MASK
(
SENSI2C_CTRL_MASK
)
,
.
SENSI2C_CTRL
(
SENSI2C_CTRL
)
,
...
...
x393.v
View file @
fe0f5941
...
...
@@ -1622,11 +1622,13 @@ assign axi_grst = axi_rst_pre;
.
SENS_GAMMA_BUFFER
(
SENS_GAMMA_BUFFER
)
,
.
SENSOR_CTRL_RADDR
(
SENSOR_CTRL_RADDR
)
,
.
SENSOR_CTRL_ADDR_MASK
(
SENSOR_CTRL_ADDR_MASK
)
,
.
SENSOR_MODE_WIDTH
(
SENSOR_MODE_WIDTH
)
,
.
SENSOR_HIST_EN_BITS
(
SENSOR_HIST_EN_BITS
)
,
.
SENSOR_CHN_EN_BIT
(
SENSOR_CHN_EN_BIT
)
,
.
SENSOR_HIST_NRST_BITS
(
SENSOR_HIST_NRST_BITS
)
,
.
SENSOR_HIST_BITS_SET
(
SENSOR_HIST_BITS_SET
)
,
.
SENSOR_CHN_EN_BIT
(
SENSOR_CHN_EN_BIT
)
,
.
SENSOR_CHN_EN_BIT_SET
(
SENSOR_CHN_EN_BIT_SET
)
,
.
SENSOR_16BIT_BIT
(
SENSOR_16BIT_BIT
)
,
.
SENSOR_16BIT_BIT_SET
(
SENSOR_16BIT_BIT_SET
)
,
.
SENSI2C_CTRL_RADDR
(
SENSI2C_CTRL_RADDR
)
,
.
SENSI2C_CTRL_MASK
(
SENSI2C_CTRL_MASK
)
,
.
SENSI2C_CTRL
(
SENSI2C_CTRL
)
,
...
...
@@ -2958,9 +2960,9 @@ sata_ahci_top sata_top(
cmprs_irq
[
3
:
0
]
,
// [15:12] Compressor done interrupts SPI: Numbers [91:88]
frseq_irq
[
3
:
0
]
,
// [11: 8] Frame sync interrupts SPI: Numbers [87:84]
mult_saxi_irq
[
3
:
0
]
,
// [ 7: 4] interrupts from mult_saxi channels SPI: Numbers [68:65]
membridge_irq
,
// [3] interrupts from membridge module SPI: Number [6
5
]
2'b0
,
// [ 2: 1] Reserved SPI: Numbers [6
4:63
]
sata_irq
// [ 0] AHCI (SATA ) interrupt SPI: Number [6
2
]
membridge_irq
,
// [3] interrupts from membridge module SPI: Number [6
4
]
2'b0
,
// [ 2: 1] Reserved SPI: Numbers [6
3:62
]
sata_irq
// [ 0] AHCI (SATA ) interrupt SPI: Number [6
1
]
}
)
,
// Interrupts, PL to PS [19:0], input
.
IRQP2F
()
,
// Interrupts, PL to PS [28:0], output
// Event Signals
...
...
x393_testbench03.tf
View file @
fe0f5941
...
...
@@ -3247,13 +3247,19 @@ task setup_sensor_channel;
// Run after histogram channel is set up?
TEST_TITLE = "SENSOR_SETUP";
$display("===================== TEST_%s =========================",TEST_TITLE);
set_sensor_mode (
set_sensor_mode
_hist
(
num_sensor, // input [1:0] num_sensor;
4'h1, // input [3:0] hist_en; // [0..3] 1 - enable histogram modules, disable after processing the started frame
4'h1, // input [3:0] hist_nrst; // [4..7] 0 - immediately reset histogram module
1'b1, // input chn_en; // [8] 1 - enable sensor channel (0 - reset)
1'b0); // input bits16; // [9] 0 - 8 bpp mode, 1 - 16 bpp (bypass gamma). Gamma-processed data is still used for histograms
4'h1); // input [3:0] hist_nrst; // [4..7] 0 - immediately reset histogram module
set_sensor_mode_en (
num_sensor, // input [1:0] num_sensor;
1'b1); // input chn_en; // [9] 1 - enable sensor channel (0 - reset)
// test i2c - manual and sequencer (same data as in 353 test fixture
set_sensor_mode_bits16 (
num_sensor, // input [1:0] num_sensor;
1'b0); // input bits16; // [11] 0 - 8 bpp mode, 1 - 16 bpp (bypass gamma). Gamma-processed data is still used for histograms
// test i2c - manual and sequencer (same data as in 353 test fixture
TEST_TITLE = "CMPRS_EN_ARBIT";
...
...
@@ -3780,6 +3786,37 @@ task set_gpio_pins; // SuppressThisWarning VEditor not always unused
endtask
// x393_sensor.py
task set_sensor_mode_hist;
input [1:0] num_sensor;
input [3:0] hist_en; // [0..3] 1 - enable histogram modules, disable after processing the started frame
input [3:0] hist_nrst; // [4..7] 0 - immediately reset histogram module
reg [31:0] tmp;
begin
tmp= {{(32-9){1'b0}},{1'b1,hist_nrst,hist_en}};
write_contol_register( SENSOR_GROUP_ADDR + num_sensor * SENSOR_BASE_INC +SENSOR_CTRL_RADDR, tmp);
end
endtask
task set_sensor_mode_en;
input [1:0] num_sensor;
input chn_en; // [9] 1 - enable sensor channel (0 - reset)
reg [31:0] tmp;
begin
tmp= {{(32-11){1'b0}},{1'b1,chn_en,9'b0}};
write_contol_register( SENSOR_GROUP_ADDR + num_sensor * SENSOR_BASE_INC +SENSOR_CTRL_RADDR, tmp);
end
endtask
task set_sensor_mode_bits16;
input [1:0] num_sensor;
input bits16; // [11] 0 - 8 bpp mode, 1 - 16 bpp (bypass gamma). Gamma-processed data is still used for histograms
reg [31:0] tmp;
begin
tmp= {{(32-13){1'b0}},{1'b1,bits16,11'b0}};
write_contol_register( SENSOR_GROUP_ADDR + num_sensor * SENSOR_BASE_INC +SENSOR_CTRL_RADDR, tmp);
end
endtask
/*
task set_sensor_mode;
input [1:0] num_sensor;
input [3:0] hist_en; // [0..3] 1 - enable histogram modules, disable after processing the started frame
...
...
@@ -3791,9 +3828,8 @@ task set_sensor_mode;
tmp= {{(32-SENSOR_MODE_WIDTH){1'b0}},func_sensor_mode(hist_en, hist_nrst, chn_en,bits16)};
write_contol_register( SENSOR_GROUP_ADDR + num_sensor * SENSOR_BASE_INC +SENSOR_CTRL_RADDR, tmp);
end
endtask
*/
// x393_sensor.py
task set_sensor_i2c_command;
input [1:0] num_sensor;
...
...
@@ -4489,22 +4525,6 @@ task write_cmd_frame_sequencer; // SuppressThisWarning VEditor not always unused
end
endtask
// x393_sensor.py
function [SENSOR_MODE_WIDTH-1:0] func_sensor_mode;
input [3:0] hist_en; // [0..3] 1 - enable histogram modules, disable after processing the started frame
input [3:0] hist_nrst; // [4..7] 0 - immediately reset histogram module
input chn_en; // [8] 1 - enable sensor channel (0 - reset)
input bits16; // [9] 0 - 8 bpp mode, 1 - 16 bpp (bypass gamma). Gamma-processed data is still used for histograms
reg [SENSOR_MODE_WIDTH-1:0] tmp;
begin
tmp = 0;
tmp [SENSOR_HIST_EN_BITS +: 4] = hist_en;
tmp [SENSOR_HIST_NRST_BITS +: 4] = hist_nrst;
tmp [SENSOR_CHN_EN_BIT] = chn_en;
tmp [SENSOR_16BIT_BIT] = bits16;
func_sensor_mode = tmp;
end
endfunction
// x393_sensor.py
function [31 : 0] func_sensor_i2c_command;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment