Commit d189269a authored by Andrey Filippov's avatar Andrey Filippov

Updated simulation code

parent c270adff
This diff is collapsed.
...@@ -418,14 +418,16 @@ module x393_dut#( ...@@ -418,14 +418,16 @@ module x393_dut#(
parameter PF_STRIPES=WOI_HEIGHT/PF_HEIGHT; parameter PF_STRIPES=WOI_HEIGHT/PF_HEIGHT;
`else `else
parameter PF_HEIGHT=0; // SuppressThisWarning VEditor - not used parameter PF_HEIGHT=0; // SuppressThisWarning VEditor - not used
parameter FULL_HEIGHT=WOI_HEIGHT+4;
parameter PF_STRIPES=0; // SuppressThisWarning VEditor - not used parameter PF_STRIPES=0; // SuppressThisWarning VEditor - not used
`endif `endif
parameter WOI_MARGINS = 0; // 4;
parameter VIRTUAL_WIDTH= FULL_WIDTH + HBLANK; parameter VIRTUAL_WIDTH= FULL_WIDTH + HBLANK;
parameter VIRTUAL_HEIGHT= FULL_HEIGHT + BLANK_ROWS_BEFORE + BLANK_ROWS_AFTER; //SuppressThisWarning Veditor UNUSED parameter VIRTUAL_HEIGHT= FULL_HEIGHT + BLANK_ROWS_BEFORE + BLANK_ROWS_AFTER; //SuppressThisWarning Veditor UNUSED
parameter TRIG_INTERFRAME= 100; /// extra 100 clock cycles between frames //SuppressThisWarning Veditor UNUSED parameter TRIG_INTERFRAME= 100; /// extra 100 clock cycles between frames //SuppressThisWarning Veditor UNUSED
parameter TRIG_DELAY= 200; /// delay in sensor clock cycles // SuppressThisWarning VEditor - not used parameter TRIG_DELAY= 200; /// delay in sensor clock cycles // SuppressThisWarning VEditor - not used
parameter FULL_WIDTH= WOI_WIDTH+4; parameter FULL_WIDTH= WOI_WIDTH + WOI_MARGINS;
parameter FULL_HEIGHT= WOI_HEIGHT + WOI_MARGINS;
// localparam SENSOR_MEMORY_WIDTH_BURSTS = (FULL_WIDTH + 15) >> 4; // localparam SENSOR_MEMORY_WIDTH_BURSTS = (FULL_WIDTH + 15) >> 4;
// localparam SENSOR_MEMORY_MASK = (1 << (FRAME_WIDTH_ROUND_BITS-4)) -1; // localparam SENSOR_MEMORY_MASK = (1 << (FRAME_WIDTH_ROUND_BITS-4)) -1;
// localparam SENSOR_MEMORY_FULL_WIDTH_BURSTS = (SENSOR_MEMORY_WIDTH_BURSTS + SENSOR_MEMORY_MASK) & (~SENSOR_MEMORY_MASK); // localparam SENSOR_MEMORY_FULL_WIDTH_BURSTS = (SENSOR_MEMORY_WIDTH_BURSTS + SENSOR_MEMORY_MASK) & (~SENSOR_MEMORY_MASK);
...@@ -670,22 +672,35 @@ module x393_dut#( ...@@ -670,22 +672,35 @@ module x393_dut#(
`else `else
//connect parallel12 sensor to sensor port 2 (all data rotated left by 1 bit) //connect parallel12 sensor to sensor port 2 (all data rotated left by 1 bit)
assign sns2_dp[6:1] = {PX2_D[9], PX2_D[7], PX2_D[5], PX2_D[3], PX2_D[1], PX2_HACT}; /// assign sns2_dp[6:1] = {PX2_D[9], PX2_D[7], PX2_D[5], PX2_D[3], PX2_D[1], PX2_HACT};
assign sns2_dn[6:0] = {PX2_D[10], PX2_D[8], PX2_D[6], PX2_D[4], PX2_D[2], PX2_VACT, PX2_DCLK}; /// assign sns2_dn[6:0] = {PX2_D[10], PX2_D[8], PX2_D[6], PX2_D[4], PX2_D[2], PX2_VACT, PX2_DCLK};
assign sns2_clkn = PX2_D[11]; // inout CNVSYNC/TDI /// assign sns2_clkn = PX2_D[11]; // inout CNVSYNC/TDI
assign sns2_clkp = PX2_D[0]; // CNVCLK/TDO /// assign sns2_clkp = PX2_D[0]; // CNVCLK/TDO
assign sns2_dp[6:1] = {PX2_D[10], PX2_D[8], PX2_D[6], PX2_D[4], PX2_D[2], PX2_HACT};
assign sns2_dn[6:0] = {PX2_D[11], PX2_D[9], PX2_D[7], PX2_D[5], PX2_D[3], PX2_VACT, PX2_DCLK};
assign sns2_clkn = PX2_D[0]; // inout CNVSYNC/TDI
assign sns2_clkp = PX2_D[1]; // CNVCLK/TDO
//connect parallel12 sensor to sensor port 3 (all data rotated left by 2 bits //connect parallel12 sensor to sensor port 3 (all data rotated left by 2 bits
assign sns3_dp[6:1] = {PX3_D[8], PX3_D[6], PX3_D[4], PX3_D[2], PX3_D[0], PX3_HACT}; /// assign sns3_dp[6:1] = {PX3_D[8], PX3_D[6], PX3_D[4], PX3_D[2], PX3_D[0], PX3_HACT};
assign sns3_dn[6:0] = {PX3_D[9], PX3_D[7], PX3_D[5], PX3_D[3], PX3_D[1], PX3_VACT, PX3_DCLK}; /// assign sns3_dn[6:0] = {PX3_D[9], PX3_D[7], PX3_D[5], PX3_D[3], PX3_D[1], PX3_VACT, PX3_DCLK};
assign sns3_clkn = PX3_D[10]; // inout CNVSYNC/TDI /// assign sns3_clkn = PX3_D[10]; // inout CNVSYNC/TDI
assign sns3_clkp = PX3_D[11]; // CNVCLK/TDO /// assign sns3_clkp = PX3_D[11]; // CNVCLK/TDO
assign sns3_dp[6:1] = {PX3_D[10], PX3_D[8], PX3_D[6], PX3_D[4], PX3_D[2], PX3_HACT};
assign sns3_dn[6:0] = {PX3_D[11], PX3_D[9], PX3_D[7], PX3_D[5], PX3_D[3], PX3_VACT, PX3_DCLK};
assign sns3_clkn = PX3_D[0]; // inout CNVSYNC/TDI
assign sns3_clkp = PX3_D[1]; // CNVCLK/TDO
//connect parallel12 sensor to sensor port 4 (all data rotated left by 3 bits //connect parallel12 sensor to sensor port 4 (all data rotated left by 3 bits
assign sns4_dp[6:1] = {PX4_D[5], PX4_D[3], PX4_D[1], PX4_D[11], PX4_D[9], PX4_HACT}; /// assign sns4_dp[6:1] = {PX4_D[5], PX4_D[3], PX4_D[1], PX4_D[11], PX4_D[9], PX4_HACT};
assign sns4_dn[6:0] = {PX4_D[6], PX4_D[4], PX4_D[2], PX4_D[0], PX4_D[10], PX4_VACT, PX4_DCLK}; /// assign sns4_dn[6:0] = {PX4_D[6], PX4_D[4], PX4_D[2], PX4_D[0], PX4_D[10], PX4_VACT, PX4_DCLK};
assign sns4_clkn = PX4_D[7]; // inout CNVSYNC/TDI /// assign sns4_clkn = PX4_D[7]; // inout CNVSYNC/TDI
assign sns4_clkp = PX4_D[8]; // CNVCLK/TDO /// assign sns4_clkp = PX4_D[8]; // CNVCLK/TDO
assign sns4_dp[6:1] = {PX4_D[10], PX4_D[8], PX4_D[6], PX4_D[4], PX4_D[2], PX4_HACT};
assign sns4_dn[6:0] = {PX4_D[11], PX4_D[9], PX4_D[7], PX4_D[5], PX4_D[3], PX4_VACT, PX4_DCLK};
assign sns4_clkn = PX4_D[0]; // inout CNVSYNC/TDI
assign sns4_clkp = PX4_D[1]; // CNVCLK/TDO
`endif `endif
`endif `endif
...@@ -1552,6 +1567,40 @@ simul_axi_hp_wr #( ...@@ -1552,6 +1567,40 @@ simul_axi_hp_wr #(
.clk_out (PX4_MCLK) // output .clk_out (PX4_MCLK) // output
); );
/* Instance template for module simul_lwir160x120_vospi */
wire lwir1_miso;
simul_lwir160x120_vospi #(
.DATA_FILE ("/data_ssd/nc393/elphel393/fpga-elphel/x393/input_data/pattern_160_120_14.dat"),
.WINDOW_WIDTH (160),
.WINDOW_HEIGHT (120),
.TELEMETRY (2), // 1),
.FRAME_PERIOD (946969),
.FRAME_DELAY (100),
.MS_PERIOD (25) // 1us instead of 1 ms
) simul_lwir160x120_vospi_i (
.mclk (x393_i.ps7_i.SAXIHP0ACLK), // PX1_MCLK), // input temporarily made faster
.nrst ( PX1_MRST), // input
.sck ( 1'b0), // input
.ncs ( 1'b0), // inout
.miso ( lwir1_miso), // output
.telemetry_rev ( 16'h7654), // input[15:0]
.telemetry_status ( 32'h137f1248), // input[31:0]
.telemetry_srev (64'h0123456789abcdef), // input[63:0]
.telemetry_temp_counts ( 16'd59000), // input[15:0]
.telemetry_temp_kelvin ( 16'd29500), // input[15:0]
.telemetry_temp_last_kelvin ( 16'd29300), // input[15:0]
.telemetry_time_last_ms ( 32'h12345678), // input[31:0]
.telemetry_agc_roi_top ( 16'd0), // input[15:0]
.telemetry_agc_roi_left ( 16'd0), // input[15:0]
.telemetry_agc_roi_bottom ( 16'd119), // input[15:0]
.telemetry_agc_roi_right ( 16'd159), // input[15:0]
.telemetry_agc_high (16'd19200), // input[15:0]
.telemetry_agc_low ( 16'd200), // input[15:0]
.telemetry_video_format (32'haaaa5555) // input[31:0]
);
simul_sensor12bits #( simul_sensor12bits #(
.SENSOR_IMAGE_TYPE (SENSOR_IMAGE_TYPE0), .SENSOR_IMAGE_TYPE (SENSOR_IMAGE_TYPE0),
.lline (VIRTUAL_WIDTH), // SENSOR12BITS_LLINE), .lline (VIRTUAL_WIDTH), // SENSOR12BITS_LLINE),
...@@ -1572,7 +1621,8 @@ simul_axi_hp_wr #( ...@@ -1572,7 +1621,8 @@ simul_axi_hp_wr #(
.tDDO1 (SENSOR12BITS_TDDO1), .tDDO1 (SENSOR12BITS_TDDO1),
.trigdly (TRIG_LINES), // SENSOR12BITS_TRIGDLY), .trigdly (TRIG_LINES), // SENSOR12BITS_TRIGDLY),
.ramp (0), //SENSOR12BITS_RAMP), .ramp (0), //SENSOR12BITS_RAMP),
.new_bayer (0) // was 1 SENSOR12BITS_NEW_BAYER) .new_bayer (0), // was 1 SENSOR12BITS_NEW_BAYER)
.EXTRA_PERIOD(0)
) simul_sensor12bits_i ( ) simul_sensor12bits_i (
.MCLK (PX1_MCLK), // input .MCLK (PX1_MCLK), // input
.MRST (PX1_MRST), // input .MRST (PX1_MRST), // input
...@@ -1611,7 +1661,9 @@ simul_axi_hp_wr #( ...@@ -1611,7 +1661,9 @@ simul_axi_hp_wr #(
.tDDO1 (SENSOR12BITS_TDDO1), .tDDO1 (SENSOR12BITS_TDDO1),
.trigdly (TRIG_LINES), // SENSOR12BITS_TRIGDLY), .trigdly (TRIG_LINES), // SENSOR12BITS_TRIGDLY),
.ramp (0), //SENSOR12BITS_RAMP), .ramp (0), //SENSOR12BITS_RAMP),
.new_bayer (0) //SENSOR12BITS_NEW_BAYER) was 1 .new_bayer (0), //SENSOR12BITS_NEW_BAYER) was 1
.EXTRA_PERIOD (50)
) simul_sensor12bits_2_i ( ) simul_sensor12bits_2_i (
.MCLK (PX2_MCLK), // input .MCLK (PX2_MCLK), // input
`ifdef DISABLE_SENSOR_2 `ifdef DISABLE_SENSOR_2
...@@ -1653,7 +1705,8 @@ simul_axi_hp_wr #( ...@@ -1653,7 +1705,8 @@ simul_axi_hp_wr #(
.tDDO1 (SENSOR12BITS_TDDO1), .tDDO1 (SENSOR12BITS_TDDO1),
.trigdly (TRIG_LINES), // SENSOR12BITS_TRIGDLY), .trigdly (TRIG_LINES), // SENSOR12BITS_TRIGDLY),
.ramp (0), // SENSOR12BITS_RAMP), .ramp (0), // SENSOR12BITS_RAMP),
.new_bayer (0) // was 1SENSOR12BITS_NEW_BAYER) .new_bayer (0), // was 1SENSOR12BITS_NEW_BAYER)
.EXTRA_PERIOD(100)
) simul_sensor12bits_3_i ( ) simul_sensor12bits_3_i (
.MCLK (PX3_MCLK), // input .MCLK (PX3_MCLK), // input
.MRST (PX3_MRST), // input .MRST (PX3_MRST), // input
...@@ -1691,7 +1744,8 @@ simul_axi_hp_wr #( ...@@ -1691,7 +1744,8 @@ simul_axi_hp_wr #(
.tDDO1 (SENSOR12BITS_TDDO1), .tDDO1 (SENSOR12BITS_TDDO1),
.trigdly (TRIG_LINES), // SENSOR12BITS_TRIGDLY), .trigdly (TRIG_LINES), // SENSOR12BITS_TRIGDLY),
.ramp (0),// SENSOR12BITS_RAMP), .ramp (0),// SENSOR12BITS_RAMP),
.new_bayer (0) // was 1SENSOR12BITS_NEW_BAYER) .new_bayer (0), // was 1SENSOR12BITS_NEW_BAYER)
.EXTRA_PERIOD(120)
) simul_sensor12bits_4_i ( ) simul_sensor12bits_4_i (
.MCLK (PX4_MCLK), // input .MCLK (PX4_MCLK), // input
.MRST (PX4_MRST), // input .MRST (PX4_MRST), // input
......
...@@ -79,17 +79,43 @@ ...@@ -79,17 +79,43 @@
// parameter SENSOR_IMAGE_TYPE2 = "NORM11", // 4", // parameter SENSOR_IMAGE_TYPE2 = "NORM11", // 4",
// parameter SENSOR_IMAGE_TYPE3 = "NORM12", // parameter SENSOR_IMAGE_TYPE3 = "NORM12",
parameter SENSOR_IMAGE_TYPE0 = "TEST01-1044X36", // "NORM13", // parameter SENSOR_IMAGE_TYPE0 = "TEST01-1044X36", // "NORM13",
parameter SENSOR_IMAGE_TYPE1 = "TEST01-1044X36", // "NORM13", // parameter SENSOR_IMAGE_TYPE1 = "TEST01-1044X36", // "NORM13",
parameter SENSOR_IMAGE_TYPE2 = "TEST01-1044X36", // "NORM14", // 4", // parameter SENSOR_IMAGE_TYPE2 = "TEST01-1044X36", // "NORM14", // 4",
parameter SENSOR_IMAGE_TYPE3 = "TEST01-1044X36", // "NORM15", // parameter SENSOR_IMAGE_TYPE3 = "TEST01-1044X36", // "NORM15",
// parameter SENSOR_IMAGE_TYPE0 = "TEST01-260X36", // "NORM13",
// parameter SENSOR_IMAGE_TYPE1 = "TEST01-260X36", // "NORM13",
parameter SIMULATE_CMPRS_CMODE0 = CMPRS_CBIT_CMODE_JPEG18, // parameter SENSOR_IMAGE_TYPE2 = "TEST01-260X36", // "NORM14", // 4",
parameter SIMULATE_CMPRS_CMODE1 = CMPRS_CBIT_CMODE_JPEG18, // parameter SENSOR_IMAGE_TYPE3 = "TEST01-260X36", // "NORM15",
parameter SIMULATE_CMPRS_CMODE2 = CMPRS_CBIT_CMODE_JP4,
parameter SIMULATE_CMPRS_CMODE3 = CMPRS_CBIT_CMODE_JP4,
// parameter SENSOR_IMAGE_TYPE0 = "TEST01-260X68", // "NORM13",
// parameter SENSOR_IMAGE_TYPE1 = "TEST01-260X68", // "NORM13",
// parameter SENSOR_IMAGE_TYPE2 = "TEST01-260X68", // "NORM14", // 4",
// parameter SENSOR_IMAGE_TYPE3 = "TEST01-260X68", // "NORM15",
// parameter SENSOR_IMAGE_TYPE0 = "260X260A", // "NORM13",
// parameter SENSOR_IMAGE_TYPE1 = "260X260A", // "NORM13",
// parameter SENSOR_IMAGE_TYPE2 = "260X260A", // "NORM14", // 4",
// parameter SENSOR_IMAGE_TYPE3 = "260X260A", // "NORM15",
parameter SENSOR_IMAGE_TYPE0 = "256X256A", // "NORM13",
parameter SENSOR_IMAGE_TYPE1 = "256X256A", // "NORM13",
parameter SENSOR_IMAGE_TYPE2 = "256X256A", // "NORM14", // 4",
parameter SENSOR_IMAGE_TYPE3 = "256X256A", // "NORM15",
// parameter SENSOR_IMAGE_TYPE0 = "512X512A", // "NORM13",
// parameter SENSOR_IMAGE_TYPE1 = "512X512A", // "NORM13",
// parameter SENSOR_IMAGE_TYPE2 = "512X512A", // "NORM14", // 4",
// parameter SENSOR_IMAGE_TYPE3 = "512X512A", // "NORM15",
//
parameter SIMULATE_CMPRS_CMODE0 = CMPRS_CBIT_CMODE_JP4, // CMPRS_CBIT_CMODE_JPEG18,
parameter SIMULATE_CMPRS_CMODE1 = CMPRS_CBIT_CMODE_JP4, // CMPRS_CBIT_CMODE_JPEG18,
parameter SIMULATE_CMPRS_CMODE2 = CMPRS_CBIT_CMODE_JP4, // CMPRS_CBIT_CMODE_JPEG18, // CMPRS_CBIT_CMODE_JP4,
parameter SIMULATE_CMPRS_CMODE3 = CMPRS_CBIT_CMODE_JP4, // CMPRS_CBIT_CMODE_JPEG18, // CMPRS_CBIT_CMODE_JP4,
// parameter SIMULATE_CMPRS_CMODE2 = CMPRS_CBIT_CMODE_JPEG18, // parameter SIMULATE_CMPRS_CMODE2 = CMPRS_CBIT_CMODE_JPEG18,
// parameter SIMULATE_CMPRS_CMODE3 = CMPRS_CBIT_CMODE_JPEG18, // parameter SIMULATE_CMPRS_CMODE3 = CMPRS_CBIT_CMODE_JPEG18,
// CMPRS_CBIT_CMODE_JPEG18, //input [31:0] cmode; // [13:9] color mode: // CMPRS_CBIT_CMODE_JPEG18, //input [31:0] cmode; // [13:9] color mode:
...@@ -134,8 +160,8 @@ ...@@ -134,8 +160,8 @@
parameter HISTOGRAM_START_PAGE = 20'h12345, parameter HISTOGRAM_START_PAGE = 20'h12345,
parameter FRAME_WIDTH_ROUND_BITS = 9, // multiple of 512 pixels (32 16-byte bursts) (11 - ful SDRAM page) parameter FRAME_WIDTH_ROUND_BITS = 9, // multiple of 512 pixels (32 16-byte bursts) (11 - ful SDRAM page)
parameter WOI_WIDTH= 1040, // 64, parameter WOI_WIDTH= 256, // 512, // 256, //1040, // 64,
parameter WOI_HEIGHT= 32, parameter WOI_HEIGHT= 256, // 512, // 256, // 64, // 32,
parameter QUADRANTS_PXD_HACT_VACT = 6'h01, // 2 bits each: data-0, hact - 1, vact - 2 parameter QUADRANTS_PXD_HACT_VACT = 6'h01, // 2 bits each: data-0, hact - 1, vact - 2
// 90-degree shifts for data [1:0], hact [3:2] and vact [5:4] // 90-degree shifts for data [1:0], hact [3:2] and vact [5:4]
......
...@@ -155,7 +155,7 @@ class X393SensCmprs(object): ...@@ -155,7 +155,7 @@ class X393SensCmprs(object):
x393Rtc = None x393Rtc = None
x393Membridge = None x393Membridge = None
def __init__(self, debug_mode=1,dry_mode=True, saveFileName=None): def __init__(self, debug_mode=1,dry_mode=True, saveFileName=None, nomargins = True): # False):
# global BUFFER_ADDRESS, BUFFER_LEN # global BUFFER_ADDRESS, BUFFER_LEN
global BUFFER_ADDRESS, BUFFER_LEN, COMMAND_ADDRESS, DATAIN_ADDRESS, DATAOUT_ADDRESS global BUFFER_ADDRESS, BUFFER_LEN, COMMAND_ADDRESS, DATAIN_ADDRESS, DATAOUT_ADDRESS
global BUFFER_ADDRESS_H2D, BUFFER_LEN_H2D, BUFFER_ADDRESS_D2H, BUFFER_LEN_D2H, BUFFER_ADDRESS_BIDIR, BUFFER_LEN_BIDIR global BUFFER_ADDRESS_H2D, BUFFER_LEN_H2D, BUFFER_ADDRESS_D2H, BUFFER_LEN_D2H, BUFFER_ADDRESS_BIDIR, BUFFER_LEN_BIDIR
...@@ -173,6 +173,13 @@ class X393SensCmprs(object): ...@@ -173,6 +173,13 @@ class X393SensCmprs(object):
SENSOR_DEFAULTS[x393_sensor.SENSOR_INTERFACE_HISPI]["height"]= vrlg.WOI_HEIGHT + 4 SENSOR_DEFAULTS[x393_sensor.SENSOR_INTERFACE_HISPI]["height"]= vrlg.WOI_HEIGHT + 4
SENSOR_DEFAULTS[x393_sensor.SENSOR_INTERFACE_HISPI]["top"]= 0 SENSOR_DEFAULTS[x393_sensor.SENSOR_INTERFACE_HISPI]["top"]= 0
SENSOR_DEFAULTS[x393_sensor.SENSOR_INTERFACE_HISPI]["left"]= 0 SENSOR_DEFAULTS[x393_sensor.SENSOR_INTERFACE_HISPI]["left"]= 0
if nomargins:
SENSOR_DEFAULTS[x393_sensor.SENSOR_INTERFACE_PARALLEL]["width"]= vrlg.WOI_WIDTH + 0 # 4
SENSOR_DEFAULTS[x393_sensor.SENSOR_INTERFACE_PARALLEL]["height"]= vrlg.WOI_HEIGHT + 0
SENSOR_DEFAULTS[x393_sensor.SENSOR_INTERFACE_HISPI]["width"]= vrlg.WOI_WIDTH + 0 #4
SENSOR_DEFAULTS[x393_sensor.SENSOR_INTERFACE_HISPI]["height"]= vrlg.WOI_HEIGHT + 0
print ("Using simulation size sensor defaults ",SENSOR_DEFAULTS) print ("Using simulation size sensor defaults ",SENSOR_DEFAULTS)
except: except:
...@@ -628,12 +635,15 @@ class X393SensCmprs(object): ...@@ -628,12 +635,15 @@ class X393SensCmprs(object):
# moved before camsync to have a valid timestamo w/o special waiting # moved before camsync to have a valid timestamo w/o special waiting
if verbose >0 : if verbose >0 :
print ("===================== MEMORY_SENSOR =========================") print ("===================== MEMORY_SENSOR =========================, mode= %d"%(cmode))
window_height_memory = window_height window_height_memory = window_height
if cmode==vrlg.CMPRS_CBIT_CMODE_JP4: if (cmode==vrlg.CMPRS_CBIT_CMODE_JP4) or (cmode==15): # vrlg.CMPRS_CBIT_CMODE_RAW):
window_height_memory &= 0xfff0 # do not need extra margins window_height_memory &= 0xfff0 # do not need extra margins
num_burst_in_line &= 0xfffe # make even (assuming left=0) num_burst_in_line &= 0xfffe # make even (assuming left=0)
print ("===================== Mode is JP4 or raw =========================")
else:
print ("===================== Mode is neither JP4 nor raw =========================")
self.x393Sensor.setup_sensor_memory ( self.x393Sensor.setup_sensor_memory (
num_sensor = num_sensor, # input [1:0] num_sensor; num_sensor = num_sensor, # input [1:0] num_sensor;
......
#!/usr/bin/env python
# encoding: utf-8
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
...@@ -47,7 +49,7 @@ except: ...@@ -47,7 +49,7 @@ except:
try: try:
outname = sys.argv[3] outname = sys.argv[3]
except IndexError: except IndexError:
outname = fname.replace(".tiff",".vh") outname = fname.replace(".tiff",".dat")
tif = Image.open(fname) tif = Image.open(fname)
......
/*!
* <b>Module:</b> simul_lwir160x120_telemetry
* @file simul_lwir160x120_telemetry.v
* @date 2019-04-01
* @author Andrey Filippov
*
* @brief Combine telemetry data into vospi packet payload
*
* @copyright Copyright (c) 2019 Elphel, Inc.
*
* <b>License </b>
*
* simul_lwir160x120_telemetry.v is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* simul_lwir160x120_telemetry.v is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/> .
*
* Additional permission under GNU GPL version 3 section 7:
* If you modify this Program, or any covered work, by linking or combining it
* with independent modules provided by the FPGA vendor only (this permission
* does not extend to any 3-rd party modules, "soft cores" or macros) under
* different license terms solely for the purpose of generating binary "bitstream"
* files and/or simulating the code, the copyright holders of this Program give
* you the right to distribute the covered work without those independent modules
* as long as the source code for them is available from the FPGA vendor free of
* charge, and there is no dependence on any encrypted modules for simulating of
* the combined code. This permission applies to you if the distributed code
* contains all the components and scripts required to completely simulate it
* with at least one of the Free Software programs.
*/
`timescale 1ns/1ps
module simul_lwir160x120_telemetry(
input clk,
input en, // write all telemetry, but average
input en_avg, // write frame average (may be simultaneous)
// telemetry data
input [15:0] telemetry_rev,
input [31:0] telemetry_time,
input [31:0] telemetry_status,
input [63:0] telemetry_srev,
input [31:0] telemetry_frame,
input [15:0] telemetry_mean,
input [15:0] telemetry_temp_counts,
input [15:0] telemetry_temp_kelvin,
input [15:0] telemetry_temp_last_kelvin,
input [31:0] telemetry_time_last_ms,
input [15:0] telemetry_agc_roi_top,
input [15:0] telemetry_agc_roi_left,
input [15:0] telemetry_agc_roi_bottom,
input [15:0] telemetry_agc_roi_right,
input [15:0] telemetry_agc_high,
input [15:0] telemetry_agc_low,
input [31:0] telemetry_video_format, //???
output reg [160*16-1:0] telemetry_a,
output reg [160*16-1:0] telemetry_b
);
always @(posedge clk) if (en) begin
telemetry_a <= {
telemetry_rev [15:0], // word 0
telemetry_time [31:0], // words 1.. 2
telemetry_status [31:0], // words 3.. 4
{8{16'b0}}, // words 5..12
telemetry_srev [63:0], // words 13..16
{3{16'b0}}, // words 17..19
telemetry_frame [31:0], // words 20..21
en_avg?telemetry_mean[15:0]:telemetry_a[(159-22)*16 +: 16], // words 22
telemetry_temp_counts [15:0], // words 23
telemetry_temp_kelvin [15:0], // words 24
{4{16'b0}}, // words 25..28
telemetry_temp_last_kelvin[15:0], // words 29
telemetry_time_last_ms [31:0], // words 30..31
{2{16'b0}}, // words 32..33
telemetry_agc_roi_top [15:0], // words 34
telemetry_agc_roi_left [15:0], // words 35
telemetry_agc_roi_bottom [15:0], // words 36
telemetry_agc_roi_right [15:0], // words 37
telemetry_agc_high [15:0], // words 38
telemetry_agc_low [15:0], // words 39
{32{16'b0}}, // words 40..71
telemetry_video_format [31:0], // words 72..73
{86{16'b0}} // words 74..159
};
telemetry_b <= 0;
end else if (en_avg) begin
telemetry_a[(159-22)*16 +: 16] <= telemetry_mean[15:0];
end
endmodule
This diff is collapsed.
...@@ -55,7 +55,8 @@ module simul_sensor12bits # ( ...@@ -55,7 +55,8 @@ module simul_sensor12bits # (
parameter tDDO1 = 5, // parameter tDDO1 = 5, //
parameter trigdly = 8, // delay between trigger input and start of output (VACT) in lines parameter trigdly = 8, // delay between trigger input and start of output (VACT) in lines
parameter ramp = 1, // 1 - ramp, 0 - random (now - sensor.dat) parameter ramp = 1, // 1 - ramp, 0 - random (now - sensor.dat)
parameter new_bayer = 0 // 0 - old (16x16), 1 - new (18x18) parameter new_bayer = 0, // 0 - old (16x16), 1 - new (18x18)
parameter EXTRA_PERIOD = 0 // add these clockc before VACT
) ( ) (
input MCLK, // Master clock input MCLK, // Master clock
input MRST, // Master Reset - active low input MRST, // Master Reset - active low
...@@ -83,7 +84,7 @@ module simul_sensor12bits # ( ...@@ -83,7 +84,7 @@ module simul_sensor12bits # (
localparam s_lastline= 7; localparam s_lastline= 7;
localparam s_frame_done=8; localparam s_frame_done=8;
localparam t_preVACT= lline* trigdly; localparam t_preVACT= lline* trigdly + EXTRA_PERIOD;
localparam t_firstline=nrowb*lline+1; // 1664 localparam t_firstline=nrowb*lline+1; // 1664
localparam t_BPF= nbpf; // 16 localparam t_BPF= nbpf; // 16
localparam t_preHACT= ngp1; // 8 localparam t_preHACT= ngp1; // 8
...@@ -92,7 +93,9 @@ module simul_sensor12bits # ( ...@@ -92,7 +93,9 @@ module simul_sensor12bits # (
localparam t_lastline= nrowa*lline+1; // 1664 localparam t_lastline= nrowa*lline+1; // 1664
//reg [15:0] sensor_data[0:4095]; // up to 64 x 64 pixels // SuppressThisWarning VEditor - Will be assigned by $readmem //reg [15:0] sensor_data[0:4095]; // up to 64 x 64 pixels // SuppressThisWarning VEditor - Will be assigned by $readmem
reg [15:0] sensor_data[0:65535]; // up to 1024 x 64 pixels // SuppressThisWarning VEditor - Will be assigned by $readmem ///reg [15:0] sensor_data[0:65535]; // up to 1024 x 64 pixels // SuppressThisWarning VEditor - Will be assigned by $readmem
reg [15:0] sensor_data[0: nrows * ncols -1]; // up to 1024 x 64 pixels // SuppressThisWarning VEditor - Will be assigned by $readmem
// $readmemh("sensor.dat",sensor_data); // $readmemh("sensor.dat",sensor_data);
...@@ -192,6 +195,11 @@ initial begin ...@@ -192,6 +195,11 @@ initial begin
else if (SENSOR_IMAGE_TYPE == "NORM15") $readmemh({`ROOTPATH,"/input_data/sensor_15.dat"},sensor_data); else if (SENSOR_IMAGE_TYPE == "NORM15") $readmemh({`ROOTPATH,"/input_data/sensor_15.dat"},sensor_data);
else if (SENSOR_IMAGE_TYPE == "NORM16") $readmemh({`ROOTPATH,"/input_data/sensor_16.dat"},sensor_data); else if (SENSOR_IMAGE_TYPE == "NORM16") $readmemh({`ROOTPATH,"/input_data/sensor_16.dat"},sensor_data);
else if (SENSOR_IMAGE_TYPE == "TEST01-1044X36") $readmemh({`ROOTPATH,"/input_data/test01-1044x36.dat"},sensor_data); else if (SENSOR_IMAGE_TYPE == "TEST01-1044X36") $readmemh({`ROOTPATH,"/input_data/test01-1044x36.dat"},sensor_data);
else if (SENSOR_IMAGE_TYPE == "TEST01-260X36") $readmemh({`ROOTPATH,"/input_data/marching1_12b_260x36.dat"},sensor_data);
else if (SENSOR_IMAGE_TYPE == "TEST01-260X68") $readmemh({`ROOTPATH,"/input_data/marching1_12b_260x68.dat"},sensor_data);
else if (SENSOR_IMAGE_TYPE == "260X260A") $readmemh({`ROOTPATH,"/input_data/img260x260x12b.dat"},sensor_data);
else if (SENSOR_IMAGE_TYPE == "256X256A") $readmemh({`ROOTPATH,"/input_data/img256x256-12b.dat"},sensor_data);
else if (SENSOR_IMAGE_TYPE == "512X512A") $readmemh({`ROOTPATH,"/input_data/img516x516-12b.dat"},sensor_data);
else begin else begin
$display ("WARNING: Unrecognized sensor image :'%s', using default 'NORM': input_data/sensor.dat",SENSOR_IMAGE_TYPE); $display ("WARNING: Unrecognized sensor image :'%s', using default 'NORM': input_data/sensor.dat",SENSOR_IMAGE_TYPE);
$readmemh({`ROOTPATH,"/input_data/sensor.dat"},sensor_data); $readmemh({`ROOTPATH,"/input_data/sensor.dat"},sensor_data);
......
/*!
* <b>Module:</b> vospi
* @file vospi.v
* @date 2019-03-31
* @author Andrey Filippov
*
* @brief single packet ;processing with a ping-pong buffer
*
* @copyright Copyright (c) 2019 Elphel, Inc.
*
* <b>License </b>
*
* vospi.v is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* vospi.v is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/> .
*
* Additional permission under GNU GPL version 3 section 7:
* If you modify this Program, or any covered work, by linking or combining it
* with independent modules provided by the FPGA vendor only (this permission
* does not extend to any 3-rd party modules, "soft cores" or macros) under
* different license terms solely for the purpose of generating binary "bitstream"
* files and/or simulating the code, the copyright holders of this Program give
* you the right to distribute the covered work without those independent modules
* as long as the source code for them is available from the FPGA vendor free of
* charge, and there is no dependence on any encrypted modules for simulating of
* the combined code. This permission applies to you if the distributed code
* contains all the components and scripts required to completely simulate it
* with at least one of the Free Software programs.
*/
`timescale 1ns/1ps
module vospi(
input clk,
input srst,
input [15:0] data_in,
output packet_rdy, // @clk
input sck, // SPI clk
input ncs, // SPI active-low CS
output miso // SPI data out
);
endmodule
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
`define PRELOAD_BRAMS `define PRELOAD_BRAMS
`define DISPLAY_COMPRESSED_DATA `define DISPLAY_COMPRESSED_DATA
// if HISPI is not defined, parallel sensor interface is used for all channels // if HISPI is not defined, parallel sensor interface is used for all channels
// `define HISPI /*************** CHANGE here and x393_hispi/x393_parallel in bitstream tool settings ****************/ `define HISPI /*************** CHANGE here and x393_hispi/x393_parallel in bitstream tool settings ****************/
`define MON_HISPI // Measure HISPI timing `define MON_HISPI // Measure HISPI timing
// `define USE_OLD_XDCT393 // `define USE_OLD_XDCT393
// `define USE_PCLK2X // `define USE_PCLK2X
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment