Commit 54b2c930 authored by Andrey Filippov's avatar Andrey Filippov

minor clean up

parent beb06b1f
......@@ -326,7 +326,7 @@
AWID_IN_r <= id;
AWADDR_IN_r <= addr;
AWLEN_IN_r <= len;
AWSIZE_IN_r <= 3'b010;
AWSIZE_IN_r <= 2'b10;
AWBURST_IN_r <= burst;
AW_SET_CMD_r <= 1'b1;
if (data_en && W_READY) begin
......@@ -414,14 +414,14 @@
ARID_IN_r <= id;
ARADDR_IN_r <= addr;
ARLEN_IN_r <= len;
ARSIZE_IN_r <= 3'b010;
ARSIZE_IN_r <= 2'b10;
ARBURST_IN_r <= burst;
AR_SET_CMD_r <= 1'b1;
wait (CLK);
ARID_IN_r <= 12'hz;
ARADDR_IN_r <= 'hz;
ARLEN_IN_r <= 4'hz;
ARSIZE_IN_r <= 3'hz;
ARSIZE_IN_r <= 2'hz;
ARBURST_IN_r <= 2'hz;
AR_SET_CMD_r <= 1'b0;
LAST_ARID <= id;
......
......@@ -997,10 +997,15 @@ print_status_sensor_io all
setup_all_sensors True None 0x4
################## Parallel ##################
cd /usr/local/verilog/; test_mcntrl.py @tpargs -x
cd /usr/local/verilog/; test_mcntrl.py @hargs
bitstream_set_path /usr/local/verilog/x393_parallel.bit
#fpga_shutdown
setupSensorsPower "PAR12"
#setupSensorsPower "PAR12"
setupSensorsPower "PAR12" all 0 0.0
measure_all "*DI"
setup_all_sensors True None 0xf
#set quadrants
......
......@@ -236,7 +236,12 @@ class X393SensCmprs(object):
def get_circbuf_byte_end(self): # should be 4KB page aligned
global BUFFER_ADDRESS, BUFFER_LEN
return BUFFER_ADDRESS + BUFFER_LEN
def sleep_ms(self, time_ms):
"""
Sleep for specified number of milliseconds
@param time_ms - sleep time in milliseconds
"""
time.sleep(0.001*time_ms)
def setSensorClock(self, freq_MHz = 24.0, iface = "2V5_LVDS", quiet = 0):
"""
Set up external clock for sensor-synchronous circuitry (and sensor(s) themselves.
......@@ -279,7 +284,14 @@ class X393SensCmprs(object):
print ("Set sensors %s interface voltage to %d mV"%(("0, 1","2, 3")[sub_pair],voltage_mv))
time.sleep(0.1)
def setupSensorsPower(self, ifaceType, pairs = "all", quiet=0):
def setupSensorsPower(self, ifaceType, pairs = "all", quiet=0, dly=0.1):
"""
Set interface voltage and turn on power for interface and the sensors
according to sensor type
@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 dly - debug feature: step delay in sec
"""
try:
if (pairs == all) or (pairs[0].upper() == "A"): #all is a built-in function
pairs = (0,1)
......@@ -288,44 +300,39 @@ class X393SensCmprs(object):
if not isinstance(pairs,(list,tuple)):
pairs = (pairs,)
for pair in pairs:
self.setSensorIfaceVoltagePower(pair, SENSOR_INTERFACES[ifaceType]["mv"])
self.setSensorIfaceVoltagePower(sub_pair = pair,
voltage_mv = SENSOR_INTERFACES[ifaceType]["mv"],
quiet = quiet,
dly = dly)
def setSensorIfaceVoltagePower(self, sub_pair, voltage_mv, quiet=0):
def setSensorIfaceVoltagePower(self, sub_pair, voltage_mv, quiet=0, dly=0.1):
"""
Set interface voltage and turn on power for interface and the sensors
@param sub_pair - pair of the sensors: 0 - sensors 1 and 2, 1 - sensors 3 and 4
@param voltage_mv - desired interface voltage (1800..2800 mv)
@param quiet - reduce output
@param dly - debug feature: step delay in sec
"""
self.setSensorPower(sub_pair = sub_pair, power_on = 0)
time.sleep(0.2)
time.sleep(2*dly)
self.setSensorIfaceVoltage(sub_pair=sub_pair, voltage_mv = voltage_mv)
time.sleep(0.2)
time.sleep(2*dly)
if self.DRY_MODE:
print ("Not defined for simulation mode")
return
if quiet == 0:
print ("Turning on interface power %f V for sensors %s"%(voltage_mv*0.001,("0, 1","2, 3")[sub_pair]))
time.sleep(0.3)
time.sleep(3*dly)
with open (POWER393_PATH + "/channels_en","w") as f:
print(("vcc_sens01", "vcc_sens23")[sub_pair], file = f)
if quiet == 0:
print ("Turned on interface power %f V for sensors %s"%(voltage_mv*0.001,("0, 1","2, 3")[sub_pair]))
time.sleep(0.3)
time.sleep(3*dly)
with open (POWER393_PATH + "/channels_en","w") as f:
print(("vp33sens01", "vp33sens23")[sub_pair], file = f)
if quiet == 0:
print ("Turned on +3.3V power for sensors %s"%(("0, 1","2, 3")[sub_pair]))
time.sleep(0.2)
# for sub_pair in (0,1):
# self.setSensorIfaceVoltagePower(sub_pair, SENSOR_INTERFACES[ifaceType]["mv"])
# def getSensorInterfaceType(self):
# """
# Get sensor interface type by reading status register 0xfe that is set to 0 for parallel and 1 for HiSPi
# @return "PAR12" or "HISPI"
# """
# return (SENSOR_INTERFACE_PARALLEL, SENSOR_INTERFACE_HISPI)[self.x393_axi_tasks.read_status(address=0xfe)] # "PAR12" , "HISPI"
time.sleep(2*dly)
def setupSensorsPowerClock(self, setPower=False, quiet=0):
......
......@@ -378,7 +378,7 @@ module sensor_i2c#(
if (reset_on) page_r <= 0;
else if (page_r_inc[0]) page_r <= page_r+1;
`else
if (reset_on) page_r <= frame_num_seq;
if (sync_to_seq) page_r <= frame_num_seq;
else if (page_r_inc[0]) page_r <= page_r+1;
`endif
......
......@@ -113,24 +113,24 @@ parameter NUM_INTERRUPTS = 9;
`ifdef SYNC_COMPRESS
parameter DEPEND=1'b1;
`else
parameter DEPEND=1'b0;
parameter DEPEND=1'b0; // SuppressThisWarning VEditor - may be not used
`endif
`ifdef TEST_ABORT
`endif
parameter SYNC_BIT_LENGTH=8-1; /// 7 pixel clock pulses
parameter FPGA_XTRA_CYCLES= 1500; // 1072+;
parameter FPGA_XTRA_CYCLES= 1500; // 1072+; // SuppressThisWarning VEditor - not used
// moved to x393_simulation_parameters.vh
// parameter HISTOGRAM_LEFT= 0; //2; // left
// parameter HISTOGRAM_TOP = 2; // top
// parameter HISTOGRAM_WIDTH= 6; // width
// parameter HISTOGRAM_HEIGHT=6; // height
parameter CLK0_PER = 6.25; //160MHz
parameter CLK1_PER = 10.4; //96MHz
parameter CLK3_PER = 83.33; //12MHz
parameter CPU_PER=10.4;
// parameter CLK0_PER = 6.25;
// parameter CLK1_PER = 10.4;
// parameter CLK3_PER = 83.33;
// parameter CPU_PER=10.4;
parameter TRIG_PERIOD = 6000 ;
`ifdef HISPI
......@@ -147,16 +147,16 @@ parameter NUM_INTERRUPTS = 9;
parameter WOI_HEIGHT= 32;
parameter TRIG_LINES= 8;
parameter VBLANK= 2; /// 2 lines //SuppressThisWarning Veditor UNUSED
parameter CYCLES_PER_PIXEL= 3; /// 2 for JP4, 3 for JPEG
parameter CYCLES_PER_PIXEL= 3; /// 2 for JP4, 3 for JPEG // SuppressThisWarning VEditor - not used
`ifdef PF
parameter PF_HEIGHT=8;
parameter FULL_HEIGHT=WOI_HEIGHT;
parameter PF_STRIPES=WOI_HEIGHT/PF_HEIGHT;
`else
parameter PF_HEIGHT=0;
parameter PF_HEIGHT=0; // SuppressThisWarning VEditor - not used
parameter FULL_HEIGHT=WOI_HEIGHT+4;
parameter PF_STRIPES=0;
parameter PF_STRIPES=0; // SuppressThisWarning VEditor - not used
`endif
parameter VIRTUAL_WIDTH= FULL_WIDTH + HBLANK;
......@@ -167,7 +167,7 @@ parameter NUM_INTERRUPTS = 9;
/// parameter TRIG_OUT_DATA= 'h80000; // internal cable
/// parameter TRIG_EXTERNAL_INPUT= 'h20000; // internal cable, low level on EXT[8]
parameter TRIG_DELAY= 200; /// delay in sensor clock cycles
parameter TRIG_DELAY= 200; /// delay in sensor clock cycles // SuppressThisWarning VEditor - not used
parameter FULL_WIDTH= WOI_WIDTH+4;
......@@ -630,7 +630,7 @@ assign #10 gpio_pins[9] = gpio_pins[8];
wire [NUM_INTERRUPTS-1:0] IRQ_ACKN;
wire [3:0] IRQ_FRSEQ_ACKN = IRQ_ACKN[3:0];
wire [3:0] IRQ_CMPRS_ACKN = IRQ_ACKN[7:4];
wire IRQ_SATA_ACKN = IRQ_ACKN[8];
wire IRQ_SATA_ACKN = IRQ_ACKN[8]; // SuppressThisWarning VEditor - not used
reg [3:0] IRQ_FRSEQ_DONE = 0;
reg [3:0] IRQ_CMPRS_DONE = 0;
reg IRQ_SATA_DONE = 0;
......@@ -643,25 +643,7 @@ assign #10 gpio_pins[9] = gpio_pins[8];
wire IRQS=|IRQ_S; // at least one interrupt is pending (to yield by main w/o slowing down)
wire [3:0] IRQ_FRSEQ_S = IRQ_S[3:0];
wire [3:0] IRQ_CMPRS_S = IRQ_S[7:4];
wire IRQ_SATA_S = IRQ_S[8];
/*
sim_soc_interrupts #(
.NUM_INTERRUPTS(8)
) sim_soc_interrupts_i (
.clk(), // input
.rst(), // input
.irq_en(), // input
.irqm(), // input[7:0]
.irq(), // input[7:0]
.irq_done(), // input[7:0]
.irqs(), // output[7:0]
.inta(), // output[7:0]
.main_go() // output
);
*/
wire IRQ_SATA_S = IRQ_S[8];// SuppressThisWarning VEditor - not used
reg AR_SET_CMD_r;
wire AR_READY;
......@@ -744,26 +726,11 @@ assign #10 gpio_pins[9] = gpio_pins[8];
integer NUM_WORDS_READ;
integer NUM_WORDS_EXPECTED;
reg [15:0] ENABLED_CHANNELS = 0; // currently enabled memory channels
// integer SCANLINE_CUR_X;
// integer SCANLINE_CUR_Y;
wire AXI_RD_EMPTY=NUM_WORDS_READ==NUM_WORDS_EXPECTED; //SuppressThisWarning VEditor : may be unused, just for simulation
reg [31:0] DEBUG_DATA;
integer DEBUG_ADDRESS;
//NUM_XFER_BITS=6
// localparam SCANLINE_PAGES_PER_ROW= (WINDOW_WIDTH>>NUM_XFER_BITS)+((WINDOW_WIDTH[NUM_XFER_BITS-1:0]==0)?0:1);
// localparam TILES_PER_ROW= (WINDOW_WIDTH/TILE_WIDTH)+ ((WINDOW_WIDTH % TILE_WIDTH==0)?0:1);
// localparam TILE_ROWS_PER_WINDOW= ((WINDOW_HEIGHT-1)/TILE_VSTEP) + 1;
// localparam TILE_SIZE= TILE_WIDTH*TILE_HEIGHT;
reg [31:0] DEBUG_DATA; //SuppressThisWarning VEditor : just for simulation viewing
integer DEBUG_ADDRESS; //SuppressThisWarning VEditor : just for simulation viewing
// localparam integer SCANLINE_FULL_XFER= 1<<NUM_XFER_BITS; // 64 - full page transfer in 8-bursts
// localparam integer SCANLINE_LAST_XFER= WINDOW_WIDTH % (1<<NUM_XFER_BITS); // last page transfer size in a row
// integer ii;
// integer SCANLINE_XFER_SIZE;
initial begin
......@@ -1658,6 +1625,15 @@ assign bvalid= x393_i.ps7_i.MAXIGP0BVALID;
assign x393_i.ps7_i.MAXIGP0BREADY= bready;
assign bid= x393_i.ps7_i.MAXIGP0BID;
assign bresp= x393_i.ps7_i.MAXIGP0BRESP;
// Next signals are not yet used in this simulation - see x393_sata project
reg EXTCLK_P = 1'b1;
reg EXTCLK_N = 1'b0;
wire rxn = 0;
wire rxp = 0;
wire txn; // SuppressThisWarning VEditor not yet unused
wire txp; // SuppressThisWarning VEditor not yet unused
//TODO: See how to show problems in include files opened in the editor (test all top *.v files that have it)
// Top module under test
x393 #(
......@@ -1910,7 +1886,13 @@ assign bresp= x393_i.ps7_i.MAXIGP0BRESP;
.ffclk0p (ffclk0p), // input
.ffclk0n (ffclk0n), // input
.ffclk1p (ffclk1p), // input
.ffclk1n (ffclk1n) // input
.ffclk1n (ffclk1n), // input
.RXN (rxn), // input
.RXP (rxp), // input
.TXN (txn), // output
.TXP (txp), // output
.EXTCLK_P(EXTCLK_P), // input
.EXTCLK_N(EXTCLK_N) // input
);
// just to simplify extra delays in tri-state memory bus - provide output enable
wire WRAP_MCLK=x393_i.mclk;
......@@ -3269,7 +3251,7 @@ task setup_sensor_channel;
end
endtask // setup_sensor_channel
task setup_sensor_membridge;
task setup_sensor_membridge; // SuppressThisWarning VEditor not always unused
input [1:0] num_sensor;
input disable_need;
input write_video_memory;
......@@ -3745,7 +3727,7 @@ task set_gpio_ports;
endtask
//x393_gpio.py
task set_gpio_pins;
task set_gpio_pins; // SuppressThisWarning VEditor not always unused
input [1:0] ext0; // 0 - nop, 1 - set "0", 2 - set "1", 3 - set as input
input [1:0] ext1; // 0 - nop, 1 - set "0", 2 - set "1", 3 - set as input
input [1:0] ext2; // 0 - nop, 1 - set "0", 2 - set "1", 3 - set as input
......@@ -4106,7 +4088,7 @@ task program_curves;
end
endtask
task program_huffman;
task program_huffman; // SuppressThisWarning VEditor not always unused
input [1:0] chn;
reg [29:0] reg_addr;
reg [23:0] huff_data[0:511]; // SuppressThisWarning VEditor : assigned in $readmem() system task
......@@ -4121,7 +4103,7 @@ task program_huffman;
end
endtask
task program_quantization;
task program_quantization; // SuppressThisWarning VEditor not always unused
input [1:0] chn;
reg [29:0] reg_addr;
reg [15:0] quant_data[0:255]; // Actually 4 pairs of tables, 1 table is just 64 words SuppressThisWarning VEditor : assigned in $readmem() system task
......@@ -4136,7 +4118,7 @@ task program_quantization;
end
endtask
task program_coring;
task program_coring; // SuppressThisWarning VEditor not always unused
input [1:0] chn;
reg [29:0] reg_addr;
reg [15:0] coring_data[0:1023]; // SuppressThisWarning VEditor : assigned in $readmem() system task
......@@ -4153,7 +4135,7 @@ endtask
task program_focus_filt;
task program_focus_filt; // SuppressThisWarning VEditor not always unused
input [1:0] chn;
reg [29:0] reg_addr;
reg [15:0] filt_data[0:127]; // SuppressThisWarning VEditor : assigned in $readmem() system task
......@@ -4304,7 +4286,7 @@ task set_sensor_histogram_saxi_addr;
endtask
// x393_sensor.py
function [STATUS_DEPTH-1:0] func_status_addr_sensor_i2c;
function [STATUS_DEPTH-1:0] func_status_addr_sensor_i2c; // SuppressThisWarning VEditor not always unused
input [1:0] num_sensor;
begin
func_status_addr_sensor_i2c = (SENSI2C_STATUS_REG_BASE + num_sensor * SENSI2C_STATUS_REG_INC + SENSI2C_STATUS_REG_REL);
......@@ -4312,7 +4294,7 @@ function [STATUS_DEPTH-1:0] func_status_addr_sensor_i2c;
endfunction
// x393_sensor.py
function [STATUS_DEPTH-1:0] func_status_addr_sensor_io;
function [STATUS_DEPTH-1:0] func_status_addr_sensor_io; // SuppressThisWarning VEditor not always unused
input [1:0] num_sensor;
begin
func_status_addr_sensor_io = (SENSI2C_STATUS_REG_BASE + num_sensor * SENSI2C_STATUS_REG_INC + SENSIO_STATUS_REG_REL);
......@@ -4448,7 +4430,7 @@ task frame_sequencer_irq_clear;
endtask
task ctrl_cmd_frame_sequencer;
task ctrl_cmd_frame_sequencer; // SuppressThisWarning VEditor not always unused
input [1:0] num_sensor; // sensor channel number
input reset; // reset sequencer (also stops)
input start; // start sequencer
......@@ -4466,7 +4448,7 @@ task ctrl_cmd_frame_sequencer;
endtask
// x393_frame_sequencer.py
task write_cmd_frame_sequencer;
task write_cmd_frame_sequencer; // SuppressThisWarning VEditor not always unused
input [1:0] num_sensor; // sensor channel number
input relative; // 0 - absolute (address = 0..f), 1 - relative (address= 0..e)
input [3:0] frame_addr; // frame address (relative or absolute)
......@@ -4976,7 +4958,11 @@ endtask
`include "includes/x393_tasks_mcntrl_timing.vh" // SuppressThisWarning VEditor - not used
`include "includes/x393_tasks_ps_pio.vh"
`include "includes/x393_tasks_status.vh"
`include "includes/x393_tasks01.vh"
`include "includes/x393_tasks01.vh" // SuppressThisWarning VEditor - some tasks may be unused
`include "includes/x393_mcontr_encode_cmd.vh"
// Save sensor data written to memory
......
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