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
691579c0
Commit
691579c0
authored
Apr 11, 2019
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commands and status for LWIR/VOSPI, exported to C
parent
c49619fd
Changes
9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
957 additions
and
254 deletions
+957
-254
x393_parameters.vh
includes/x393_parameters.vh
+45
-8
vrlg.py
py393/vrlg.py
+299
-80
x393_export_c.py
py393/x393_export_c.py
+47
-4
sens_lepton3.v
sensor/sens_lepton3.v
+295
-51
sensor_channel.v
sensor/sensor_channel.v
+110
-37
sensors393.v
sensor/sensors393.v
+68
-3
vospi_segment_61.v
sensor/vospi_segment_61.v
+58
-46
gpio393.v
util_modules/gpio393.v
+0
-24
x393.v
x393.v
+35
-1
No files found.
includes/x393_parameters.vh
View file @
691579c0
...
...
@@ -35,6 +35,9 @@
* contains all the components and scripts required to completely simulate it
* with at least one of the Free Software programs.
*/
// All paremeters should be defined for all defines values - needed to export to C
parameter MCONTR_WR_MASK = 'h3c00, // AXI write address mask for the 1Kx32 buffers command sequence memory
parameter MCONTR_RD_MASK = 'h3c00, // AXI read address mask to generate busy
...
...
@@ -155,11 +158,11 @@
parameter real REFCLK_FREQUENCY = 200.0, // 300.0,
parameter HIGH_PERFORMANCE_MODE = "FALSE",
parameter CLKIN_PERIOD = 20, // 10, //ns >1.25, 600<Fvco<1200 // Hardware 150MHz , change to | 6.667
`ifdef MCLK_VCO_MULT
`ifdef MCLK_VCO_MULT
parameter CLKFBOUT_MULT = `MCLK_VCO_MULT ,
`else
`else
parameter CLKFBOUT_MULT = 16, // 8, // Fvco=Fclkin*CLKFBOUT_MULT_F/DIVCLK_DIVIDE, Fout=Fvco/CLKOUT#_DIVIDE | 16
`endif
`endif
`else
parameter real REFCLK_FREQUENCY = 300.0,
parameter HIGH_PERFORMANCE_MODE = "FALSE",
...
...
@@ -533,7 +536,40 @@
parameter SENSI2C_IBUF_LOW_PWR= "TRUE",
parameter SENSI2C_SLEW = "SLOW",
//`ifndef HISPI
//`ifdef HISPI
//`elsif LWIR
parameter VOSPI_EN = 0,
parameter VOSPI_EN_BITS = 2,
parameter VOSPI_SEGM0_OK = 2,
parameter VOSPI_SEGM0_OK_BITS = 2,
parameter VOSPI_OUT_EN = 4,
parameter VOSPI_OUT_EN_BITS = 2,
parameter VOSPI_OUT_EN_SINGL = 6,
parameter VOSPI_RESET_CRC = 7,
parameter VOSPI_MRST = 8,
parameter VOSPI_MRST_BITS = 2,
parameter VOSPI_PWDN = 10,
parameter VOSPI_PWDN_BITS = 2,
parameter VOSPI_MCLK = 12,
parameter VOSPI_MCLK_BITS = 2,
parameter VOSPI_SPI_CLK = 14,
parameter VOSPI_SPI_CLK_BITS = 2,
parameter VOSPI_GPIO = 16,
parameter VOSPI_GPIO_BITS = 8,
parameter VOSPI_FAKE_OUT = 24, // to keep hardware
parameter VOSPI_MOSI = 25, // not used
parameter VOSPI_PACKET_WORDS = 80,
parameter VOSPI_NO_INVALID = 1, // do not output invalid packets data
parameter VOSPI_PACKETS_PER_LINE = 2,
parameter VOSPI_SEGMENT_FIRST = 1,
parameter VOSPI_SEGMENT_LAST = 4,
parameter VOSPI_PACKET_FIRST = 0,
parameter VOSPI_PACKET_LAST = 60,
parameter VOSPI_PACKET_TTT = 20, // line number where segment number is provided
parameter VOSPI_SOF_TO_HACT = 2, // clock cycles from SOF to HACT
parameter VOSPI_HACT_TO_HACT_EOF = 2, // minimal clock cycles from HACT to HACT or to EOF
//`else
//sensor_fifo parameters
parameter SENSOR_DATA_WIDTH = 12,
parameter SENSOR_FIFO_2DEPTH = 4,
...
...
@@ -927,6 +963,7 @@
parameter MULTICLK_DIV_XCLK2X = 6, // 200 MHz for compressor (when MULTICLK_DIV_XCLK uses 100 MHz)
`else
parameter MULTICLK_DIV_XCLK = 5, // 240 MHz for compressor (12 for 100 MHz)
parameter MULTICLK_DIV_XCLK2X = 6, // unused value
`endif
parameter MULTICLK_DIV_SYNC = 12, // 100 MHz for inter-camera synchronization and time keeping
// Additional parameters for multi-clock PLL (phases and buffer types)
...
...
py393/vrlg.py
View file @
691579c0
This diff is collapsed.
Click to expand it.
py393/x393_export_c.py
View file @
691579c0
...
...
@@ -322,7 +322,9 @@ class X393ExportC(object):
frmt_spcs
=
frmt_spcs
)
stypedefs
+=
self
.
get_typedef32
(
comment
=
"Sensor/multiplexer I/O pins status"
,
data
=
[
self
.
_enc_status_sens_io
(),
self
.
_enc_status_sens_io_hispi
()],
data
=
[
self
.
_enc_status_sens_io
(),
self
.
_enc_status_sens_io_hispi
(),
self
.
_enc_status_sens_io_vospi
()],
name
=
"x393_status_sens_io"
,
typ
=
"ro"
,
frmt_spcs
=
frmt_spcs
)
...
...
@@ -431,7 +433,8 @@ class X393ExportC(object):
stypedefs
+=
self
.
get_typedef32
(
comment
=
"Sensor port I/O control"
,
data
=
[
self
.
_enc_sensio_ctrl_par12
(),
self
.
_enc_sensio_ctrl_hispi
()],
self
.
_enc_sensio_ctrl_hispi
(),
self
.
_enc_sensio_ctrl_vospi
()],
name
=
"x393_sensio_ctl"
,
typ
=
"wo"
,
frmt_spcs
=
frmt_spcs
)
stypedefs
+=
self
.
get_typedef32
(
comment
=
"Programming interface for multiplexer FPGA"
,
...
...
@@ -1853,7 +1856,7 @@ class X393ExportC(object):
dw
.
append
((
"hact_ext_alive"
,
14
,
1
,
0
,
"HACT signal from the sensor is toggling (N/A for HiSPI)"
))
dw
.
append
((
"vact_alive"
,
15
,
1
,
0
,
"VACT signal from the sensor is toggling (N/A for HiSPI)"
))
dw
.
append
((
"xfpgatdo_byte"
,
16
,
8
,
0
,
"Multiplexer FPGA TDO output"
))
dw
.
append
((
"senspgmin"
,
24
,
1
,
0
,
"senspgm pin state"
))
dw
.
append
((
"senspgmin"
,
24
,
1
,
0
,
"senspgm pin state
(0 means non-FPGA SFE is present)
"
))
dw
.
append
((
"xfpgatdo"
,
25
,
1
,
0
,
"Multiplexer FPGA TDO output"
))
dw
.
append
((
"seq_num"
,
26
,
6
,
0
,
"Sequence number"
))
return
dw
...
...
@@ -1876,11 +1879,26 @@ class X393ExportC(object):
# dw.append(("rel_sol", 18, 3,0, "When SOL active on the last lane @ipclk, latches all other lanes SOL"))
# dw.append(("vact_alive", 15, 1,0, "VACT signal from the sensor is toggling (N/A for HiSPI)"))
# dw.append(("xfpgatdo_byte", 16, 8,0, "Multiplexer FPGA TDO output"))
dw
.
append
((
"senspgmin"
,
24
,
1
,
0
,
"senspgm pin state"
))
dw
.
append
((
"senspgmin"
,
24
,
1
,
0
,
"senspgm pin state
(0 means non-FPGA SFE is present)
"
))
dw
.
append
((
"xfpgatdo"
,
25
,
1
,
0
,
"Multiplexer FPGA TDO output"
))
dw
.
append
((
"seq_num"
,
26
,
6
,
0
,
"Sequence number"
))
return
dw
def
_enc_status_sens_io_vospi
(
self
):
dw
=
[]
dw
.
append
((
"segment_id"
,
0
,
4
,
0
,
"ID of the last received segment: 1-4 for the good frame, 0 - for ITAR-skipped frames"
))
dw
.
append
((
"gpio_in"
,
4
,
4
,
0
,
"Input from GPIO0-GPIO3, only GPIO3 may be used as segment ready"
))
dw
.
append
((
"in_busy"
,
8
,
1
,
0
,
"Frame segments are waited for or received to FIFO"
))
dw
.
append
((
"out_busy"
,
9
,
1
,
0
,
"received frame is being transferred to video memory"
))
dw
.
append
((
"crc_err"
,
10
,
1
,
0
,
"At least 1 CRC error happened since reset by command bit"
))
dw
.
append
((
"fake in"
,
11
,
1
,
0
,
"Just to keep hardware"
))
dw
.
append
((
"senspgmin"
,
24
,
1
,
0
,
"senspgm pin state (0 means non-FPGA SFE is present)"
))
dw
.
append
((
"busy"
,
25
,
1
,
0
,
"in_busy OR out_busy"
))
dw
.
append
((
"seq_num"
,
26
,
6
,
0
,
"Sequence number"
))
return
dw
def
_enc_status_sens_i2c
(
self
):
dw
=
[]
dw
.
append
((
"i2c_fifo_dout"
,
0
,
8
,
0
,
"I2c byte read from the device through FIFO"
))
...
...
@@ -2107,6 +2125,31 @@ class X393ExportC(object):
dw
.
append
((
"gp1_set"
,
vrlg
.
SENS_CTRL_GP1
+
2
,
1
,
0
,
"Set GP1 to 'gp1' value"
))
return
dw
def
_enc_sensio_ctrl_vospi
(
self
):
dw
=
[]
dw
.
append
((
"spi_en"
,
vrlg
.
VOSPI_EN
,
2
,
0
,
"SPI Reset/enable: 0 - NOP, 1 - reset+disable, 2 - noreset, disable, 3 - noreset, enable"
))
dw
.
append
((
"segm_zero"
,
vrlg
.
VOSPI_SEGM0_OK
,
1
,
0
,
"OK to input segment 0 (invalid, valid are 1,2,3,4)"
))
dw
.
append
((
"segm_zero_set"
,
vrlg
.
VOSPI_SEGM0_OK
+
1
,
1
,
0
,
"Enable setting of segm_zero"
))
dw
.
append
((
"out_en"
,
vrlg
.
VOSPI_OUT_EN
,
1
,
0
,
"Enable output sensor data to memory"
))
dw
.
append
((
"out_en_set"
,
vrlg
.
VOSPI_OUT_EN
+
1
,
1
,
0
,
"Set enable sensor data to memory"
))
dw
.
append
((
"out_single"
,
vrlg
.
VOSPI_OUT_EN_SINGL
,
1
,
0
,
"Enable single sensor frame to memory"
))
dw
.
append
((
"reset_crc"
,
vrlg
.
VOSPI_RESET_CRC
,
1
,
0
,
"Reset CRC error status bit"
))
dw
.
append
((
"rst"
,
vrlg
.
VOSPI_MRST
,
1
,
0
,
"RESET signal level to the sensor (0 - low(active), 1 - high (inactive)"
))
dw
.
append
((
"rst_set"
,
vrlg
.
VOSPI_MRST
+
1
,
1
,
0
,
"When set to 1, RESET is set to the 'rst' field value"
))
dw
.
append
((
"pwdn"
,
vrlg
.
VOSPI_PWDN
,
1
,
0
,
"POWER DOWN signal level to the sensor (0 - low(active), 1 - high (inactive)"
))
dw
.
append
((
"pwdn_set"
,
vrlg
.
VOSPI_PWDN
+
1
,
1
,
0
,
"When set to 1, POWER DOWN is set to the 'pwdn' field value"
))
dw
.
append
((
"mclk"
,
vrlg
.
VOSPI_MCLK
,
1
,
0
,
"Enable master clock (25MHz) to sensor"
))
dw
.
append
((
"mclk_set"
,
vrlg
.
VOSPI_MCLK
+
1
,
1
,
0
,
"When set to 1, MCLK enable is set to the 'mclk' field value"
))
dw
.
append
((
"spi_clk"
,
vrlg
.
VOSPI_SPI_CLK
,
1
,
0
,
"Enable continuous SPI clock (0 - only when SPI CS is active)"
))
dw
.
append
((
"spi_clk_set"
,
vrlg
.
VOSPI_SPI_CLK
+
1
,
1
,
0
,
"When set to 1, SPI CLK enable is set to the 'spi_clk' field value"
))
dw
.
append
((
"gpio0"
,
vrlg
.
VOSPI_GPIO
,
2
,
0
,
"Output control for GPIO0: 0 - nop, 1 - set low, 2 - set high, 3 - input"
))
dw
.
append
((
"gpio1"
,
vrlg
.
VOSPI_GPIO
+
2
,
2
,
0
,
"Output control for GPIO1: 0 - nop, 1 - set low, 2 - set high, 3 - input"
))
dw
.
append
((
"gpio2"
,
vrlg
.
VOSPI_GPIO
+
4
,
2
,
0
,
"Output control for GPIO2: 0 - nop, 1 - set low, 2 - set high, 3 - input"
))
dw
.
append
((
"gpio3"
,
vrlg
.
VOSPI_GPIO
+
6
,
2
,
0
,
"Output control for GPIO3: 0 - nop, 1 - set low, 2 - set high, 3 - input"
))
dw
.
append
((
"fake"
,
vrlg
.
VOSPI_FAKE_OUT
,
1
,
0
,
"Just to keep I/O ports from optimization"
))
dw
.
append
((
"mosi"
,
vrlg
.
VOSPI_MOSI
,
1
,
0
,
"Just to keep I/O ports from optimization"
))
return
dw
def
_enc_sensio_jtag
(
self
):
dw
=
[]
dw
.
append
((
"tdi"
,
vrlg
.
SENS_JTAG_TDI
,
1
,
0
,
"JTAG TDI level"
))
...
...
sensor/sens_lepton3.v
View file @
691579c0
This diff is collapsed.
Click to expand it.
sensor/sensor_channel.v
View file @
691579c0
...
...
@@ -227,13 +227,43 @@ module sensor_channel#(
parameter
NUM_FRAME_BITS
=
4
,
`ifndef
HISPI
`ifndef
LWIR
`ifdef
HISPI
`elsif
LWIR
parameter
VOSPI_EN
=
0
,
parameter
VOSPI_EN_BITS
=
2
,
parameter
VOSPI_SEGM0_OK
=
2
,
parameter
VOSPI_SEGM0_OK_BITS
=
2
,
parameter
VOSPI_OUT_EN
=
4
,
parameter
VOSPI_OUT_EN_BITS
=
2
,
parameter
VOSPI_OUT_EN_SINGL
=
6
,
parameter
VOSPI_RESET_CRC
=
7
,
parameter
VOSPI_MRST
=
8
,
parameter
VOSPI_MRST_BITS
=
2
,
parameter
VOSPI_PWDN
=
10
,
parameter
VOSPI_PWDN_BITS
=
2
,
parameter
VOSPI_MCLK
=
12
,
parameter
VOSPI_MCLK_BITS
=
2
,
parameter
VOSPI_SPI_CLK
=
14
,
parameter
VOSPI_SPI_CLK_BITS
=
2
,
parameter
VOSPI_GPIO
=
16
,
parameter
VOSPI_GPIO_BITS
=
8
,
parameter
VOSPI_FAKE_OUT
=
24
,
// to keep hardware
parameter
VOSPI_MOSI
=
25
,
// not used
parameter
VOSPI_PACKET_WORDS
=
80
,
parameter
VOSPI_NO_INVALID
=
1
,
// do not output invalid packets data
parameter
VOSPI_PACKETS_PER_LINE
=
2
,
parameter
VOSPI_SEGMENT_FIRST
=
1
,
parameter
VOSPI_SEGMENT_LAST
=
4
,
parameter
VOSPI_PACKET_FIRST
=
0
,
parameter
VOSPI_PACKET_LAST
=
60
,
parameter
VOSPI_PACKET_TTT
=
20
,
// line number where segment number is provided
parameter
VOSPI_SOF_TO_HACT
=
2
,
// clock cycles from SOF to HACT
parameter
VOSPI_HACT_TO_HACT_EOF
=
2
,
// minimal clock cycles from HACT to HACT or to EOF
`else
//sensor_fifo parameters
parameter
SENSOR_DATA_WIDTH
=
12
,
parameter
SENSOR_FIFO_2DEPTH
=
4
,
parameter
[
3
:
0
]
SENSOR_FIFO_DELAY
=
5
,
// 7,
`endif
`endif
// sens_parallel12 other parameters
...
...
@@ -501,9 +531,12 @@ module sensor_channel#(
reg
dav_r
;
wire
[
15
:
0
]
dout_w
;
wire
dav_w
;
//`ifndef LWIR
`ifdef
LWIR
wire
trig
;
// SuppressThisWarning VEditor - (yet) unused
`else
wire
trig
;
//`endif
`endif
wire
prsts
;
// @pclk - includes sensor reset and sensor PLL reset
reg
sof_out_r
;
reg
eof_out_r
;
...
...
@@ -536,14 +569,24 @@ module sensor_channel#(
`ifdef
DEBUG_RING
`ifdef
HISPI
`elsif
LWIR
`else
reg
vact_to_fifo_r
;
`endif
`ifdef
LWIR
// reg hact_to_fifo_r;
reg
[
15
:
0
]
debug_line_cntr
=
0
;
reg
[
15
:
0
]
debug_lines
=
0
;
reg
[
15
:
0
]
hact_cntr
=
0
;
// reg [15:0] vact_cntr;
`else
reg
hact_to_fifo_r
;
reg
[
15
:
0
]
debug_line_cntr
;
reg
[
15
:
0
]
debug_lines
;
reg
[
15
:
0
]
hact_cntr
;
reg
[
15
:
0
]
vact_cntr
;
`endif
`ifdef
HISPI
always
@
(
posedge
pclk
)
begin
// vact_to_fifo_r <= vact_to_fifo;
...
...
@@ -813,7 +856,7 @@ module sensor_channel#(
`endif
`endif
`ifndef
LWIR
//
`ifndef LWIR
pulse_cross_clock
pulse_cross_clock_eof_mclk_i
(
.
rst
(
prsts
)
,
// input extended to include sensor reset and rst_mmcm
.
src_clk
(
pclk
)
,
// input
...
...
@@ -822,7 +865,7 @@ module sensor_channel#(
.
out_pulse
(
eof_mclk
)
,
// output
.
busy
()
// output
)
;
`endif
//
`endif
`ifdef
HISPI
...
...
@@ -978,7 +1021,37 @@ module sensor_channel#(
.
SENS_SS_EN
(
SENS_SS_EN
)
,
.
SENS_SS_MODE
(
SENS_SS_MODE
)
,
.
SENS_SS_MOD_PERIOD
(
SENS_SS_MOD_PERIOD
)
,
.
STATUS_ALIVE_WIDTH
(
STATUS_ALIVE_WIDTH
)
.
STATUS_ALIVE_WIDTH
(
STATUS_ALIVE_WIDTH
)
,
.
VOSPI_EN
(
VOSPI_EN
)
,
// 0,
.
VOSPI_EN_BITS
(
VOSPI_EN_BITS
)
,
// 2,
.
VOSPI_SEGM0_OK
(
VOSPI_SEGM0_OK
)
,
// 2,
.
VOSPI_SEGM0_OK_BITS
(
VOSPI_SEGM0_OK_BITS
)
,
// 2,
.
VOSPI_OUT_EN
(
VOSPI_OUT_EN
)
,
// 4,
.
VOSPI_OUT_EN_BITS
(
VOSPI_OUT_EN_BITS
)
,
// 2,
.
VOSPI_OUT_EN_SINGL
(
VOSPI_OUT_EN_SINGL
)
,
// 6,
.
VOSPI_RESET_CRC
(
VOSPI_RESET_CRC
)
,
// 7,
.
VOSPI_MRST
(
VOSPI_MRST
)
,
// 8,
.
VOSPI_MRST_BITS
(
VOSPI_MRST_BITS
)
,
// 2,
.
VOSPI_PWDN
(
VOSPI_PWDN
)
,
// 10,
.
VOSPI_PWDN_BITS
(
VOSPI_PWDN_BITS
)
,
// 2,
.
VOSPI_MCLK
(
VOSPI_MCLK
)
,
// 12,
.
VOSPI_MCLK_BITS
(
VOSPI_MCLK_BITS
)
,
// 2,
.
VOSPI_SPI_CLK
(
VOSPI_SPI_CLK
)
,
// 14,
.
VOSPI_SPI_CLK_BITS
(
VOSPI_SPI_CLK_BITS
)
,
// 2,
.
VOSPI_GPIO
(
VOSPI_GPIO
)
,
// 16,
.
VOSPI_GPIO_BITS
(
VOSPI_GPIO_BITS
)
,
// 8,
.
VOSPI_FAKE_OUT
(
VOSPI_FAKE_OUT
)
,
// 24, // to keep hardware
.
VOSPI_MOSI
(
VOSPI_MOSI
)
,
// 25, // pot used
.
VOSPI_PACKET_WORDS
(
VOSPI_PACKET_WORDS
)
,
// 80,
.
VOSPI_NO_INVALID
(
VOSPI_NO_INVALID
)
,
// 1,
.
VOSPI_PACKETS_PER_LINE
(
VOSPI_PACKETS_PER_LINE
)
,
// 2,
.
VOSPI_SEGMENT_FIRST
(
VOSPI_SEGMENT_FIRST
)
,
// 1,
.
VOSPI_SEGMENT_LAST
(
VOSPI_SEGMENT_LAST
)
,
// 4,
.
VOSPI_PACKET_FIRST
(
VOSPI_PACKET_FIRST
)
,
// 0,
.
VOSPI_PACKET_LAST
(
VOSPI_PACKET_LAST
)
,
// 60,
.
VOSPI_PACKET_TTT
(
VOSPI_PACKET_TTT
)
,
// 20,
.
VOSPI_SOF_TO_HACT
(
VOSPI_SOF_TO_HACT
)
,
// 2,
.
VOSPI_HACT_TO_HACT_EOF
(
VOSPI_HACT_TO_HACT_EOF
)
// 2,
)
sens_lepton3_i
(
.
mrst
(
mrst
)
,
// input
.
mclk
(
mclk
)
,
// input
...
...
sensor/sensors393.v
View file @
691579c0
...
...
@@ -223,7 +223,39 @@ module sensors393 #(
parameter
SENSI2C_IBUF_LOW_PWR
=
"TRUE"
,
parameter
SENSI2C_SLEW
=
"SLOW"
,
`ifndef
HISPI
`ifdef
HISPI
`elsif
LWIR
parameter
VOSPI_EN
=
0
,
parameter
VOSPI_EN_BITS
=
2
,
parameter
VOSPI_SEGM0_OK
=
2
,
parameter
VOSPI_SEGM0_OK_BITS
=
2
,
parameter
VOSPI_OUT_EN
=
4
,
parameter
VOSPI_OUT_EN_BITS
=
2
,
parameter
VOSPI_OUT_EN_SINGL
=
6
,
parameter
VOSPI_RESET_CRC
=
7
,
parameter
VOSPI_MRST
=
8
,
parameter
VOSPI_MRST_BITS
=
2
,
parameter
VOSPI_PWDN
=
10
,
parameter
VOSPI_PWDN_BITS
=
2
,
parameter
VOSPI_MCLK
=
12
,
parameter
VOSPI_MCLK_BITS
=
2
,
parameter
VOSPI_SPI_CLK
=
14
,
parameter
VOSPI_SPI_CLK_BITS
=
2
,
parameter
VOSPI_GPIO
=
16
,
parameter
VOSPI_GPIO_BITS
=
8
,
parameter
VOSPI_FAKE_OUT
=
24
,
// to keep hardware
parameter
VOSPI_MOSI
=
25
,
// not used
parameter
VOSPI_PACKET_WORDS
=
80
,
parameter
VOSPI_NO_INVALID
=
1
,
// do not output invalid packets data
parameter
VOSPI_PACKETS_PER_LINE
=
2
,
parameter
VOSPI_SEGMENT_FIRST
=
1
,
parameter
VOSPI_SEGMENT_LAST
=
4
,
parameter
VOSPI_PACKET_FIRST
=
0
,
parameter
VOSPI_PACKET_LAST
=
60
,
parameter
VOSPI_PACKET_TTT
=
20
,
// line number where segment number is provided
parameter
VOSPI_SOF_TO_HACT
=
2
,
// clock cycles from SOF to HACT
parameter
VOSPI_HACT_TO_HACT_EOF
=
2
,
// minimal clock cycles from HACT to HACT or to EOF
`else
//sensor_fifo parameters
parameter
SENSOR_DATA_WIDTH
=
12
,
parameter
SENSOR_FIFO_2DEPTH
=
4
,
...
...
@@ -644,7 +676,40 @@ module sensors393 #(
.
SENSI2C_IOSTANDARD
(
SENSI2C_IOSTANDARD
)
,
.
SENSI2C_SLEW
(
SENSI2C_SLEW
)
,
.
NUM_FRAME_BITS
(
NUM_FRAME_BITS
)
,
`ifndef
HISPI
`ifdef
HISPI
`elsif
LWIR
.
VOSPI_EN
(
VOSPI_EN
)
,
// 0,
.
VOSPI_EN_BITS
(
VOSPI_EN_BITS
)
,
// 2,
.
VOSPI_SEGM0_OK
(
VOSPI_SEGM0_OK
)
,
// 2,
.
VOSPI_SEGM0_OK_BITS
(
VOSPI_SEGM0_OK_BITS
)
,
// 2,
.
VOSPI_OUT_EN
(
VOSPI_OUT_EN
)
,
// 4,
.
VOSPI_OUT_EN_BITS
(
VOSPI_OUT_EN_BITS
)
,
// 2,
.
VOSPI_OUT_EN_SINGL
(
VOSPI_OUT_EN_SINGL
)
,
// 6,
.
VOSPI_RESET_CRC
(
VOSPI_RESET_CRC
)
,
// 7,
.
VOSPI_MRST
(
VOSPI_MRST
)
,
// 8,
.
VOSPI_MRST_BITS
(
VOSPI_MRST_BITS
)
,
// 2,
.
VOSPI_PWDN
(
VOSPI_PWDN
)
,
// 10,
.
VOSPI_PWDN_BITS
(
VOSPI_PWDN_BITS
)
,
// 2,
.
VOSPI_MCLK
(
VOSPI_MCLK
)
,
// 12,
.
VOSPI_MCLK_BITS
(
VOSPI_MCLK_BITS
)
,
// 2,
.
VOSPI_SPI_CLK
(
VOSPI_SPI_CLK
)
,
// 14,
.
VOSPI_SPI_CLK_BITS
(
VOSPI_SPI_CLK_BITS
)
,
// 2,
.
VOSPI_GPIO
(
VOSPI_GPIO
)
,
// 16,
.
VOSPI_GPIO_BITS
(
VOSPI_GPIO_BITS
)
,
// 8,
.
VOSPI_FAKE_OUT
(
VOSPI_FAKE_OUT
)
,
// 24, // to keep hardware
.
VOSPI_MOSI
(
VOSPI_MOSI
)
,
// 25, // not used
.
VOSPI_PACKET_WORDS
(
VOSPI_PACKET_WORDS
)
,
// 80,
.
VOSPI_NO_INVALID
(
VOSPI_NO_INVALID
)
,
// 1,
.
VOSPI_PACKETS_PER_LINE
(
VOSPI_PACKETS_PER_LINE
)
,
// 2,
.
VOSPI_SEGMENT_FIRST
(
VOSPI_SEGMENT_FIRST
)
,
// 1,
.
VOSPI_SEGMENT_LAST
(
VOSPI_SEGMENT_LAST
)
,
// 4,
.
VOSPI_PACKET_FIRST
(
VOSPI_PACKET_FIRST
)
,
// 0,
.
VOSPI_PACKET_LAST
(
VOSPI_PACKET_LAST
)
,
// 60,
.
VOSPI_PACKET_TTT
(
VOSPI_PACKET_TTT
)
,
// 20,
.
VOSPI_SOF_TO_HACT
(
VOSPI_SOF_TO_HACT
)
,
// 2,
.
VOSPI_HACT_TO_HACT_EOF
(
VOSPI_HACT_TO_HACT_EOF
)
,
// 2,
`else
.
SENSOR_DATA_WIDTH
(
SENSOR_DATA_WIDTH
)
,
.
SENSOR_FIFO_2DEPTH
(
SENSOR_FIFO_2DEPTH
)
,
.
SENSOR_FIFO_DELAY
(
SENSOR_FIFO_DELAY
)
,
...
...
sensor/vospi_segment_61.v
View file @
691579c0
...
...
@@ -40,6 +40,7 @@
module
vospi_segment_61
#(
parameter
VOSPI_PACKET_WORDS
=
80
,
parameter
VOSPI_NO_INVALID
=
1
,
// do not output invalid packets data
parameter
VOSPI_PACKETS_PER_LINE
=
2
,
parameter
VOSPI_SEGMENT_FIRST
=
1
,
parameter
VOSPI_SEGMENT_LAST
=
4
,
...
...
@@ -62,13 +63,16 @@ module vospi_segment_61#(
output
spi_cs
,
// active low
input
miso
,
// input from the sensor
output
in_busy
,
// waiting for or receiving a segment
output
out_busy
,
output
reg
segment_done
,
// finished receiving segment (good or bad). next after busy off
output
discard_segment
,
// segment was disc arded
output
[
15
:
0
]
dout
,
// 16-bit data received
output
hact
,
// data valid
output
sof
,
// start of frame
output
eof
,
// end of frame
output
crc_err
,
// crc error happened for any packet (valid at eos)
output
[
3
:
0
]
id
// segment number (valid at eos)
)
;
localparam
VOSPI_PACKETS_FRAME
=
(
VOSPI_SEGMENT_LAST
-
VOSPI_SEGMENT_FIRST
+
1
)
*
(
VOSPI_PACKET_LAST
-
VOSPI_PACKET_FIRST
+
1
)
;
...
...
@@ -86,10 +90,10 @@ module vospi_segment_61#(
reg
[
7
:
0
]
full_packet
;
// current full packet number in a fragment
reg
[
7
:
0
]
full_packet_verified
;
// next packet verified (will not be discarded later)
reg
full_packet_frame
;
// lsb of the input frame // not needed?
reg
discard_set
;
// start discard_segment
reg
discard_set
;
// start discard_segment
_r
wire
segment_good_w
;
// recognized expected segment, OK to read FIFO
reg
segment_good
;
// recognized expected segment, OK to read FIFO
reg
discard_segment
;
// read and discard the rest of the current segment
reg
discard_segment
_r
;
// read and discard the rest of the current segment
reg
running_good
;
// passed packet 20
wire
packet_done
;
// read full packet
wire
packet_busy
;
// receiving SPI packet (same as spi_clken, !spi_cs)
...
...
@@ -101,12 +105,12 @@ module vospi_segment_61#(
wire
is_last_segment_w
;
reg
start_d
;
wire
segment_stb
;
reg
crc_err_r
;
//
reg crc_err_r;
wire
packet_crc_err
;
reg
packet_start
;
wire
we
;
// write data to buffer
wire
segment_done
;
reg
segment_busy
;
wire
segment_done
_w
;
reg
segment_busy
_r
;
reg
segment_running
;
// may be discarded
reg
[
3
:
0
]
segment_id_r
;
wire
frame_in_done
;
...
...
@@ -116,11 +120,16 @@ module vospi_segment_61#(
assign
is_last_segment_w
=
(
exp_segment
==
VOSPI_SEGMENT_LAST
)
;
assign
segment_good_w
=
(
packet_id
[
15
:
12
]
==
exp_segment
)
||
((
packet_id
[
15
:
12
]
==
0
)
&&
segm0_ok
)
;
assign
segment_stb
=
id_stb
&&
(
packet_id
[
11
:
0
]
==
VOSPI_PACKET_TTT
)
;
assign
we
=
segment_running
&&
!
discard_segment
&&
packet_dv
;
assign
crc_err
=
crc_err_r
;
assign
segment_done
=
segment_running
&&
packet_done
&&
(
packet_id
[
11
:
0
]
==
VOSPI_PACKET_LAST
)
;
assign
we
=
segment_running
&&
!
discard_segment
_r
&&
packet_dv
;
assign
crc_err
=
packet_done
&&
packet_crc_err
;
//
crc_err_r;
assign
segment_done
_w
=
segment_running
&&
packet_done
&&
(
packet_id
[
11
:
0
]
==
VOSPI_PACKET_LAST
)
;
assign
id
=
segment_id_r
;
assign
frame_in_done
=
segment_done
&&
last_segment_in
;
assign
frame_in_done
=
segment_done_w
&&
last_segment_in
;
assign
in_busy
=
segment_busy_r
;
// waiting for or receiving a segment
assign
discard_segment
=
discard_segment_r
;
// segment was disc arded
// To Buffer
always
@
(
posedge
clk
)
begin
// if (rst) first_segment_in <= 0;
...
...
@@ -131,14 +140,14 @@ module vospi_segment_61#(
start_d
<=
start
;
discard_set
<=
segment_running
&&
!
discard_segment
&&
segment_stb
&&
!
segment_good_w
;
discard_set
<=
segment_running
&&
!
discard_segment
_r
&&
segment_stb
&&
!
segment_good_w
;
segment_good
<=
segment_running
&&
!
discard_segment
&&
segment_stb
&&
segment_good_w
;
segment_good
<=
segment_running
&&
!
discard_segment
_r
&&
segment_stb
&&
segment_good_w
;
if
(
segment_running
&&
!
discard_segment
&&
segment_stb
)
segment_id_r
<=
packet_id
[
15
:
12
]
;
if
(
segment_running
&&
!
discard_segment
_r
&&
segment_stb
)
segment_id_r
<=
packet_id
[
15
:
12
]
;
if
(
start
)
discard_segment
<=
0
;
else
if
(
discard_set
)
discard_segment
<=
1
;
if
(
start
)
discard_segment
_r
<=
0
;
else
if
(
discard_set
)
discard_segment
_r
<=
1
;
if
(
start
)
running_good
<=
0
;
else
if
(
segment_good
)
running_good
<=
1
;
...
...
@@ -152,19 +161,21 @@ module vospi_segment_61#(
if
(
rst
||
(
start
&&
is_first_segment_w
))
full_packet
<=
0
;
else
if
(
discard_set
)
full_packet
<=
segment_start_packet
;
else
if
(
!
discard_segment
&&
packet_done
)
full_packet
<=
full_packet
+
1
;
else
if
(
!
discard_segment_r
&&
packet_done
)
full_packet
<=
full_packet
+
1
;
// if (rst || start) crc_err_r <= 0;
// else if (packet_done && packet_crc_err) crc_err_r <= 0;
if
(
rst
||
start
)
crc_err_r
<=
0
;
else
if
(
packet_done
&&
packet_crc_err
)
crc_err_r
<=
0
;
if
(
rst
)
segment_busy_r
<=
0
;
else
if
(
start
)
segment_busy_r
<=
1'b1
;
else
if
(
segment_done_w
)
segment_busy_r
<=
1'b0
;
if
(
rst
)
segment_busy
<=
0
;
else
if
(
start
)
segment_busy
<=
1'b1
;
else
if
(
segment_done
)
segment_busy
<=
1'b0
;
segment_done
<=
segment_done_w
;
// module output reg
if
(
!
segment_busy
||
start
)
segment_running
<=
0
;
if
(
!
segment_busy
_r
||
start
)
segment_running
<=
0
;
else
if
(
id_stb
&&
(
packet_id
[
11
:
0
]
==
VOSPI_PACKET_FIRST
))
segment_running
<=
1
;
packet_start
<=
!
rst
&&
!
packet_busy
&&
segment_busy
;
packet_start
<=
!
rst
&&
!
packet_busy
&&
segment_busy
_r
;
if
(
rst
)
waddr
<=
0
;
else
if
(
discard_set
)
waddr
<=
segment_start_waddr
;
...
...
@@ -209,6 +220,7 @@ module vospi_segment_61#(
assign
hact
=
hact_r
[
2
]
;
assign
eof
=
eof_r
[
2
]
;
assign
sof
=
sof_r
;
assign
out_busy
=
out_request
|
out_frame
;
always
@
(
posedge
clk
)
begin
if
(
rst
)
hact_r
<=
0
;
...
...
@@ -250,8 +262,8 @@ module vospi_segment_61#(
end
vospi_packet_80
#(
.
VOSPI_PACKET_WORDS
(
80
)
,
.
VOSPI_NO_INVALID
(
1
)
.
VOSPI_PACKET_WORDS
(
VOSPI_PACKET_WORDS
)
,
// 80
,
.
VOSPI_NO_INVALID
(
VOSPI_NO_INVALID
)
// 1
)
vospi_packet_80_i
(
.
rst
(
rst
)
,
// input
.
clk
(
clk
)
,
// input
...
...
util_modules/gpio393.v
View file @
691579c0
...
...
@@ -221,27 +221,3 @@ module gpio393 #(
endmodule
module
gpio_bit
(
// input rst, // global reset
input
clk
,
// system clock
input
srst
,
// @posedge clk - sync reset
input
we
,
input
[
1
:
0
]
d_in
,
// input bits
output
d_out
,
// output data
output
en_out
)
;
// enable output
reg
d_r
=
0
;
reg
en_r
=
0
;
assign
d_out
=
d_r
;
assign
en_out
=
en_r
;
always
@
(
posedge
clk
)
begin
if
(
srst
)
d_r
<=
0
;
else
if
(
we
&&
(
|
d_in
))
d_r
<=
!
d_in
[
0
]
;
if
(
srst
)
en_r
<=
0
;
else
if
(
we
&&
(
|
d_in
))
en_r
<=
!
(
&
d_in
)
;
end
endmodule
x393.v
View file @
691579c0
...
...
@@ -1834,7 +1834,41 @@ assign axi_grst = axi_rst_pre;
.
SENSI2C_IBUF_LOW_PWR
(
SENSI2C_IBUF_LOW_PWR
)
,
.
SENSI2C_IOSTANDARD
(
SENSI2C_IOSTANDARD
)
,
.
SENSI2C_SLEW
(
SENSI2C_SLEW
)
,
`ifndef
HISPI
`ifdef
HISPI
`elsif
LWIR
.
VOSPI_EN
(
VOSPI_EN
)
,
// 0,
.
VOSPI_EN_BITS
(
VOSPI_EN_BITS
)
,
// 2,
.
VOSPI_SEGM0_OK
(
VOSPI_SEGM0_OK
)
,
// 2,
.
VOSPI_SEGM0_OK_BITS
(
VOSPI_SEGM0_OK_BITS
)
,
// 2,
.
VOSPI_OUT_EN
(
VOSPI_OUT_EN
)
,
// 4,
.
VOSPI_OUT_EN_BITS
(
VOSPI_OUT_EN_BITS
)
,
// 2,
.
VOSPI_OUT_EN_SINGL
(
VOSPI_OUT_EN_SINGL
)
,
// 6,
.
VOSPI_RESET_CRC
(
VOSPI_RESET_CRC
)
,
// 7,
.
VOSPI_MRST
(
VOSPI_MRST
)
,
// 8,
.
VOSPI_MRST_BITS
(
VOSPI_MRST_BITS
)
,
// 2,
.
VOSPI_PWDN
(
VOSPI_PWDN
)
,
// 10,
.
VOSPI_PWDN_BITS
(
VOSPI_PWDN_BITS
)
,
// 2,
.
VOSPI_MCLK
(
VOSPI_MCLK
)
,
// 12,
.
VOSPI_MCLK_BITS
(
VOSPI_MCLK_BITS
)
,
// 2,
.
VOSPI_SPI_CLK
(
VOSPI_SPI_CLK
)
,
// 14,
.
VOSPI_SPI_CLK_BITS
(
VOSPI_SPI_CLK_BITS
)
,
// 2,
.
VOSPI_GPIO
(
VOSPI_GPIO
)
,
// 16,
.
VOSPI_GPIO_BITS
(
VOSPI_GPIO_BITS
)
,
// 8,
.
VOSPI_FAKE_OUT
(
VOSPI_FAKE_OUT
)
,
// 24, // to keep hardware
.
VOSPI_MOSI
(
VOSPI_MOSI
)
,
// 25, // not used
.
VOSPI_PACKET_WORDS
(
VOSPI_PACKET_WORDS
)
,
// 80,
.
VOSPI_NO_INVALID
(
VOSPI_NO_INVALID
)
,
// 1,
.
VOSPI_PACKETS_PER_LINE
(
VOSPI_PACKETS_PER_LINE
)
,
// 2,
.
VOSPI_SEGMENT_FIRST
(
VOSPI_SEGMENT_FIRST
)
,
// 1,
.
VOSPI_SEGMENT_LAST
(
VOSPI_SEGMENT_LAST
)
,
// 4,
.
VOSPI_PACKET_FIRST
(
VOSPI_PACKET_FIRST
)
,
// 0,
.
VOSPI_PACKET_LAST
(
VOSPI_PACKET_LAST
)
,
// 60,
.
VOSPI_PACKET_TTT
(
VOSPI_PACKET_TTT
)
,
// 20,
.
VOSPI_SOF_TO_HACT
(
VOSPI_SOF_TO_HACT
)
,
// 2,
.
VOSPI_HACT_TO_HACT_EOF
(
VOSPI_HACT_TO_HACT_EOF
)
,
// 2,
`else
.
SENSOR_DATA_WIDTH
(
SENSOR_DATA_WIDTH
)
,
.
SENSOR_FIFO_2DEPTH
(
SENSOR_FIFO_2DEPTH
)
,
.
SENSOR_FIFO_DELAY
(
SENSOR_FIFO_DELAY
)
,
...
...
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