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
eb0f6b26
Commit
eb0f6b26
authored
Oct 29, 2016
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added EOF/SOF swoitch for i2c sequencer, bitstream version c4
parent
28c07f7d
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
113 additions
and
28 deletions
+113
-28
x393_cocotb_03.sav
cocotb/x393_cocotb_03.sav
+56
-10
fpga_version.vh
fpga_version.vh
+3
-2
x393_parameters.vh
includes/x393_parameters.vh
+1
-0
x393_export_c.py
py393/x393_export_c.py
+1
-0
x393_jpeg.py
py393/x393_jpeg.py
+4
-0
x393_sensor.py
py393/x393_sensor.py
+10
-0
sensor_channel.v
sensor/sensor_channel.v
+14
-10
sensor_i2c.v
sensor/sensor_i2c.v
+17
-5
sensor_i2c_io.v
sensor/sensor_i2c_io.v
+5
-1
sensors393.v
sensor/sensors393.v
+2
-0
x393_parallel.bit
x393_parallel.bit
+0
-0
No files found.
cocotb/x393_cocotb_03.sav
View file @
eb0f6b26
[*]
[*] GTKWave Analyzer v3.3.66 (w)1999-2015 BSI
[*]
Thu Oct 27 01:40:51
2016
[*]
Sat Oct 29 21:44:32
2016
[*]
[dumpfile] "/home/eyesis/git/x393-neon/simulation/x393_dut-2016102
6180017757
.fst"
[dumpfile_mtime] "
Thu Oct 27 01:39:08
2016"
[dumpfile_size] 4
18439836
[dumpfile] "/home/eyesis/git/x393-neon/simulation/x393_dut-2016102
8224636205
.fst"
[dumpfile_mtime] "
Sat Oct 29 06:54:57
2016"
[dumpfile_size] 4
87758287
[savefile] "/home/eyesis/git/x393-neon/cocotb/x393_cocotb_03.sav"
[timestart] 0
[size] 1814 1171
[pos] 0 0
*-2
7.006804 350100000 53094051 136169617 216213845
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
*-2
5.418884 64300000 53094051 136169617 426878253
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
[treeopen] x393_dut.
[treeopen] x393_dut.simul_sensor12bits_2_i.
[treeopen] x393_dut.simul_sensor12bits_3_i.
...
...
@@ -25,10 +25,14 @@
[treeopen] x393_dut.x393_i.event_logger_i.i_logger_arbiter.
[treeopen] x393_dut.x393_i.event_logger_i.i_nmea_decoder.
[treeopen] x393_dut.x393_i.event_logger_i.i_rs232_rcv.
[treeopen] x393_dut.x393_i.frame_sequencer_block[0].
[treeopen] x393_dut.x393_i.frame_sequencer_block[0].cmd_frame_sequencer_i.
[treeopen] x393_dut.x393_i.mult_saxi_wr_i.mult_saxi_wr_pointers_i.
[treeopen] x393_dut.x393_i.sensors393_i.
[treeopen] x393_dut.x393_i.sensors393_i.sensor_channel_block[0].
[treeopen] x393_dut.x393_i.sensors393_i.sensor_channel_block[0].sensor_channel_i.
[treeopen] x393_dut.x393_i.sensors393_i.sensor_channel_block[0].sensor_channel_i.sensor_i2c_io_i.
[treeopen] x393_dut.x393_i.sensors393_i.sensor_channel_block[0].sensor_channel_i.sensor_i2c_io_i.sensor_i2c_i.
[treeopen] x393_dut.x393_i.sensors393_i.sensor_channel_block[1].sensor_channel_i.
[treeopen] x393_dut.x393_i.sensors393_i.sensor_channel_block[1].sensor_channel_i.sens_sync_i.
[treeopen] x393_dut.x393_i.sensors393_i.sensor_channel_block[2].
...
...
@@ -41,7 +45,7 @@
[treeopen] x393_dut.x393_i.sensors393_i.sensor_channel_block[3].sensor_channel_i.sens_sync_i.
[treeopen] x393_dut.x393_i.timing393_i.
[treeopen] x393_dut.x393_i.timing393_i.camsync393_i.
[sst_width]
282
[sst_width]
307
[signals_width] 319
[sst_expanded] 1
[sst_vpaned_height] 486
...
...
@@ -1907,9 +1911,9 @@ x393_dut.x393_i.timing393_i.camsync393_i.trigger_condition
x393_dut.x393_i.timing393_i.camsync393_i.trigger_condition_filtered
@22
x393_dut.x393_i.timing393_i.camsync393_i.input_pattern[9:0]
@c0002
3
@c0002
2
x393_dut.x393_i.timing393_i.camsync393_i.input_use[9:0]
@2
9
@2
8
(0)x393_dut.x393_i.timing393_i.camsync393_i.input_use[9:0]
(1)x393_dut.x393_i.timing393_i.camsync393_i.input_use[9:0]
(2)x393_dut.x393_i.timing393_i.camsync393_i.input_use[9:0]
...
...
@@ -1920,15 +1924,57 @@ x393_dut.x393_i.timing393_i.camsync393_i.input_use[9:0]
(7)x393_dut.x393_i.timing393_i.camsync393_i.input_use[9:0]
(8)x393_dut.x393_i.timing393_i.camsync393_i.input_use[9:0]
(9)x393_dut.x393_i.timing393_i.camsync393_i.input_use[9:0]
@140120
1
@140120
0
-group_end
@1001200
-group_end
-group_end
-group_end
@1000200
-camsync_ext_int
@800200
-sequencers_0
-cmd_frame_seq0
@28
x393_dut.x393_i.frame_sequencer_block[0].cmd_frame_sequencer_i.frame_sync
@22
x393_dut.x393_i.frame_sequencer_block[0].cmd_frame_sequencer_i.frame_no[3:0]
@1000200
-cmd_frame_seq0
@800200
-i2c_seq_0
@28
x393_dut.x393_i.sensors393_i.sensor_channel_block[0].sensor_channel_i.sensor_i2c_io_i.sensor_i2c_i.frame_sync
x393_dut.x393_i.sensors393_i.sensor_channel_block[0].sensor_channel_i.sensor_i2c_io_i.sensor_i2c_i.req_clr
@c00028
x393_dut.x393_i.sensors393_i.sensor_channel_block[0].sensor_channel_i.sensor_i2c_io_i.sensor_i2c_i.wpage0_inc[1:0]
@28
(0)x393_dut.x393_i.sensors393_i.sensor_channel_block[0].sensor_channel_i.sensor_i2c_io_i.sensor_i2c_i.wpage0_inc[1:0]
(1)x393_dut.x393_i.sensors393_i.sensor_channel_block[0].sensor_channel_i.sensor_i2c_io_i.sensor_i2c_i.wpage0_inc[1:0]
@1401200
-group_end
@28
x393_dut.x393_i.sensors393_i.sensor_channel_block[0].sensor_channel_i.sensor_i2c_io_i.sensor_i2c_i.sync_to_seq
@29
x393_dut.x393_i.sensors393_i.sensor_channel_block[0].sensor_channel_i.sensor_i2c_io_i.sensor_i2c_i.sync_to_eof
@22
x393_dut.x393_i.sensors393_i.sensor_channel_block[0].sensor_channel_i.sensor_i2c_io_i.sensor_i2c_i.frame_num_seq[3:0]
x393_dut.x393_i.sensors393_i.sensor_channel_block[0].sensor_channel_i.sensor_i2c_io_i.sensor_i2c_i.frame_num[3:0]
@28
x393_dut.x393_i.sensors393_i.sensor_channel_block[0].sensor_channel_i.sensor_i2c_io_i.sensor_i2c_i.eof_mclk
x393_dut.x393_i.sensors393_i.sensor_channel_block[0].sensor_channel_i.sensor_i2c_io_i.sensor_i2c_i.use_eof
@1000200
-i2c_seq_0
@800200
-sensor_channel0
@200
-
@28
x393_dut.x393_i.sensors393_i.sensor_channel_block[0].sensor_channel_i.eof_mclk
x393_dut.x393_i.sensors393_i.sensor_channel_block[0].sensor_channel_i.eof_out
x393_dut.x393_i.sensors393_i.sensor_channel_block[0].sensor_channel_i.eof_out_r
@1000200
-camsync_ext_int
-sensor_channel0
-sequencers_0
[pattern_trace] 1
[pattern_trace] 0
fpga_version.vh
View file @
eb0f6b26
...
...
@@ -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'h039300c3; //parallel - fixing timestamps
parameter FPGA_VERSION = 32'h039300c4; //parallel - option to use EOF for i2c sequencer timing met, 79.66%
// parameter FPGA_VERSION = 32'h039300c3; //parallel - fixing timestamps -0.209/47, 79.86%
// parameter FPGA_VERSION = 32'h039300c2; //parallel - external sync for Eyesis -0.160/71 79.84%
// parameter FPGA_VERSION = 32'h039300c1; //parallel - modified after troubleshooting simulation -0.069/41, 79.90 %
// parameter FPGA_VERSION = 32'h039300c0; //parallel - changing LOGGER_PAGE_IMU 3->0 (how it was in 353) -0.044/16, 79.59%
...
...
includes/x393_parameters.vh
View file @
eb0f6b26
...
...
@@ -386,6 +386,7 @@
parameter SENSI2C_CMD_RUN = 13, // [13:12]3 - run i2c, 2 - stop i2c (needed before software i2c), 1,0 - no change to run state
parameter SENSI2C_CMD_RUN_PBITS = 1,
parameter SENSI2C_CMD_USE_EOF = 8, // [9:8] - 0: advance sequencer at SOF, 1 - advance sequencer at EOF
parameter SENSI2C_CMD_SOFT_SDA = 6, // [7:6] - SDA software control: 0 - nop, 1 - low, 2 - active high, 3 - float
parameter SENSI2C_CMD_SOFT_SCL = 4, // [5:4] - SCL software control: 0 - nop, 1 - low, 2 - active high, 3 - float
...
...
py393/x393_export_c.py
View file @
eb0f6b26
...
...
@@ -1900,6 +1900,7 @@ class X393ExportC(object):
dw
.
append
((
"soft_scl"
,
vrlg
.
SENSI2C_CMD_SOFT_SCL
,
2
,
0
,
"Control SCL pin (when stopped): 0 - nop, 1 - low, 2 - high (driven), 3 - float "
))
dw
.
append
((
"soft_sda"
,
vrlg
.
SENSI2C_CMD_SOFT_SDA
,
2
,
0
,
"Control SDA pin (when stopped): 0 - nop, 1 - low, 2 - high (driven), 3 - float "
))
dw
.
append
((
"eof_not_sof"
,
vrlg
.
SENSI2C_CMD_USE_EOF
,
2
,
0
,
"Advance I2C sequencer: 0 - SOF, 1 - EOF"
))
dw
.
append
((
"cmd_run"
,
vrlg
.
SENSI2C_CMD_RUN
-
1
,
2
,
0
,
"Sequencer run/stop control: 0,1 - nop, 2 - stop, 3 - run "
))
dw
.
append
((
"reset"
,
vrlg
.
SENSI2C_CMD_RESET
,
1
,
0
,
"Sequencer reset all FIFO (takes 16 clock pulses), also - stops i2c until run command"
))
...
...
py393/x393_jpeg.py
View file @
eb0f6b26
...
...
@@ -2280,6 +2280,10 @@ jpeg_sim_multi 8
measure_all "*DI"
setup_all_sensors True None 0xf
set_sensor_io_ctl all None None 1 # Set ARO low - check if it is still needed?
#use EOF instead of SOF for i2c sequencer advance
set_sensor_i2c_command all False None None None None None None True
#just testing
set_gpio_ports 1 1 # enable software gpio pins and porta (camsync)
set_gpio_pins 0 1 # pin 0 low, pin 1 - high
...
...
py393/x393_sensor.py
View file @
eb0f6b26
...
...
@@ -287,6 +287,7 @@ class X393Sensor(object):
advance_FIFO
=
None
,
sda
=
None
,
scl
=
None
,
use_eof
=
None
,
verbose
=
1
):
"""
@param rst_cmd - reset all FIFO (takes 16 clock pulses), also - stops i2c until run command
...
...
@@ -296,6 +297,7 @@ class X393Sensor(object):
@param advance_FIFO - advance i2c read FIFO
@param sda - control SDA line (stopped mode only): I<nput>, L<ow> or 0, High or 1
@param scl - control SCL line (stopped mode only): I<nput>, L<ow> or 0, High or 1
@param use_eof - advance sequencer at EOF, not at SOF
@param verbose - verbose level
@return combined command word.
active_sda and early_release_0 should be defined both to take effect (any of the None skips setting these parameters)
...
...
@@ -338,6 +340,10 @@ class X393Sensor(object):
rslt
|=
1
<<
vrlg
.
SENSI2C_CMD_ACIVE
if
advance_FIFO
:
rslt
|=
1
<<
vrlg
.
SENSI2C_CMD_FIFO_RD
if
not
use_eof
is
None
:
rslt
|=
1
<<
(
vrlg
.
SENSI2C_CMD_USE_EOF
+
1
)
rslt
|=
(
0
,
1
)[
use_eof
]
<<
(
vrlg
.
SENSI2C_CMD_USE_EOF
)
rslt
|=
parse_sda_scl
(
sda
)
<<
vrlg
.
SENSI2C_CMD_SOFT_SDA
rslt
|=
parse_sda_scl
(
scl
)
<<
vrlg
.
SENSI2C_CMD_SOFT_SCL
if
verbose
>
0
:
...
...
@@ -554,6 +560,7 @@ class X393Sensor(object):
advance_FIFO
=
None
,
sda
=
None
,
scl
=
None
,
use_eof
=
None
,
verbose
=
1
):
"""
@param num_sensor - sensor port number (0..3) or all
...
...
@@ -564,6 +571,7 @@ class X393Sensor(object):
@param advance_FIFO - advance i2c read FIFO
@param sda - control SDA line (stopped mode only): I<nput>, L<ow> or 0, High or 1
@param scl - control SCL line (stopped mode only): I<nput>, L<ow> or 0, High or 1
@param use_eof - advance sequencer at EOF, not at SOF
@param verbose - verbose level
active_sda and early_release_0 should be defined both to take effect (any of the None skips setting these parameters)
...
...
@@ -579,6 +587,7 @@ class X393Sensor(object):
advance_FIFO
=
advance_FIFO
,
sda
=
sda
,
scl
=
scl
,
use_eof
=
use_eof
,
verbose
=
verbose
)
return
...
...
@@ -595,6 +604,7 @@ class X393Sensor(object):
advance_FIFO
=
advance_FIFO
,
sda
=
sda
,
scl
=
scl
,
use_eof
=
use_eof
,
verbose
=
verbose
-
1
))
def
set_sensor_i2c_table_reg_wr
(
self
,
...
...
sensor/sensor_channel.v
View file @
eb0f6b26
...
...
@@ -90,6 +90,7 @@ module sensor_channel#(
parameter
SENSI2C_CMD_RESET
=
14
,
// [14] reset all FIFO (takes 16 clock pulses), also - stops i2c until run command
parameter
SENSI2C_CMD_RUN
=
13
,
// [13:12]3 - run i2c, 2 - stop i2c (needed before software i2c), 1,0 - no change to run state
parameter
SENSI2C_CMD_RUN_PBITS
=
1
,
parameter
SENSI2C_CMD_USE_EOF
=
8
,
// [9:8] - 0: advance sequencer at SOF, 1 - advance sequencer at EOF
parameter
SENSI2C_CMD_SOFT_SDA
=
6
,
// [7:6] - SDA software control: 0 - nop, 1 - low, 2 - active high, 3 - float
parameter
SENSI2C_CMD_SOFT_SCL
=
4
,
// [5:4] - SCL software control: 0 - nop, 1 - low, 2 - active high, 3 - float
parameter
SENSI2C_CMD_FIFO_RD
=
3
,
// advance I2C read data FIFO by 1
...
...
@@ -416,6 +417,7 @@ module sensor_channel#(
wire
hact
;
// line active @posedge ipclk
wire
sof
;
// start of frame
wire
eof
;
// end of frame
wire
eof_mclk
;
// to be used by i2c sequencer
wire
sof_out_sync
;
// sof filtetred, optionally decimated (for linescan mode)
...
...
@@ -644,6 +646,7 @@ module sensor_channel#(
.
SENSI2C_CMD_RESET
(
SENSI2C_CMD_RESET
)
,
.
SENSI2C_CMD_RUN
(
SENSI2C_CMD_RUN
)
,
.
SENSI2C_CMD_RUN_PBITS
(
SENSI2C_CMD_RUN_PBITS
)
,
.
SENSI2C_CMD_USE_EOF
(
SENSI2C_CMD_USE_EOF
)
,
.
SENSI2C_CMD_SOFT_SDA
(
SENSI2C_CMD_SOFT_SDA
)
,
.
SENSI2C_CMD_SOFT_SCL
(
SENSI2C_CMD_SOFT_SCL
)
,
.
SENSI2C_CMD_FIFO_RD
(
SENSI2C_CMD_FIFO_RD
)
,
...
...
@@ -676,6 +679,8 @@ module sensor_channel#(
.
status_rq
(
sens_i2c_status_rq
)
,
// output
.
status_start
(
sens_i2c_status_start
)
,
// input
.
frame_sync
(
sof_out_mclk
)
,
// input
.
eof_mclk
(
eof_mclk
)
,
// End of frame for i2c sequencer (will not work for linescan mode: either disable or make
// division as in sof_out_mclk
.
frame_num_seq
(
frame_num_seq
)
,
// input[3:0]
.
scl
(
sns_scl
)
,
// inout
.
sda
(
sns_sda
)
// inout
...
...
@@ -692,7 +697,7 @@ module sensor_channel#(
reg
hist_gr0_r
;
wire
sol_mclk
;
wire
sof_mclk
;
wire
eof_mclk
;
//
wire eof_mclk;
wire
alive_hist0_rq
=
hist_rq
[
0
]
&&
!
hist_rq0_r
;
wire
alive_hist0_gr
=
hist_gr
[
0
]
&&
!
hist_gr0_r
;
// sof_out_mclk - already exists
...
...
@@ -739,15 +744,6 @@ module sensor_channel#(
.
busy
()
// output
)
;
pulse_cross_clock
pulse_cross_clock_eof_mclk_i
(
// .rst (prst), // input
.
rst
(
prsts
)
,
// input extended to include sensor reset and rst_mmcm
.
src_clk
(
pclk
)
,
// input
.
dst_clk
(
mclk
)
,
// input
.
in_pulse
(
eof
)
,
// input
.
out_pulse
(
eof_mclk
)
,
// output
.
busy
()
// output
)
;
pulse_cross_clock
pulse_cross_clock_dout_valid_1cyc_mclk_i
(
// .rst (prst), // input
...
...
@@ -771,6 +767,14 @@ module sensor_channel#(
`endif
pulse_cross_clock
pulse_cross_clock_eof_mclk_i
(
.
rst
(
prsts
)
,
// input extended to include sensor reset and rst_mmcm
.
src_clk
(
pclk
)
,
// input
.
dst_clk
(
mclk
)
,
// input
.
in_pulse
(
eof
)
,
// input
.
out_pulse
(
eof_mclk
)
,
// output
.
busy
()
// output
)
;
...
...
sensor/sensor_i2c.v
View file @
eb0f6b26
...
...
@@ -53,6 +53,7 @@ module sensor_i2c#(
parameter
SENSI2C_CMD_RESET
=
14
,
// [14] reset all FIFO (takes 16 clock pulses), also - stops i2c until run command
parameter
SENSI2C_CMD_RUN
=
13
,
// [13:12]3 - run i2c, 2 - stop i2c (needed before software i2c), 1,0 - no change to run state
parameter
SENSI2C_CMD_RUN_PBITS
=
1
,
parameter
SENSI2C_CMD_USE_EOF
=
8
,
// [9:8] - 0: advance sequencer at SOF, 1 - advance sequencer at EOF
parameter
SENSI2C_CMD_SOFT_SDA
=
6
,
// [7:6] - SDA software control: 0 - nop, 1 - low, 2 - active high, 3 - float
parameter
SENSI2C_CMD_SOFT_SCL
=
4
,
// [5:4] - SCL software control: 0 - nop, 1 - low, 2 - active high, 3 - float
parameter
SENSI2C_CMD_FIFO_RD
=
3
,
// advance I2C read data FIFO by 1
...
...
@@ -88,6 +89,7 @@ module sensor_i2c#(
input
status_start
,
// Acknowledge of the first status packet byte (address)
input
frame_sync
,
// @posedge mclk increment/reset frame number
input
[
NUM_FRAME_BITS
-
1
:
0
]
frame_num_seq
,
// frame number from the command sequencer (to sync i2c)
input
eof_mclk
,
// frame end (use as alternative i2c sequencer increment (disable for linescan mode)
input
sda_in
,
// i2c SDA input
input
scl_in
,
// i2c SCL input
output
scl_out
,
// i2c SCL output
...
...
@@ -186,10 +188,14 @@ module sensor_i2c#(
wire
sda_en_hard
;
wire
scl_hard
;
reg
use_eof
;
// advance sequencer with eof, not sof
`ifdef
I2C_FRAME_INDEPENDENT
localparam
sync_to_seq
=
0
;
localparam
sync_to_eof
=
0
;
`else
reg
sync_to_seq
;
reg
sync_to_eof
;
`endif
reg
[
5
:
0
]
last_wp
;
// last written write pointer
reg
[
5
:
0
]
last_wp_d
;
// last written write pointer, delayed to match rpointer
...
...
@@ -209,6 +215,7 @@ module sensor_i2c#(
assign
set_ctrl_w
=
we_cmd
&&
((
wa
&
~
SENSI2C_CTRL_MASK
)
==
SENSI2C_CTRL
)
;
// ==0
assign
set_status_w
=
we_cmd
&&
((
wa
&
~
SENSI2C_CTRL_MASK
)
==
SENSI2C_STATUS
)
;
// ==0
assign
pre_wpage0_inc
=
(
!
wen
&&
!
(
|
wen_r
)
&&
!
wpage0_inc
[
0
])
&&
(
req_clr
||
reset_on
)
;
/// assign pre_wpage0_inc = (!wen && !(|wen_r) && !(|wpage0_inc)) && (req_clr || reset_on) ;
assign
fifo_wr_pointers_outw
=
fifo_wr_pointers_ram
[
wpage_wr
[
3
:
0
]]
;
// valid next after command
...
...
@@ -328,6 +335,10 @@ module sensor_i2c#(
if
(
i2c_enrun
||
mrst
)
sda_en_soft
<=
0
;
else
if
(
set_ctrl_w
&&
!
di
[
SENSI2C_CMD_TABLE
]
&&
|
di
[
SENSI2C_CMD_SOFT_SDA
+:
2
])
sda_en_soft
<=
di
[
SENSI2C_CMD_SOFT_SDA
+:
2
]
!=
3
;
if
(
mrst
)
use_eof
<=
0
;
else
if
(
set_ctrl_w
&&
!
di
[
SENSI2C_CMD_TABLE
]
&&
di
[
SENSI2C_CMD_USE_EOF
+
1
])
use_eof
<=
di
[
SENSI2C_CMD_USE_EOF
]
;
if
(
set_ctrl_w
&&
!
di
[
SENSI2C_CMD_TABLE
]
&&
|
di
[
SENSI2C_CMD_SOFT_SDA
+:
2
])
sda_soft
<=
di
[
SENSI2C_CMD_SOFT_SDA
+
1
]
;
if
(
active_cmd
)
begin
...
...
@@ -340,16 +351,17 @@ module sensor_i2c#(
// reset pointers in all 16 pages:
reset_on
<=
reset_cmd
||
(
reset_on
&&
!
(
wpage0_inc
[
0
]
&&
(
wpage0
[
3
:
0
]
==
4'hf
)))
;
// request to clear pointer(s)? for one page - during reset or delayed frame sync (if previous was not finished)
req_clr
<=
frame_sync
||
(
req_clr
&&
!
wpage0_inc
[
0
])
;
req_clr
<=
(
use_eof
?
eof_mclk
:
frame_sync
)
||
(
req_clr
&&
!
wpage0_inc
[
0
])
;
`ifndef
I2C_FRAME_INDEPENDENT
sync_to_seq
<=
frame_sync
||
(
reset_on
&&
(
wpage0
[
3
:
0
]
==
4'hf
))
;
sync_to_seq
<=
!
use_eof
&&
(
frame_sync
||
(
reset_on
&&
(
wpage0
[
3
:
0
]
==
4'hf
)))
;
sync_to_eof
<=
use_eof
&&
(
eof_mclk
||
(
reset_on
&&
(
wpage0
[
3
:
0
]
==
4'hf
)))
;
`endif
if
(
reset_cmd
)
wpage0
<=
0
;
else
if
(
wpage0_inc
[
0
])
wpage0
<=
wpage0
+
1
;
else
if
(
sync_to_seq
)
wpage0
<=
frame_num_seq
;
else
if
(
sync_to_seq
||
sync_to_eof
)
wpage0
<=
sync_to_eof
?
(
frame_num_seq
-
1
)
:
frame_num_seq
;
if
(
reset_cmd
)
wpage_prev
<=
4'hf
;
else
if
(
wpage0_inc
[
0
])
wpage_prev
<=
wpage0
;
...
...
sensor/sensor_i2c_io.v
View file @
eb0f6b26
...
...
@@ -53,6 +53,7 @@ module sensor_i2c_io#(
parameter
SENSI2C_CMD_RESET
=
14
,
// [14] reset all FIFO (takes 16 clock pulses), also - stops i2c until run command
parameter
SENSI2C_CMD_RUN
=
13
,
// [13:12]3 - run i2c, 2 - stop i2c (needed before software i2c), 1,0 - no change to run state
parameter
SENSI2C_CMD_RUN_PBITS
=
1
,
parameter
SENSI2C_CMD_USE_EOF
=
8
,
// [9:8] - 0: advance sequencer at SOF, 1 - advance sequencer at EOF
parameter
SENSI2C_CMD_SOFT_SDA
=
6
,
// [7:6] - SDA software control: 0 - nop, 1 - low, 2 - active high, 3 - float
parameter
SENSI2C_CMD_SOFT_SCL
=
4
,
// [5:4] - SCL software control: 0 - nop, 1 - low, 2 - active high, 3 - float
parameter
SENSI2C_CMD_FIFO_RD
=
3
,
// advance I2C read data FIFO by 1
...
...
@@ -91,6 +92,7 @@ module sensor_i2c_io#(
output
status_rq
,
// input request to send status downstream
input
status_start
,
// Acknowledge of the first status packet byte (address)
input
frame_sync
,
// increment/reset frame number
input
eof_mclk
,
// End of frame for i2c sequencer (will not work for linescan mode: either disable or make division upsteram
input
[
NUM_FRAME_BITS
-
1
:
0
]
frame_num_seq
,
// frame number from the command sequencer (to sync i2c)
inout
scl
,
inout
sda
...
...
@@ -116,6 +118,7 @@ module sensor_i2c_io#(
.
SENSI2C_CMD_RESET
(
SENSI2C_CMD_RESET
)
,
.
SENSI2C_CMD_RUN
(
SENSI2C_CMD_RUN
)
,
.
SENSI2C_CMD_RUN_PBITS
(
SENSI2C_CMD_RUN_PBITS
)
,
.
SENSI2C_CMD_USE_EOF
(
SENSI2C_CMD_USE_EOF
)
,
.
SENSI2C_CMD_SOFT_SDA
(
SENSI2C_CMD_SOFT_SDA
)
,
.
SENSI2C_CMD_SOFT_SCL
(
SENSI2C_CMD_SOFT_SCL
)
,
.
SENSI2C_CMD_FIFO_RD
(
SENSI2C_CMD_FIFO_RD
)
,
...
...
@@ -145,6 +148,7 @@ module sensor_i2c_io#(
.
status_start
(
status_start
)
,
// input
.
frame_sync
(
frame_sync
)
,
// input
.
frame_num_seq
(
frame_num_seq
)
,
// input[3:0]
.
eof_mclk
(
eof_mclk
)
,
// input
.
scl_in
(
scl_in
)
,
// input
.
sda_in
(
sda_in
)
,
// input
.
scl_out
(
scl_out
)
,
// output
...
...
sensor/sensors393.v
View file @
eb0f6b26
...
...
@@ -80,6 +80,7 @@ module sensors393 #(
parameter
SENSI2C_CMD_RESET
=
14
,
// [14] reset all FIFO (takes 16 clock pulses), also - stops i2c until run command
parameter
SENSI2C_CMD_RUN
=
13
,
// [13:12]3 - run i2c, 2 - stop i2c (needed before software i2c), 1,0 - no change to run state
parameter
SENSI2C_CMD_RUN_PBITS
=
1
,
parameter
SENSI2C_CMD_USE_EOF
=
8
,
// [9:8] - 0: advance sequencer at SOF, 1 - advance sequencer at EOF
parameter
SENSI2C_CMD_SOFT_SDA
=
6
,
// [7:6] - SDA software control: 0 - nop, 1 - low, 2 - active high, 3 - float
parameter
SENSI2C_CMD_SOFT_SCL
=
4
,
// [5:4] - SCL software control: 0 - nop, 1 - low, 2 - active high, 3 - float
parameter
SENSI2C_CMD_FIFO_RD
=
3
,
// advance I2C read data FIFO by 1
...
...
@@ -508,6 +509,7 @@ module sensors393 #(
.
SENSI2C_CMD_RESET
(
SENSI2C_CMD_RESET
)
,
.
SENSI2C_CMD_RUN
(
SENSI2C_CMD_RUN
)
,
.
SENSI2C_CMD_RUN_PBITS
(
SENSI2C_CMD_RUN_PBITS
)
,
.
SENSI2C_CMD_USE_EOF
(
SENSI2C_CMD_USE_EOF
)
,
.
SENSI2C_CMD_SOFT_SDA
(
SENSI2C_CMD_SOFT_SDA
)
,
.
SENSI2C_CMD_SOFT_SCL
(
SENSI2C_CMD_SOFT_SCL
)
,
.
SENSI2C_CMD_FIFO_RD
(
SENSI2C_CMD_FIFO_RD
)
,
...
...
x393_parallel.bit
View file @
eb0f6b26
No preview for this file type
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