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
38a3ef4f
Commit
38a3ef4f
authored
Sep 27, 2016
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Plain Diff
merged with framepars branch
parents
4e9d0458
ea0f8823
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
103 additions
and
21 deletions
+103
-21
fpga_version.vh
fpga_version.vh
+4
-1
hargs-after
py393/hargs-after
+0
-1
hargs-eyesis
py393/hargs-eyesis
+10
-0
x393_export_c.py
py393/x393_export_c.py
+1
-1
x393_jpeg.py
py393/x393_jpeg.py
+7
-3
x393_sens_cmprs.py
py393/x393_sens_cmprs.py
+50
-3
x393_sensor.py
py393/x393_sensor.py
+3
-3
sens_parallel12.v
sensor/sens_parallel12.v
+1
-1
sensor_i2c.v
sensor/sensor_i2c.v
+18
-5
sensor_i2c_scl_sda.v
sensor/sensor_i2c_scl_sda.v
+9
-3
x359.bit
x359.bit
+0
-0
x393_parallel.bit
x393_parallel.bit
+0
-0
No files found.
fpga_version.vh
View file @
38a3ef4f
...
@@ -35,7 +35,10 @@
...
@@ -35,7 +35,10 @@
* contains all the components and scripts required to completely simulate it
* contains all the components and scripts required to completely simulate it
* with at least one of the Free Software programs.
* with at least one of the Free Software programs.
*/
*/
parameter FPGA_VERSION = 32'h039300b9; //parallel, correcting RTC (it was 25/24 faster) -0.038/29, 79.64%
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%
// parameter FPGA_VERSION = 32'h039300b9; //parallel, correcting RTC (it was 25/24 faster) -0.038/29, 79.64%
// parameter FPGA_VERSION = 32'h039300b8; //parallel, working on camsync -0.330/99, 80.52% -> -0.143 /40, 79.88%
// parameter FPGA_VERSION = 32'h039300b8; //parallel, working on camsync -0.330/99, 80.52% -> -0.143 /40, 79.88%
// parameter FPGA_VERSION = 32'h039300b7; //parallel, matching histograms Bayer to gamma bayer -0.011/9, 79.92%
// parameter FPGA_VERSION = 32'h039300b7; //parallel, matching histograms Bayer to gamma bayer -0.011/9, 79.92%
// parameter FPGA_VERSION = 32'h039300b6; //parallel, working on histograms odd colors bug -0.207 /58, 79.68%
// parameter FPGA_VERSION = 32'h039300b6; //parallel, working on histograms odd colors bug -0.207 /58, 79.68%
...
...
py393/hargs-after
View file @
38a3ef4f
...
@@ -5,5 +5,4 @@
...
@@ -5,5 +5,4 @@
-p PICKLE="/usr/local/verilog/x393_mcntrl.pickle
-p PICKLE="/usr/local/verilog/x393_mcntrl.pickle
-c bitstream_set_path /usr/local/verilog/x393_parallel.bit
-c bitstream_set_path /usr/local/verilog/x393_parallel.bit
-c specify_phys_memory
-c specify_phys_memory
-c specify_window
-i
-i
py393/hargs-eyesis
0 → 100644
View file @
38a3ef4f
-d TARGET_MODE=1
-f /usr/local/verilog/system_defines.vh
-f /usr/local/verilog/x393_parameters.vh /usr/local/verilog/x393_cur_params_target.vh /usr/local/verilog/x393_localparams.vh
-l /usr/local/verilog/x393_cur_params_target.vh
-p PICKLE="/usr/local/verilog/x393_mcntrl.pickle
-c bitstream_set_path /usr/local/verilog/x393_parallel.bit
-c setupEyesisPower 50 100
-c measure_all "*DI"
-c setSensorClock 24.0 "2V5_LVDS"
-c set_rtc
py393/x393_export_c.py
View file @
38a3ef4f
...
@@ -1826,7 +1826,7 @@ class X393ExportC(object):
...
@@ -1826,7 +1826,7 @@ class X393ExportC(object):
dw
.
append
((
"i2c_fifo_nempty"
,
8
,
1
,
0
,
"I2C read FIFO has data"
))
dw
.
append
((
"i2c_fifo_nempty"
,
8
,
1
,
0
,
"I2C read FIFO has data"
))
dw
.
append
((
"i2c_fifo_lsb"
,
9
,
1
,
0
,
"I2C FIFO byte counter (odd/even bytes)"
))
dw
.
append
((
"i2c_fifo_lsb"
,
9
,
1
,
0
,
"I2C FIFO byte counter (odd/even bytes)"
))
dw
.
append
((
"busy"
,
10
,
1
,
0
,
"I2C sequencer busy"
))
dw
.
append
((
"busy"
,
10
,
1
,
0
,
"I2C sequencer busy"
))
dw
.
append
((
"
alive_fs"
,
11
,
1
,
0
,
"Sensor generated frame sync since last status update
"
))
dw
.
append
((
"
wr_full"
,
11
,
1
,
0
,
"Write buffer almost full (1/4..3/4 in ASAP mode)
"
))
dw
.
append
((
"frame_num"
,
12
,
4
,
0
,
"I2C sequencer frame number"
))
dw
.
append
((
"frame_num"
,
12
,
4
,
0
,
"I2C sequencer frame number"
))
dw
.
append
((
"req_clr"
,
16
,
1
,
0
,
"Request for clearing fifo_wp (delay frame sync if previous is not yet sent out)"
))
dw
.
append
((
"req_clr"
,
16
,
1
,
0
,
"Request for clearing fifo_wp (delay frame sync if previous is not yet sent out)"
))
dw
.
append
((
"reset_on"
,
17
,
1
,
0
,
"Reset in progress"
))
dw
.
append
((
"reset_on"
,
17
,
1
,
0
,
"Reset in progress"
))
...
...
py393/x393_jpeg.py
View file @
38a3ef4f
...
@@ -1072,6 +1072,8 @@ camsync_setup 0xf # sensor mask - use local timestamps)
...
@@ -1072,6 +1072,8 @@ camsync_setup 0xf # sensor mask - use local timestamps)
jpeg_write "img.jpeg" 0 80
jpeg_write "img.jpeg" 0 80
####### Parallel - setup sensor 1 (sensor 0 is set by drivers) ##############
####### Parallel - setup sensor 1 (sensor 0 is set by drivers) ##############
cd /usr/local/verilog/; test_mcntrl.py @hargs-after
setup_all_sensors True None 0x2 # sensor 1
setup_all_sensors True None 0x2 # sensor 1
set_sensor_io_ctl 1 None None 1 # Set ARO low - check if it is still needed?
set_sensor_io_ctl 1 None None 1 # Set ARO low - check if it is still needed?
#set quadrants
#set quadrants
...
@@ -1099,6 +1101,8 @@ jpeg_write "img.jpeg" 1 80
...
@@ -1099,6 +1101,8 @@ jpeg_write "img.jpeg" 1 80
################## Parallel ##################
################## Parallel ##################
cd /usr/local/verilog/; test_mcntrl.py @hargs-after
cd /usr/local/verilog/; test_mcntrl.py @tpargs -x
cd /usr/local/verilog/; test_mcntrl.py @tpargs -x
...
@@ -1903,8 +1907,8 @@ set_gpio_ports 1 1 # enable software gpio pins and porta (camsync)
...
@@ -1903,8 +1907,8 @@ set_gpio_ports 1 1 # enable software gpio pins and porta (camsync)
set_gpio_pins 0 1 # pin 0 low, pin 1 - high
set_gpio_pins 0 1 # pin 0 low, pin 1 - high
set_camsync_period 31 # set bit duration
set_camsync_period 31 # set bit duration
set_camsync_period
7500 # 75
usec
set_camsync_period
8000 # 80
usec
set_camsync_delay 0 0
set_camsync_delay 0
40
0
set_camsync_delay 1 100
set_camsync_delay 1 100
set_camsync_delay 2 200
set_camsync_delay 2 200
set_camsync_delay 3 300
set_camsync_delay 3 300
...
@@ -2014,7 +2018,7 @@ jpeg_sim_multi 4
...
@@ -2014,7 +2018,7 @@ jpeg_sim_multi 4
#set_camsync_mode <en=None> <en_snd=None> <en_ts_external=None> <triggered_mode=None> <master_chn=None> <chn_en=None>
#set_camsync_mode <en=None> <en_snd=None> <en_ts_external=None> <triggered_mode=None> <master_chn=None> <chn_en=None>
set_camsync_mode None None None 0
set_camsync_mode None None None 0
jpeg_sim_multi 4
jpeg_sim_multi 4
jpeg_sim_multi
4
jpeg_sim_multi
8
...
...
py393/x393_sens_cmprs.py
View file @
38a3ef4f
...
@@ -59,6 +59,10 @@ PAGE_SIZE = 4096
...
@@ -59,6 +59,10 @@ PAGE_SIZE = 4096
SI5338_PATH
=
'/sys/devices/soc0/amba@0/e0004000.ps7-i2c/i2c-0/0-0070'
SI5338_PATH
=
'/sys/devices/soc0/amba@0/e0004000.ps7-i2c/i2c-0/0-0070'
POWER393_PATH
=
'/sys/devices/soc0/elphel393-pwr@0'
POWER393_PATH
=
'/sys/devices/soc0/elphel393-pwr@0'
MEM_PATH
=
'/sys/devices/soc0/elphel393-mem@0/'
MEM_PATH
=
'/sys/devices/soc0/elphel393-mem@0/'
EYESIS_POWER_PATH
=
'/sys/devices/soc0/elphel393-pwr@0/gpio_10389'
EYESIS_POWER_ON
=
'0x101'
EYESIS_POWER_OFF
=
'0x100'
BUFFER_ADDRESS_NAME
=
'buffer_address'
BUFFER_ADDRESS_NAME
=
'buffer_address'
BUFFER_PAGES_NAME
=
'buffer_pages'
BUFFER_PAGES_NAME
=
'buffer_pages'
...
@@ -272,6 +276,7 @@ class X393SensCmprs(object):
...
@@ -272,6 +276,7 @@ class X393SensCmprs(object):
Sleep for specified number of milliseconds
Sleep for specified number of milliseconds
@param time_ms - sleep time in milliseconds
@param time_ms - sleep time in milliseconds
"""
"""
if
(
time_ms
):
time
.
sleep
(
0.001
*
time_ms
)
time
.
sleep
(
0.001
*
time_ms
)
def
setSensorClock
(
self
,
freq_MHz
=
24.0
,
iface
=
"2V5_LVDS"
,
quiet
=
0
):
def
setSensorClock
(
self
,
freq_MHz
=
24.0
,
iface
=
"2V5_LVDS"
,
quiet
=
0
):
"""
"""
...
@@ -315,10 +320,52 @@ class X393SensCmprs(object):
...
@@ -315,10 +320,52 @@ class X393SensCmprs(object):
print
(
"Set sensors
%
s interface voltage to
%
d mV"
%
((
"0, 1"
,
"2, 3"
)[
sub_pair
],
voltage_mv
))
print
(
"Set sensors
%
s interface voltage to
%
d mV"
%
((
"0, 1"
,
"2, 3"
)[
sub_pair
],
voltage_mv
))
time
.
sleep
(
0.1
)
time
.
sleep
(
0.1
)
def
setEyesisPower
(
self
,
en
,
dly_ms
=
0
):
"""
Turn on/off external power supply for Eyesis sensor ports. At startup stupid GPIO system
interface "thinks" it is off, but it is actually on. So to turn off after boot On-Off sequence
is needed
@param en True or 1 - turn power on, False or 0 - turn off
@param dly_ms - delay in ms after turning power on or off
"""
if
self
.
DRY_MODE
:
print
(
"setEyesisPower() is not defined for simulation mode"
)
return
with
open
(
EYESIS_POWER_PATH
,
"w"
)
as
f
:
print
((
EYESIS_POWER_OFF
,
EYESIS_POWER_ON
)[
en
],
file
=
f
)
self
.
sleep_ms
(
dly_ms
)
def
setupEyesisPower
(
self
,
dly1_ms
=
50
,
dly2_ms
=
100
):
"""
1. Turn off external power supply for Eyesis sensor ports (it is on after boot),
2. Set interface voltage (should be with power off)
3. Turn on power
@param dly1_ms - delay time in ms after interface voltage
@param dly2_ms - delay time in ms after external power on/off
"""
voltage_mv
=
SENSOR_INTERFACES
[
'PAR12'
][
"mv"
]
if
self
.
DRY_MODE
:
print
(
"setupEyesisPower() is not defined for simulation mode"
)
return
#turn off external sensor power
self
.
setEyesisPower
(
True
,
0
)
# stupid GPIO after reset will not turn off if it thinks it is off
self
.
setEyesisPower
(
False
,
dly2_ms
)
#Turn off on-board sensor power (just in case)
for
sub_pair
in
(
0
,
1
):
self
.
setSensorPower
(
sub_pair
=
sub_pair
,
power_on
=
0
)
for
sub_pair
in
(
0
,
1
):
self
.
setSensorIfaceVoltage
(
sub_pair
=
sub_pair
,
voltage_mv
=
voltage_mv
)
self
.
sleep_ms
(
dly1_ms
)
self
.
setEyesisPower
(
True
,
dly2_ms
)
#Turn on-board sensor power (just in case)
for
sub_pair
in
(
0
,
1
):
self
.
setSensorPower
(
sub_pair
=
sub_pair
,
power_on
=
0
)
def
setupSensorsPower
(
self
,
ifaceType
,
pairs
=
"all"
,
quiet
=
0
,
dly
=
0.0
):
def
setupSensorsPower
(
self
,
ifaceType
,
pairs
=
"all"
,
quiet
=
0
,
dly
=
0.0
):
"""
"""
Set interface voltage and turn on power for interface and the sensors
Set interface voltage and turn on power for interface and the sensors
according to sensor type
according to sensor type
@param ifaceType "PAR12" or "HISPI"
@param pairs - 'all' or list/tuple of pairs of the sensors: 0 - sensors 1 and 2, 1 - sensors 3 and 4
@param pairs - 'all' or list/tuple of pairs of the sensors: 0 - sensors 1 and 2, 1 - sensors 3 and 4
@param quiet - reduce output
@param quiet - reduce output
@param dly - debug feature: step delay in sec
@param dly - debug feature: step delay in sec
...
...
py393/x393_sensor.py
View file @
38a3ef4f
...
@@ -240,7 +240,7 @@ class X393Sensor(object):
...
@@ -240,7 +240,7 @@ class X393Sensor(object):
print
(
" reset_on =
%
d"
%
((
status
>>
17
)
&
1
))
print
(
" reset_on =
%
d"
%
((
status
>>
17
)
&
1
))
print
(
" req_clr =
%
d"
%
((
status
>>
16
)
&
1
))
print
(
" req_clr =
%
d"
%
((
status
>>
16
)
&
1
))
print
(
" frame_num =
%
d"
%
((
status
>>
12
)
&
0xf
))
print
(
" frame_num =
%
d"
%
((
status
>>
12
)
&
0xf
))
print
(
"
alive_fs =
%
d"
%
((
status
>>
11
)
&
1
))
print
(
"
wr_full =
%
d"
%
((
status
>>
11
)
&
1
))
print
(
" busy =
%
d"
%
((
status
>>
10
)
&
1
))
print
(
" busy =
%
d"
%
((
status
>>
10
)
&
1
))
print
(
" i2c_fifo_lsb =
%
d"
%
((
status
>>
9
)
&
1
))
print
(
" i2c_fifo_lsb =
%
d"
%
((
status
>>
9
)
&
1
))
print
(
" i2c_fifo_nempty =
%
d"
%
((
status
>>
8
)
&
1
))
print
(
" i2c_fifo_nempty =
%
d"
%
((
status
>>
8
)
&
1
))
...
@@ -1326,7 +1326,7 @@ class X393Sensor(object):
...
@@ -1326,7 +1326,7 @@ class X393Sensor(object):
print ("print_status_sensor_i2c(
%
d):"
%(num_sensor)
)
print ("print_status_sensor_i2c(
%
d):"
%(num_sensor)
)
print (" reset_on =
%
d"
%
((status>> 7) & 1))
print (" reset_on =
%
d"
%
((status>> 7) & 1))
print (" req_clr =
%
d"
%
((status>> 6) & 1))
print (" req_clr =
%
d"
%
((status>> 6) & 1))
print ("
alive_fs
=
%
d"
%
((status>> 5) & 1))
print ("
wr_full
=
%
d"
%
((status>> 5) & 1))
print (" busy =
%
d"
%
((status>> 4) & 1))
print (" busy =
%
d"
%
((status>> 4) & 1))
print (" frame_num =
%
d"
%
((status>> 0) & 0xf))
print (" frame_num =
%
d"
%
((status>> 0) & 0xf))
...
@@ -1376,7 +1376,7 @@ setSensorClock
...
@@ -1376,7 +1376,7 @@ setSensorClock
checkSclSda 1
checkSclSda 1
cat /usr/local/verilog/x359.bit > /dev/sfpgaconfjtag1
#
cat /usr/local/verilog/x359.bit > /dev/sfpgaconfjtag1
#jtag_set_pgm_mode 0 1
#jtag_set_pgm_mode 0 1
...
...
sensor/sens_parallel12.v
View file @
38a3ef4f
...
@@ -247,7 +247,7 @@ module sens_parallel12 #(
...
@@ -247,7 +247,7 @@ module sens_parallel12 #(
xfpgatdo_byte
[
7
:
0
]
,
xfpgatdo_byte
[
7
:
0
]
,
vact_alive
,
hact_ext_alive
,
hact_alive
,
locked_pxd_mmcm
,
vact_alive
,
hact_ext_alive
,
hact_alive
,
locked_pxd_mmcm
,
clkin_pxd_stopped_mmcm
,
clkfb_pxd_stopped_mmcm
,
xfpgadone
,
clkin_pxd_stopped_mmcm
,
clkfb_pxd_stopped_mmcm
,
xfpgadone
,
ps_out
,
ps_
rdy
,
ps_
out
,
xfpgatdo
,
senspgmin
};
xfpgatdo
,
senspgmin
};
assign
hact_out
=
hact_r
;
assign
hact_out
=
hact_r
;
...
...
sensor/sensor_i2c.v
View file @
38a3ef4f
...
@@ -198,6 +198,14 @@ module sensor_i2c#(
...
@@ -198,6 +198,14 @@ module sensor_i2c#(
reg
[
5
:
0
]
fifo_fill
;
// number of words written to the other (not current) page, or difference wp-rp for the current
reg
[
5
:
0
]
fifo_fill
;
// number of words written to the other (not current) page, or difference wp-rp for the current
wire
[
5
:
0
]
fifo_wr_pointers_next
;
// pointer value to be written to fifo_wr_pointers_ram[wpage_wr]
wire
[
5
:
0
]
fifo_wr_pointers_next
;
// pointer value to be written to fifo_wr_pointers_ram[wpage_wr]
// Preventing overflow when many i2c commands are written in ASAP mode (stopped compressor)
wire
[
1
:
0
]
send_diff
=
fifo_wr_pointers_outr
[
5
:
4
]
-
rpointer
[
5
:
4
]
;
// to determine buffer full in ASAP mode
wire
wr_full_w
=
(
wpage0
==
wpage_wr
)
?
// is it ASAP mode (i.e. sequencer is stopped, progr. 10359)
send_diff
[
1
]
:
// 1/4..3/4 full in ASAP mode
(
&
fifo_wr_pointers_outw_r
[
5
:
2
])
;
// current page almost full
reg
wr_full_r
;
// fifo_wr_pointers_outw_r
assign
set_ctrl_w
=
we_cmd
&&
((
wa
&
~
SENSI2C_CTRL_MASK
)
==
SENSI2C_CTRL
)
;
// ==0
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
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
[
0
])
&&
(
req_clr
||
reset_on
)
;
...
@@ -217,13 +225,13 @@ module sensor_i2c#(
...
@@ -217,13 +225,13 @@ module sensor_i2c#(
assign
fifo_wr_pointers_next
=
wpage0_inc
[
1
]
?
6'h0
:
(
fifo_wr_pointers_outw_r
[
5
:
0
]
+
1
)
;
assign
fifo_wr_pointers_next
=
wpage0_inc
[
1
]
?
6'h0
:
(
fifo_wr_pointers_outw_r
[
5
:
0
]
+
1
)
;
/*
reg alive_fs;
reg alive_fs;
always @ (posedge mclk) begin
always @ (posedge mclk) begin
if (set_status_w) alive_fs <= 0;
if (set_status_w) alive_fs <= 0;
else if (frame_sync) alive_fs <= 1;
else if (frame_sync) alive_fs <= 1;
end
end
*/
cmd_deser
#(
cmd_deser
#(
.
ADDR
(
SENSI2C_ABS_ADDR
)
,
.
ADDR
(
SENSI2C_ABS_ADDR
)
,
...
@@ -258,7 +266,10 @@ module sensor_i2c#(
...
@@ -258,7 +266,10 @@ module sensor_i2c#(
.
status
(
{
reset_on
,
req_clr
,
.
status
(
{
reset_on
,
req_clr
,
fifo_fill
[
5
:
0
]
,
fifo_fill
[
5
:
0
]
,
frame_num
[
3
:
0
]
,
frame_num
[
3
:
0
]
,
alive_fs
,
busy
,
i2c_fifo_cntrl
,
i2c_fifo_nempty
,
wr_full_r
,
// alive_fs,
busy
,
i2c_fifo_cntrl
,
i2c_fifo_nempty
,
i2c_fifo_dout
[
7
:
0
]
,
i2c_fifo_dout
[
7
:
0
]
,
sda_in
,
scl_in
}
)
,
// input[25:0]
sda_in
,
scl_in
}
)
,
// input[25:0]
.
ad
(
status_ad
)
,
// output[7:0]
.
ad
(
status_ad
)
,
// output[7:0]
...
@@ -281,6 +292,8 @@ module sensor_i2c#(
...
@@ -281,6 +292,8 @@ module sensor_i2c#(
)
;
)
;
always
@
(
posedge
mclk
)
begin
always
@
(
posedge
mclk
)
begin
wr_full_r
<=
wr_full_w
;
// write buffer is almost full
if
(
wen
)
di_r
<=
di
;
// 32 bit command takes 6 cycles, so di_r can hold data for up to this long
if
(
wen
)
di_r
<=
di
;
// 32 bit command takes 6 cycles, so di_r can hold data for up to this long
wen_r
<=
{
wen_r
[
0
]
,
wen
};
// is it needed?
wen_r
<=
{
wen_r
[
0
]
,
wen
};
// is it needed?
// wen_fifo <= {wen_fifo[0],we_rel || we_abs};
// wen_fifo <= {wen_fifo[0],we_rel || we_abs};
...
@@ -387,7 +400,7 @@ module sensor_i2c#(
...
@@ -387,7 +400,7 @@ module sensor_i2c#(
else
if
(
page_r_inc
[
0
])
page_r
<=
page_r
+
1
;
else
if
(
page_r_inc
[
0
])
page_r
<=
page_r
+
1
;
`endif
`endif
//############ rpointer should start not from 0, but f
orm
value in another RAM???
//############ rpointer should start not from 0, but f
rom the
value in another RAM???
if
(
reset_cmd
||
page_r_inc
[
0
])
rpointer
[
5
:
0
]
<=
6'h0
;
if
(
reset_cmd
||
page_r_inc
[
0
])
rpointer
[
5
:
0
]
<=
6'h0
;
else
if
(
i2c_run_d
&&
!
i2c_run
)
rpointer
[
5
:
0
]
<=
rpointer
[
5
:
0
]
+
1
;
else
if
(
i2c_run_d
&&
!
i2c_run
)
rpointer
[
5
:
0
]
<=
rpointer
[
5
:
0
]
+
1
;
...
...
sensor/sensor_i2c_scl_sda.v
View file @
38a3ef4f
...
@@ -38,7 +38,9 @@
...
@@ -38,7 +38,9 @@
*/
*/
`timescale
1
ns
/
1
ps
`timescale
1
ns
/
1
ps
module
sensor_i2c_scl_sda
(
module
sensor_i2c_scl_sda
#
(
parameter
I2C_REDUCE_SPEED_BITS
=
1
// reduce i2c speed , 0: min = 200kHz, 1: 100kHz
)(
input
mrst
,
// @ posedge mclk
input
mrst
,
// @ posedge mclk
input
mclk
,
// global clock
input
mclk
,
// global clock
input
i2c_rst
,
input
i2c_rst
,
...
@@ -63,7 +65,9 @@ module sensor_i2c_scl_sda(
...
@@ -63,7 +65,9 @@ module sensor_i2c_scl_sda(
wire
rst
=
mrst
||
i2c_rst
;
wire
rst
=
mrst
||
i2c_rst
;
reg
is_open_r
;
reg
is_open_r
;
reg
[
8
:
0
]
sr
;
reg
[
8
:
0
]
sr
;
reg
[
7
:
0
]
dly_cntr
;
reg
[
I2C_REDUCE_SPEED_BITS
+
7
:
0
]
dly_cntr
;
wire
[
I2C_REDUCE_SPEED_BITS
+
8
:
0
]
dly_cntr_w
=
{
i2c_dly
,{
I2C_REDUCE_SPEED_BITS
+
1
{
1'b0
}}};
// to handle 0-lengths
reg
busy_r
;
reg
busy_r
;
wire
snd_start_w
=
snd_start
&&
ready
;
//!busy_r;
wire
snd_start_w
=
snd_start
&&
ready
;
//!busy_r;
wire
snd_stop_w
=
snd_stop
&&
ready
;
// !busy_r;
wire
snd_stop_w
=
snd_stop
&&
ready
;
// !busy_r;
...
@@ -137,7 +141,9 @@ module sensor_i2c_scl_sda(
...
@@ -137,7 +141,9 @@ module sensor_i2c_scl_sda(
// if (!busy_r || dly_over_d) dly_cntr <= i2c_dly;
// if (!busy_r || dly_over_d) dly_cntr <= i2c_dly;
// else dly_cntr <= dly_cntr - 1;
// else dly_cntr <= dly_cntr - 1;
if
(
!
busy_w
||
dly_over
)
dly_cntr
<=
i2c_dly
;
// if (!busy_w || dly_over) dly_cntr <= i2c_dly << I2C_REDUCE_SPEED_BITS;
if
(
!
busy_w
||
dly_over
)
dly_cntr
<=
dly_cntr_w
[
I2C_REDUCE_SPEED_BITS
+
8
:
1
]
;
// top 8 bits
//
else
dly_cntr
<=
dly_cntr
-
1
;
else
dly_cntr
<=
dly_cntr
-
1
;
if
(
dly_over
&&
seq_bit
[
1
])
sda_r
<=
sda_in
;
// just before the end of SCL pulse - delay it by a few clocks to match external latencies?
if
(
dly_over
&&
seq_bit
[
1
])
sda_r
<=
sda_in
;
// just before the end of SCL pulse - delay it by a few clocks to match external latencies?
...
...
x359.bit
0 → 100644
View file @
38a3ef4f
File added
x393_parallel.bit
View file @
38a3ef4f
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