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
72068ae7
Commit
72068ae7
authored
Aug 29, 2015
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More Python code for testing hardware
parent
9a17dbfa
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
386 additions
and
28 deletions
+386
-28
x393_simulation_parameters.vh
includes/x393_simulation_parameters.vh
+1
-1
x393_axi_control_status.py
py393/x393_axi_control_status.py
+24
-13
x393_cmprs.py
py393/x393_cmprs.py
+90
-0
x393_cmprs_afi.py
py393/x393_cmprs_afi.py
+2
-2
x393_sens_cmprs.py
py393/x393_sens_cmprs.py
+248
-0
x393_sensor.py
py393/x393_sensor.py
+8
-6
x393_utils.py
py393/x393_utils.py
+1
-1
x393_testbench02.tf
x393_testbench02.tf
+12
-5
No files found.
includes/x393_simulation_parameters.vh
View file @
72068ae7
...
...
@@ -53,7 +53,7 @@
parameter HISTOGRAM_TOP = 8, // 2, // top
parameter HISTOGRAM_WIDTH = 6, // width
parameter HISTOGRAM_HEIGHT = 6, // height
parameter HISTOGRAM_ST
RA
T_PAGE = 20'h12345,
parameter HISTOGRAM_ST
AR
T_PAGE = 20'h12345,
parameter FRAME_WIDTH_ROUND_BITS = 9, // multiple of 512 pixels (32 16-byte bursts) (11 - ful SDRAM page)
parameter WOI_WIDTH= 64,
...
...
py393/x393_axi_control_status.py
View file @
72068ae7
...
...
@@ -36,13 +36,13 @@ from verilog_utils import hx
from
time
import
time
import
vrlg
enabled_channels
=
0
# currently enable channels
#
enabled_channels=0 # currently enable channels
cke_en
=
0
cmda_en
=
0
sdrst_on
=
1
mcntrl_en
=
0
refresh_en
=
0
channel_priority
=
[
None
]
*
16
#
channel_priority=[None]*16
sequences_set
=
0
class
X393AxiControlStatus
(
object
):
DRY_MODE
=
True
# True
...
...
@@ -68,16 +68,17 @@ class X393AxiControlStatus(object):
# Use 'import pickle' (exists in the camera) to save/restore state
def
init_state
(
self
):
global
enabled_channels
,
cke_en
,
cmda_en
,
sdrst_on
,
mcntrl_en
,
channel_priority
,
refresh_en
,
sequences_set
# global enabled_channels, cke_en, cmda_en, sdrst_on, mcntrl_en, channel_priority, refresh_en, sequences_set
global
cke_en
,
cmda_en
,
sdrst_on
,
mcntrl_en
,
refresh_en
,
sequences_set
"""
reset state (as after bitstream load)
"""
enabled_channels
=
0
# currently enable channels
#
enabled_channels=0 # currently enable channels
cke_en
=
0
cmda_en
=
0
sdrst_on
=
1
mcntrl_en
=
0
channel_priority
=
[
None
]
*
16
#
channel_priority=[None]*16
refresh_en
=
0
sequences_set
=
0
if
self
.
verbose
>
0
:
...
...
@@ -122,20 +123,28 @@ class X393AxiControlStatus(object):
print
(
"REFRESH EN =
%
d"
%
refresh_en
)
return
refresh_en
def
get_enabled_channels
(
self
,
quiet
=
1
):
global
enabled_channels
# global enabled_channels
enabled_channels
=
self
.
read_contol_register
(
vrlg
.
MCONTR_TOP_16BIT_ADDR
+
vrlg
.
MCONTR_TOP_16BIT_CHN_EN
)
if
quiet
<
2
:
print
(
"ENABLED_CHANNELS = 0x
%
x"
%
enabled_channels
)
return
enabled_channels
def
get_channel_priorities
(
self
,
quiet
=
1
):
global
channel_priority
# global channel_priority
channel_priority
=
[]
if
quiet
<
2
:
print
(
"CHANNEL PRIORITIES:"
,
end
=
" "
)
for
chn
in
range
(
16
):
v
=
self
.
read_contol_register
(
vrlg
.
MCONTR_ARBIT_ADDR
+
chn
)
print
(
"
%
d"
%
v
,
end
=
" "
)
channel_priority
.
append
(
v
)
"""
for v in channel_priority:
if v is None:
print (" - ",end=" ")
else:
print ("
%
d"
%
v,end=" ")
"""
print
()
return
channel_priority
...
...
@@ -145,8 +154,8 @@ class X393AxiControlStatus(object):
'cmda_en'
:
self
.
get_cmda_en
(
quiet
),
'sdrst_on'
:
self
.
get_sdrst_on
(
quiet
),
'mcntrl_en'
:
self
.
get_mcntrl_en
(
quiet
),
'enabled_channels'
:
self
.
get_enabled_channels
(
quiet
),
'channel_priorities'
:
self
.
get_channel_priorities
(
quiet
),
'enabled_channels'
:
self
.
get_enabled_channels
(
quiet
),
# updated
'channel_priorities'
:
self
.
get_channel_priorities
(
quiet
),
# updated
'refresh_en'
:
self
.
get_refresh_en
(
quiet
),
'sequences_set'
:
self
.
get_sequences_set
(
quiet
)
}
...
...
@@ -388,7 +397,7 @@ class X393AxiControlStatus(object):
Enable memory controller channels (all at once control)
<chnen> - 16-bit control word with per-channel enable bits (bit0 - chn0, ... bit15 - chn15)
"""
global
enabled_channels
#
global enabled_channels
enabled_channels
=
chnen
# currently enabled memory channels
self
.
write_contol_register
(
vrlg
.
MCONTR_TOP_16BIT_ADDR
+
vrlg
.
MCONTR_TOP_16BIT_CHN_EN
,
enabled_channels
&
0xffff
)
# {16'b0,chnen});
if
self
.
verbose
>
0
:
...
...
@@ -402,7 +411,9 @@ class X393AxiControlStatus(object):
<chn> - 4-bit channel select
<en> - 1 - enable, 0 - disable of the selected channel
"""
global
enabled_channels
# global enabled_channels
# Adding readback register
enabled_channels
=
self
.
read_contol_register
(
vrlg
.
MCONTR_TOP_16BIT_ADDR
+
vrlg
.
MCONTR_TOP_16BIT_CHN_EN
)
if
en
:
enabled_channels
|=
1
<<
chn
;
else
:
...
...
@@ -419,9 +430,9 @@ class X393AxiControlStatus(object):
<chn> - 4-bit channel select
<priority> - 16-bit priority value (higher value means more important)
"""
global
channel_priority
#
global channel_priority
self
.
write_contol_register
(
vrlg
.
MCONTR_ARBIT_ADDR
+
chn
,
priority
&
0xffff
)
# {16'b0,priority});
if
self
.
verbose
>
0
:
print
(
"SET CHANNEL
%
d priority=0x
%
x"
%
(
chn
,
priority
))
channel_priority
[
chn
]
=
priority
#
channel_priority[chn]=priority
py393/x393_cmprs.py
View file @
72068ae7
...
...
@@ -324,3 +324,93 @@ class X393Cmprs(object):
self
.
x393_axi_tasks
.
write_contol_register
(
base_addr
+
vrlg
.
MCNTRL_TILED_MODE
,
mode
);
def
compressor_run
(
self
,
# may use compressor_control with the same arguments
num_sensor
,
run_mode
):
"""
Compressor reset.run/single (alias of compressor_control)
@param num_sensor - sensor port number (0..3)
@param run_mode - 0 - reset, 2 - run single from memory, 3 - run repetitive
"""
self
.
compressor_control
(
num_sensor
=
num_sensor
,
# sensor channel number (0..3)
run_mode
=
run_mode
)
#0 - reset, 2 - run single from memory, 3 - run repetitive
def
setup_compressor_channel
(
self
,
num_sensor
,
qbank
,
dc_sub
,
cmode
,
multi_frame
,
bayer
,
focus_mode
,
num_macro_cols_m1
,
num_macro_rows_m1
,
left_margin
,
colorsat_blue
,
colorsat_red
,
coring
,
verbose
=
0
):
"""
@param num_sensor - sensor port number (0..3)
@param qbank - quantization table page (0..15)
@param dc_sub - True - subtract DC before running DCT, False - no subtraction, convert as is,
@param cmode - color mode:
CMPRS_CBIT_CMODE_JPEG18 = 0 - color 4:2:0
CMPRS_CBIT_CMODE_MONO6 = 1 - mono 4:2:0 (6 blocks)
CMPRS_CBIT_CMODE_JP46 = 2 - jp4, 6 blocks, original
CMPRS_CBIT_CMODE_JP46DC = 3 - jp4, 6 blocks, dc -improved
CMPRS_CBIT_CMODE_JPEG20 = 4 - mono, 4 blocks (but still not actual monochrome JPEG as the blocks are scanned in 2x2 macroblocks)
CMPRS_CBIT_CMODE_JP4 = 5 - jp4, 4 blocks, dc-improved
CMPRS_CBIT_CMODE_JP4DC = 6 - jp4, 4 blocks, dc-improved
CMPRS_CBIT_CMODE_JP4DIFF = 7 - jp4, 4 blocks, differential
CMPRS_CBIT_CMODE_JP4DIFFHDR = 8 - jp4, 4 blocks, differential, hdr
CMPRS_CBIT_CMODE_JP4DIFFDIV2 = 9 - jp4, 4 blocks, differential, divide by 2
CMPRS_CBIT_CMODE_JP4DIFFHDRDIV2 = 10 - jp4, 4 blocks, differential, hdr,divide by 2
CMPRS_CBIT_CMODE_MONO1 = 11 - mono JPEG (not yet implemented)
CMPRS_CBIT_CMODE_MONO4 = 14 - mono 4 blocks
@param multi_frame - False - single-frame buffer, True - multi-frame video memory buffer,
@param bayer - Bayer shift (0..3)
@param focus_mode - focus mode - how to combine image with "focus quality" in the result image
@param num_macro_cols_m1 - number of macroblock colums minus 1
@param num_macro_rows_m1 - number of macroblock rows minus 1
@param left_margin - left margin of the first pixel (0..31) for 32-pixel wide colums in memory access
@param colorsat_blue - color saturation for blue (10 bits), 0x90 for 100
%
@param colorsat_red - color saturation for red (10 bits), 0xb6 for 100
%
@param coring - coring value
@param verbose - verbose level
"""
if
verbose
>
0
:
print
(
"COMPRESSOR_SETUP"
)
print
(
"num_sensor = "
,
num_sensor
)
print
(
"qbank = "
,
qbank
)
print
(
"dc_sub = "
,
dc_sub
)
print
(
"cmode = "
,
cmode
)
print
(
"multi_frame = "
,
multi_frame
)
print
(
"bayer = "
,
bayer
)
print
(
"focus_mode = "
,
focus_mode
)
self
.
compressor_control
(
num_sensor
=
num_sensor
,
# sensor channel number (0..3)
qbank
=
qbank
,
# [6:3] quantization table page
dc_sub
=
dc_sub
,
# [8:7] subtract DC
cmode
=
cmode
,
# [13:9] color mode:
multi_frame
=
multi_frame
,
# [15:14] 0 - single-frame buffer, 1 - multiframe video memory buffer
bayer
=
bayer
,
# [20:18] # Bayer shift
focus_mode
=
focus_mode
)
# [23:21] Set focus mode
self
.
compressor_format
(
num_sensor
=
num_sensor
,
# sensor channel number (0..3)
num_macro_cols_m1
=
num_macro_cols_m1
,
# number of macroblock colums minus 1
num_macro_rows_m1
=
num_macro_rows_m1
,
# number of macroblock rows minus 1
left_margin
=
left_margin
)
# left margin of the first pixel (0..31) for 32-pixel wide colums in memory access
self
.
compressor_color_saturation
(
num_sensor
=
num_sensor
,
# sensor channel number (0..3)
colorsat_blue
=
colorsat_blue
,
# color saturation for blue (10 bits) #'h90 for 100%
colorsat_red
=
colorsat_red
)
# color saturation for red (10 bits) # 'b6 for 100%
self
.
compressor_coring
(
num_sensor
=
num_sensor
,
# sensor channel number (0..3)
coring
=
coring
);
# coring value
py393/x393_cmprs_afi.py
View file @
72068ae7
...
...
@@ -162,8 +162,8 @@ class X393CmprsAfi(object):
def
afi_mux_setup
(
self
,
port_afi
,
chn_mask
,
status_mode
=
3
,
report_mode
=
0
,
status_mode
,
#
= 3,
report_mode
,
#
= 0,
afi_cmprs0_sa
,
afi_cmprs0_len
,
afi_cmprs1_sa
,
...
...
py393/x393_sens_cmprs.py
View file @
72068ae7
...
...
@@ -100,4 +100,252 @@ class X393SensCmprs(object):
"""
with
open
(
POWER393_PATH
+
"/channels_"
+
(
"dis"
,
"en"
)[
power_on
],
"w"
)
as
f
:
print
((
"vcc_sens01 vp33sens01"
,
"vcc_sens23 vp33sens23"
)[
sub_pair
],
file
=
f
)
def
setup_sensor_channel
(
self
,
num_sensor
,
frame_full_width
,
# 13-bit Padded line length (8-row increment), in 8-bursts (16 bytes)
window_width
,
# 13 bit - in 8*16=128 bit bursts
window_height
,
# 16 bit
window_left
,
window_top
,
frame_start_address
,
frame_start_address_inc
,
last_buf_frame
,
colorsat_blue
,
colorsat_red
,
clk_sel
,
histogram_start_phys_page
,
histogram_left
=
0
,
histogram_top
=
0
,
histogram_width_m1
=
0
,
histogram_height_m1
=
0
,
verbose
=
1
):
"""
Setup one sensor+compressor channel (for one sub-channel only)
@param num_sensor - sensor port number (0..3)
@param frame_full_width - 13-bit Padded line length (8-row increment), in 8-bursts (16 bytes)
@param window_width - (here - in pixels)
@param window_height - 16-bit window height in scan lines
@param window_left - left margin of the window (here - in pixels)
@param window_top - top margin of the window (16 bit)
@param frame_start_address - 22-bit frame start address ((3 CA LSBs==0. BA==0)
@param frame_start_address_inc - 22-bit frame start address increment ((3 CA LSBs==0. BA==0)
@param last_buf_frame) - 16-bit number of the last frame in a buffer
@param colorsat_blue - color saturation for blue (10 bits), 0x90 for 100
%
@param colorsat_red - color saturation for red (10 bits), 0xb6 for 100
%
@param clk_sel - True - use pixel clock from the sensor, False - use internal clock (provided to the sensor), None - no chnage
@param histogram_start_phys_page - system memory 4K page number to start histogram
@param histogram_left - histogram window left margin
@param histogram_top - histogram window top margin
@param histogram_width_m1 - one less than window width. If 0 - use frame right margin (end of HACT)
@param histogram_height_m1 - one less than window height. If 0 - use frame bottom margin (end of VACT)
???
@parame verbose - verbose level
"""
if
verbose
>
0
:
print
(
"setup_sensor_channel:"
)
print
(
"num_sensor = "
,
num_sensor
)
print
(
"frame_full_width = "
,
frame_full_width
)
print
(
"window_width = "
,
window_width
)
print
(
"window_height = "
,
window_height
)
print
(
"window_left = "
,
window_left
)
print
(
"window_top = "
,
window_top
)
print
(
"frame_start_address = "
,
frame_start_address
)
print
(
"frame_start_address_inc = "
,
frame_start_address_inc
)
print
(
"last_buf_frame = "
,
last_buf_frame
)
print
(
"verbose = "
,
verbose
)
self
.
x393Sensor
.
program_status_sensor_i2c
(
num_sensor
=
num_sensor
,
# input [1:0] num_sensor;
mode
=
3
,
# input [1:0] mode;
seq_num
=
0
);
# input [5:0] seq_num;
self
.
x393Sensor
.
program_status_sensor_io
(
num_sensor
=
num_sensor
,
# input [1:0] num_sensor;
mode
=
3
,
# input [1:0] mode;
seq_num
=
0
);
# input [5:0] seq_num;
self
.
x393Cmprs
.
program_status_compressor
(
num_sensor
=
num_sensor
,
# input [1:0] num_sensor;
mode
=
3
,
# input [1:0] mode;
seq_num
=
0
);
# input [5:0] seq_num;
# moved before camsync to have a valid timestamo w/o special waiting
if
verbose
>
0
:
print
(
"===================== MEMORY_SENSOR ========================="
)
self
.
x393Sensor
.
setup_sensor_memory
(
num_sensor
=
num_sensor
,
# input [1:0] num_sensor;
frame_sa
=
frame_start_address
,
# input [31:0] frame_sa; # 22-bit frame start address ((3 CA LSBs==0. BA==0)
frame_sa_inc
=
frame_start_address_inc
,
# input [31:0] frame_sa_inc; # 22-bit frame start address increment ((3 CA LSBs==0. BA==0)
last_frame_num
=
last_buf_frame
,
# input [31:0] last_frame_num; # 16-bit number of the last frame in a buffer
frame_full_width
=
frame_full_width
,
# input [31:0] frame_full_width; # 13-bit Padded line length (8-row increment), in 8-bursts (16 bytes)
window_width
=
window_width
>>
4
,
# input [31:0] window_width; # 13 bit - in 8*16=128 bit bursts
window_height
=
window_height
,
# input [31:0] window_height; # 16 bit
window_left
=
window_left
>>
4
,
# input [31:0] window_left;
window_top
=
window_top
);
# input [31:0] window_top;
# Enable arbitration of sensor-to-memory controller
self
.
x393_axi_tasks
.
enable_memcntrl_en_dis
(
8
+
num_sensor
,
True
);
self
.
x393Cmprs
.
compressor_control
(
chn
=
num_sensor
,
run_mode
=
0
)
# reset compressor
#TODO: Calculate from the image size?
num_macro_cols_m1
=
3
num_macro_rows_m1
=
1
left_margin
=
1
self
.
x393Cmprs
.
setup_compressor_channel
(
num_sensor
=
num_sensor
,
qbank
=
0
,
dc_sub
=
True
,
cmode
=
vrlg
.
CMPRS_CBIT_CMODE_JPEG18
,
multi_frame
=
True
,
bayer
=
0
,
focus_mode
=
0
,
num_macro_cols_m1
=
num_macro_cols_m1
,
num_macro_rows_m1
=
num_macro_rows_m1
,
left_margin
=
left_margin
,
colorsat_blue
=
colorsat_blue
,
colorsat_red
=
colorsat_red
,
coring
=
0
,
verbose
=
verbose
)
# TODO: calculate widths correctly!
self
.
x393Cmprs
.
setup_compressor_memory
(
num_sensor
=
num_sensor
,
frame_sa
=
frame_start_address
,
# input [31:0] frame_sa; # 22-bit frame start address ((3 CA LSBs==0. BA==0)
frame_sa_inc
=
frame_start_address_inc
,
# input [31:0] frame_sa_inc; # 22-bit frame start address increment ((3 CA LSBs==0. BA==0)
last_frame_num
=
last_buf_frame
,
# input [31:0] last_frame_num; # 16-bit number of the last frame in a buffer
frame_full_width
=
frame_full_width
,
# input [31:0] frame_full_width; # 13-bit Padded line length (8-row increment), in 8-bursts (16 bytes)
window_width
=
window_width
>>
4
,
# input [31:0] window_width; # 13 bit - in 8*16=128 bit bursts
window_height
=
window_height
,
# input [31:0] window_height; # 16 bit
window_left
=
window_left
>>
4
,
# input [31:0] window_left;
window_top
=
window_top
,
# input [31:0] window_top;
byte32
=
1
,
tile_width
=
2
,
extra_pages
=
1
,
disable_need
=
1
)
self
.
x393Cmprs
.
compressor_control
(
num_sensor
=
num_sensor
,
run_mode
=
3
)
# run repetitive mode
#Set up delays separately, outside of this method
"""
if verbose >0 :
print ("===================== DELAYS_SETUP =========================")
self.x393Sensor.set_sensor_io_dly (
num_sensor = num_sensor,
mmcm_phase = 0,
iclk_dly = 0,
vact_dly = 0,
hact_dly = 0,
pxd_dly = 0)
self.x393Sensor.set_sensor_io_ctl (
quadrants = vrlg.QUADRANTS_PXD_HACT_VACT)
"""
if
verbose
>
0
:
print
(
"===================== IO_SETUP ========================="
)
self
.
x393Sensor
.
set_sensor_io_width
(
num_sensor
=
num_sensor
,
# input [1:0] num_sensor;
width
=
0
)
# Or use 0 for sensor-generated HACT input [15:0] width; # 0 - use HACT, >0 - generate HACT from start to specified width
self
.
x393Sensor
.
set_sensor_io_ctl
(
num_sensor
=
num_sensor
,
mrst
=
False
,
arst
=
False
,
aro
=
False
,
mmcm_rst
=
True
,
#reset mmcm
clk_sel
=
clk_sel
,
set_delays
=
False
,
quadrants
=
None
)
self
.
x393Sensor
.
set_sensor_io_ctl
(
num_sensor
=
num_sensor
,
mmcm_rst
=
False
,
# release MMCM reset (maybe wait longer?
clk_sel
=
clk_sel
,
set_delays
=
False
,
quadrants
=
None
)
"""
if verbose >0 :
print ("===================== I2C_TEST =========================")
self.x393Sensor.test_i2c_353() # test soft/sequencer i2c
"""
if
verbose
>
0
:
print
(
"===================== LENS_FLAT_SETUP ========================="
)
self
.
x393Sensor
.
set_sensor_lens_flat_heights
(
self
,
num_sensor
=
num_sensor
,
height0_m1
=
0xffff
,
height1_m1
=
None
,
height2_m1
=
None
)
self
.
x393Sensor
.
set_sensor_lens_flat_parameters
(
num_sensor
=
num_sensor
,
num_sub_sensor
=
0
,
AX
=
0
,
# 0x20000,
AY
=
0
,
# 0x20000
BX
=
0
,
# 0x180000
BY
=
0
,
# 0x180000
C
=
0
,
# 0x8000
scales0
=
0x8000
,
scales1
=
0x8000
,
scales2
=
0x8000
,
scales3
=
0x8000
,
fatzero_in
=
0
,
fatzero_out
=
0
,
post_scale
=
1
)
if
verbose
>
0
:
print
(
"===================== GAMMA_SETUP ========================="
)
self
.
x393Sensor
.
set_sensor_gamma_heights
(
self
,
num_sensor
=
num_sensor
,
height0_m1
=
0xffff
,
height1_m1
=
0
,
height2_m1
=
0
)
# Configure histograms
if
verbose
>
0
:
print
(
"===================== HISTOGRAMS_SETUP ========================="
)
self
.
x393Sensor
.
set_sensor_histogram_window
(
# 353 did it using command sequencer)
num_sensor
=
num_sensor
,
num_sub_sensor
=
0
,
left
=
histogram_left
,
top
=
histogram_top
,
width_m1
=
histogram_width_m1
,
height_m1
=
histogram_height_m1
)
self
.
x393Sensor
.
set_sensor_histogram_saxi_addr
(
num_sensor
=
num_sensor
,
subchannel
=
0
,
page
=
histogram_start_phys_page
)
self
.
x393Sensor
.
set_sensor_histogram_saxi
(
en
=
True
,
nrst
=
True
,
confirm_write
=
True
,
cache_mode
=
3
)
# Run after histogram channel is set up?
if
verbose
>
0
:
print
(
"===================== SENSOR_SETUP ========================="
)
self
.
x393Sensor
.
set_sensor_mode
(
num_sensor
=
num_sensor
,
hist_en
=
1
,
# bitmask, only first subchannel
hist_nrst
=
1
,
# bitmask, only first subchannel
chn_en
=
True
,
bits16
=
False
)
if
verbose
>
0
:
print
(
"===================== CMPRS_EN_ARBIT ========================="
)
# just temporarily - enable channel immediately
self
.
x393_axi_tasks
.
enable_memcntrl_en_dis
(
12
+
num_sensor
,
True
);
if
verbose
>
0
:
print
(
"===================== GAMMA_CTL ========================="
)
self
.
x393Sensor
.
set_sensor_gamma_ctl
(
# doing last to enable sesnor data when everything else is set up
num_sensor
=
num_sensor
,
# input [1:0] num_sensor; # sensor channel number (0..3)
bayer
=
0
,
table_page
=
0
,
en_input
=
True
,
repet_mode
=
True
,
# Normal mode, single trigger - just for debugging TODO: re-assign?
trig
=
False
)
\ No newline at end of file
py393/x393_sensor.py
View file @
72068ae7
...
...
@@ -346,13 +346,13 @@ class X393Sensor(object):
def
set_sensor_io_ctl
(
self
,
num_sensor
,
mrst
=
None
,
arst
=
None
,
aro
=
None
,
mmcm_rst
=
None
,
clk_sel
=
None
,
mrst
=
None
,
arst
=
None
,
aro
=
None
,
mmcm_rst
=
None
,
clk_sel
=
None
,
set_delays
=
False
,
quadrants
=
None
):
quadrants
=
None
):
"""
Set sensor I/O controls, including I/O signals
@param num_sensor - sensor port number (0..3)
...
...
@@ -734,3 +734,5 @@ class X393Sensor(object):
((
window_top
&
0xffff
)
<<
16
)
|
(
window_left
&
0xffff
))
#WINDOW_X0+ (WINDOW_Y0<<16));
self
.
x393_axi_tasks
.
write_contol_register
(
base_addr
+
vrlg
.
MCNTRL_SCANLINE_WINDOW_STARTXY
,
0
)
self
.
x393_axi_tasks
.
write_contol_register
(
base_addr
+
vrlg
.
MCNTRL_SCANLINE_MODE
,
mode
)
py393/x393_utils.py
View file @
72068ae7
...
...
@@ -51,7 +51,7 @@ class X393Utils(object):
DEBUG_MODE
=
1
# vpars=None
x393_mem
=
None
enabled_channels
=
0
# currently enabled channels
#
enabled_channels=0 # currently enabled channels
saveFileName
=
None
x393_axi_tasks
=
None
# verbose=1
...
...
x393_testbench02.tf
View file @
72068ae7
...
...
@@ -2072,7 +2072,7 @@ task write_block_scanline_chn; // SuppressThisWarning VEditor : may be unused
// write_block_incremtal (start_addr, num_bursts << 2, (startX<<2) + (startY<<16)); // 1 of startX is 8x16 bit, 16 bytes or 4 32-bit words
end
endtask
// x393_mcntrl (no class)
function [11:0] func_encode_mode_tiled; // SuppressThisWarning VEditor - not used
input disable_need;
input repetitive;
...
...
@@ -2103,6 +2103,7 @@ function [11:0] func_encode_mode_tiled; // SuppressThisWarning VEditor - not us
func_encode_mode_tiled = rslt;
end
endfunction
// x393_mcntrl (no class)
function [11:0] func_encode_mode_scanline; // SuppressThisWarning VEditor - not used
input disable_need;
input repetitive;
...
...
@@ -2132,6 +2133,7 @@ endfunction
// Sensor - related tasks and functions
// x393_sens_cmprs.py
task setup_sensor_channel;
input [1:0] num_sensor;
...
...
@@ -2205,6 +2207,7 @@ task setup_sensor_channel;
// Enable arbitration of sensor-to-memory controller
enable_memcntrl_en_dis
(
4
'h8 + {2'
b0
,
num_sensor
},
1
);
// write_contol_register(MCONTR_TOP_16BIT_ADDR + MCONTR_TOP_16BIT_CHN_EN, {16'b0,ENABLED_CHANNELS});
compressor_run
(
num_sensor
,
0
);
// reset compressor
...
...
@@ -2386,7 +2389,7 @@ task setup_sensor_channel;
set_sensor_histogram_saxi_addr (
num_sensor, // input [1:0] num_sensor; // sensor channel number (0..3)
0, // input [1:0] subchannel; // subchannel number (for multiplexed images)
HISTOGRAM_ST
RA
T_PAGE); // input [19:0] page; //start address in 4KB pages (1 page - one subchannel histogram)
HISTOGRAM_ST
AR
T_PAGE); // input [19:0] page; //start address in 4KB pages (1 page - one subchannel histogram)
set_sensor_histogram_saxi (
1'
b1
,
// input en;
...
...
@@ -2498,6 +2501,8 @@ task write_cmd_frame_sequencer;
// temporarily putting in the very end as it takes about 30 usec to program curves (TODO: see how to make it faster for simulation)
end
endtask
//x393_camsync.py
task camsync_setup;
input [3:0] sensor_mask;
...
...
@@ -2640,6 +2645,7 @@ task afi_mux_setup;
end
endtask
//x393_cmprs.py
task setup_compressor_channel;
input [ 1:0] num_sensor; // sensor channel number (0..3)
input [31:0] qbank; // [6:3] quantization table page
...
...
@@ -2699,9 +2705,10 @@ task setup_compressor_channel;
end
endtask
// x393_cmprs.py
task compressor_run;
input [ 1:0] num_sensor; // sensor channel number (0..3)
input [31:0] run_mode;
// [6:3] quantization table pag
e
input [31:0] run_mode;
// input [31:0] run_mode; // [2:0] < 0: nop, 0 - reset, 2 - run single from memory, 3 - run repetitiv
e
begin
compressor_control(
num_sensor, // sensor channel number (0..3)
...
...
@@ -2716,7 +2723,7 @@ task compressor_run;
endtask
// x393_sensor.py
task setup_sensor_memory;
input [1:0] num_sensor;
input [31:0] frame_sa; // 22-bit frame start address ((3 CA LSBs==0. BA==0)
...
...
@@ -2751,7 +2758,7 @@ task setup_sensor_memory;
write_contol_register(base_addr + MCNTRL_SCANLINE_MODE, mode);
end
endtask
// x393_cmprs.py
task setup_compressor_memory;
input [1:0] num_sensor;
input [31:0]frame_sa; // 22-bit frame start address ((3 CA LSBs==0. BA==0)
...
...
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