Commit f3cc7226 authored by Andrey Filippov's avatar Andrey Filippov

continue debugging, about to changecmprs_afi_mux to correctly handle roll-over

parent 84c24b0a
...@@ -62,42 +62,42 @@ ...@@ -62,42 +62,42 @@
<link> <link>
<name>vivado_logs/VivadoBitstream.log</name> <name>vivado_logs/VivadoBitstream.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoBitstream-20150907111447874.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoBitstream-20150909225646571.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoOpt.log</name> <name>vivado_logs/VivadoOpt.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoOpt-20150907111447874.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoOpt-20150909225646571.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoOptPhys.log</name> <name>vivado_logs/VivadoOptPhys.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoOptPhys-20150907111447874.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoOptPhys-20150909225646571.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoOptPower.log</name> <name>vivado_logs/VivadoOptPower.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoOptPower-20150907111447874.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoOptPower-20150909225646571.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoPlace.log</name> <name>vivado_logs/VivadoPlace.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoPlace-20150907111447874.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoPlace-20150909225646571.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoRoute.log</name> <name>vivado_logs/VivadoRoute.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoRoute-20150907111447874.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoRoute-20150909225646571.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoSynthesis.log</name> <name>vivado_logs/VivadoSynthesis.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoSynthesis-20150907111447874.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoSynthesis-20150909224841524.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoTimimgSummaryReportImplemented.log</name> <name>vivado_logs/VivadoTimimgSummaryReportImplemented.log</name>
<type>1</type> <type>1</type>
<location>/home/andrey/git/x393/vivado_logs/VivadoTimimgSummaryReportImplemented-20150907111447874.log</location> <location>/home/andrey/git/x393/vivado_logs/VivadoTimimgSummaryReportImplemented-20150909225646571.log</location>
</link> </link>
<link> <link>
<name>vivado_logs/VivadoTimimgSummaryReportSynthesis.log</name> <name>vivado_logs/VivadoTimimgSummaryReportSynthesis.log</name>
......
...@@ -963,7 +963,7 @@ module jp_channel#( ...@@ -963,7 +963,7 @@ module jp_channel#(
.wrst (xrst2xn), // input mostly for simulation .wrst (xrst2xn), // input mostly for simulation
.we (stuffer_dv), // @ posedge(~xclk2x) input write data from stuffer .we (stuffer_dv), // @ posedge(~xclk2x) input write data from stuffer
.wdata (stuffer_do), // input[15:0] data from stuffer module; .wdata ({stuffer_do[7:0],stuffer_do[15:8]}), // input[15:0] data from stuffer module;
.wa_rst (!stuffer_en), // input reset low address bits when stuffer is disabled (to make sure it is multiple of 32 bytes .wa_rst (!stuffer_en), // input reset low address bits when stuffer is disabled (to make sure it is multiple of 32 bytes
.wlast (stuffer_done), // input - written last 32 bytes of a frame (flush FIFO) - stuffer_done (has to be later than we) .wlast (stuffer_done), // input - written last 32 bytes of a frame (flush FIFO) - stuffer_done (has to be later than we)
.eof_written_wclk (eof_written_xclk2xn), // output - AFI had transferred frame data to the system memory .eof_written_wclk (eof_written_xclk2xn), // output - AFI had transferred frame data to the system memory
......
parameter FPGA_VERSION = 32'h0393001f; parameter FPGA_VERSION = 32'h03930021;
\ No newline at end of file \ No newline at end of file
...@@ -564,7 +564,7 @@ class X393Jpeg(object): ...@@ -564,7 +564,7 @@ class X393Jpeg(object):
"huffman": self.huff_tables[FPGA_HUFFMAN_TABLE]} "huffman": self.huff_tables[FPGA_HUFFMAN_TABLE]}
def jpeg_header_353 (self): def jpeg_header_353 (self):
return bytearray(( return bytearray((
0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0xfe, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01,
0x00, 0x01, 0x00, 0x00, 0xff, 0xdb, 0x00, 0x43, 0x00, 0x06, 0x04, 0x05, 0x06, 0x05, 0x04, 0x06, 0x00, 0x01, 0x00, 0x00, 0xff, 0xdb, 0x00, 0x43, 0x00, 0x06, 0x04, 0x05, 0x06, 0x05, 0x04, 0x06,
0x06, 0x05, 0x06, 0x07, 0x07, 0x06, 0x08, 0x0a, 0x10, 0x0a, 0x0a, 0x09, 0x09, 0x0a, 0x14, 0x0e, 0x06, 0x05, 0x06, 0x07, 0x07, 0x06, 0x08, 0x0a, 0x10, 0x0a, 0x0a, 0x09, 0x09, 0x0a, 0x14, 0x0e,
0x0f, 0x0c, 0x10, 0x17, 0x14, 0x18, 0x18, 0x17, 0x14, 0x16, 0x16, 0x1a, 0x1d, 0x25, 0x1f, 0x1a, 0x0f, 0x0c, 0x10, 0x17, 0x14, 0x18, 0x18, 0x17, 0x14, 0x16, 0x16, 0x1a, 0x1d, 0x25, 0x1f, 0x1a,
...@@ -603,4 +603,7 @@ class X393Jpeg(object): ...@@ -603,4 +603,7 @@ class X393Jpeg(object):
0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe2, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe2,
0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
0xfa, 0xff, 0xda, 0x00, 0x0c, 0x03, 0x01, 0x00, 0x02, 0x11, 0x03, 0x11, 0x00, 0x3f, 0x00)) 0xfa, 0xff, 0xda, 0x00, 0x0c, 0x03, 0x01, 0x00, 0x02, 0x11, 0x03, 0x11, 0x00, 0x3f, 0x00))
\ No newline at end of file """
ff d9
"""
\ No newline at end of file
...@@ -145,6 +145,61 @@ class X393Mem(object): ...@@ -145,6 +145,61 @@ class X393Mem(object):
print("") print("")
return rslt return rslt
def mem_save (self, filename, start_addr, length):
'''
Save physical memory content to a file
@param filename - path to a file
@param start_addr physical byte start address
@param length - number of bytes to save
'''
if self.DRY_MODE:
print ("Write memory to file is not implemented in non-target mode")
return
with open(filename, "w+b") as sf:
with open("/dev/mem", "r+b") as f:
first_page = start_addr // self.PAGE_SIZE
last_page = (start_addr + length - 1) // self.PAGE_SIZE
for page_num in range(first_page, last_page+1):
start_offset = 0
if page_num == first_page:
start_offset = start_addr - self.PAGE_SIZE * page_num
end_offset = self.PAGE_SIZE
if page_num == last_page:
end_offset = start_addr + length - self.PAGE_SIZE * page_num
page_addr = page_num * self.PAGE_SIZE
if (page_addr>=0x80000000):
page_addr-= (1<<32)
mm = mmap.mmap(f.fileno(), self.PAGE_SIZE, offset=page_addr)
sf.write(mm[start_offset:end_offset])
def mem_clear (self, start_addr, length, word32):
'''
Fill physical memory range with a repetitive 32-bit word
@param start_addr physical byte start address
@param length - number of bytes to save
@param word32 - 32-bit pattern
'''
if self.DRY_MODE:
print ("Write memory to file is not implemented in non-target mode")
return
patt=str(bytearray(((word32 & 0xff), ((word32 >> 8) & 0xff), ((word32 >> 16) & 0xff), ((word32 >> 24) & 0xff)))*(self.PAGE_SIZE/4))
with open("/dev/mem", "r+b") as f:
first_page = start_addr // self.PAGE_SIZE
last_page = (start_addr + length - 1) // self.PAGE_SIZE
for page_num in range(first_page, last_page+1):
start_offset = 0
if page_num == first_page:
start_offset = start_addr - self.PAGE_SIZE * page_num
end_offset = self.PAGE_SIZE
if page_num == last_page:
end_offset = start_addr + length - self.PAGE_SIZE * page_num
page_addr = page_num * self.PAGE_SIZE
if (page_addr>=0x80000000):
page_addr-= (1<<32)
mm = mmap.mmap(f.fileno(), self.PAGE_SIZE, offset=page_addr)
mm[start_offset:end_offset] = patt[start_offset:end_offset]
def mem_fill (self, start_addr, start_data=0, end_addr=1, inc_data=0, byte_mode=4): def mem_fill (self, start_addr, start_data=0, end_addr=1, inc_data=0, byte_mode=4):
''' '''
Read and print memory range from physical memory Read and print memory range from physical memory
......
...@@ -662,7 +662,7 @@ class X393SensCmprs(object): ...@@ -662,7 +662,7 @@ class X393SensCmprs(object):
self.x393Camsync.camsync_setup ( self.x393Camsync.camsync_setup (
sensor_mask = sensor_mask, sensor_mask = sensor_mask,
trigger_mode = False, #False - async (free running) sensor mode, True - triggered (global reset) sensor mode trigger_mode = False, # False - async (free running) sensor mode, True - triggered (global reset) sensor mode
ext_trigger_mode = False, # True - external trigger source, 0 - local FPGA trigger source ext_trigger_mode = False, # True - external trigger source, 0 - local FPGA trigger source
external_timestamp = False, # True - use received timestamp in the image file, False - use local timestamp external_timestamp = False, # True - use received timestamp in the image file, False - use local timestamp
camsync_period = None, camsync_period = None,
......
...@@ -80,7 +80,7 @@ module x393_testbench02 #( ...@@ -80,7 +80,7 @@ module x393_testbench02 #(
`include "includes/x393_cur_params_target.vh" // SuppressThisWarning VEditor - not used parameters that may need adjustment, should be before x393_localparams.vh `include "includes/x393_cur_params_target.vh" // SuppressThisWarning VEditor - not used parameters that may need adjustment, should be before x393_localparams.vh
parameter TRIGGER_MODE = 0; // 1; // 0 - auto, 1 - triggered parameter TRIGGER_MODE = 0; // 1; // 0 - auto, 1 - triggered
parameter EXT_TRIGGER_MODE = 1 ; // 0 - internal, 1 - external trigger (camsync) parameter EXT_TRIGGER_MODE = 1 ; // 0 - internal, 1 - external trigger (camsync)
parameter EXTERNAL_TIMESTAMP = 1 ; // embed local timestamp, 1 - embed received timestamp parameter EXTERNAL_TIMESTAMP = 0; // 1 ; // embed local timestamp, 1 - embed received timestamp
`include "includes/x393_localparams.vh" // SuppressThisWarning VEditor - not used `include "includes/x393_localparams.vh" // SuppressThisWarning VEditor - not used
// VDT - incorrect real number calculation // VDT - incorrect real number calculation
...@@ -1006,6 +1006,7 @@ assign #10 gpio_pins[9] = gpio_pins[8]; ...@@ -1006,6 +1006,7 @@ assign #10 gpio_pins[9] = gpio_pins[8];
afi_mux_setup ( afi_mux_setup (
4'hf, // input [3:0] chn_mask; 4'hf, // input [3:0] chn_mask;
/*
'h10000000 >> 5, // input [26:0] afi_cmprs0_sa; // input [26:0] sa; // start address in 32-byte chunks 'h10000000 >> 5, // input [26:0] afi_cmprs0_sa; // input [26:0] sa; // start address in 32-byte chunks
'h10000 >> 5, // input [26:0] afi_cmprs0_len; // input [26:0] length; // channel buffer length in 32-byte chunks 'h10000 >> 5, // input [26:0] afi_cmprs0_len; // input [26:0] length; // channel buffer length in 32-byte chunks
'h10010000 >> 5, // input [26:0] afi_cmprs1_sa; // input [26:0] sa; // start address in 32-byte chunks 'h10010000 >> 5, // input [26:0] afi_cmprs1_sa; // input [26:0] sa; // start address in 32-byte chunks
...@@ -1014,7 +1015,15 @@ assign #10 gpio_pins[9] = gpio_pins[8]; ...@@ -1014,7 +1015,15 @@ assign #10 gpio_pins[9] = gpio_pins[8];
'h10000 >> 5, // input [26:0] afi_cmprs2_len; // input [26:0] length; // channel buffer length in 32-byte chunks 'h10000 >> 5, // input [26:0] afi_cmprs2_len; // input [26:0] length; // channel buffer length in 32-byte chunks
'h10030000 >> 5, // input [26:0] afi_cmprs3_sa; // input [26:0] sa; // start address in 32-byte chunks 'h10030000 >> 5, // input [26:0] afi_cmprs3_sa; // input [26:0] sa; // start address in 32-byte chunks
'h10000 >> 5); // input [26:0] afi_cmprs3_len; // input [26:0] length; // channel buffer length in 32-byte chunks 'h10000 >> 5); // input [26:0] afi_cmprs3_len; // input [26:0] length; // channel buffer length in 32-byte chunks
*/
'h10000000 >> 5, // input [26:0] afi_cmprs0_sa; // input [26:0] sa; // start address in 32-byte chunks
'h800 >> 5, // input [26:0] afi_cmprs0_len; // input [26:0] length; // channel buffer length in 32-byte chunks
'h10010000 >> 5, // input [26:0] afi_cmprs1_sa; // input [26:0] sa; // start address in 32-byte chunks
'h400 >> 5, // input [26:0] afi_cmprs1_len; // input [26:0] length; // channel buffer length in 32-byte chunks
'h10020000 >> 5, // input [26:0] afi_cmprs2_sa; // input [26:0] sa; // start address in 32-byte chunks
'h200 >> 5, // input [26:0] afi_cmprs2_len; // input [26:0] length; // channel buffer length in 32-byte chunks
'h10030000 >> 5, // input [26:0] afi_cmprs3_sa; // input [26:0] sa; // start address in 32-byte chunks
'h100 >> 5); // input [26:0] afi_cmprs3_len; // input [26:0] length; // channel buffer length in 32-byte chunks
camsync_setup ( camsync_setup (
4'hf ); // sensor_mask); // 4'hf ); // sensor_mask); //
...@@ -2583,7 +2592,7 @@ task camsync_setup; ...@@ -2583,7 +2592,7 @@ task camsync_setup;
input [3:0] sensor_mask; input [3:0] sensor_mask;
reg trigger_mode; // 0 - auto, 1 - triggered reg trigger_mode; // 0 - auto, 1 - triggered
reg ext_trigger_mode; // 0 - internal, 1 - external trigger (camsync) reg ext_trigger_mode; // 0 - internal, 1 - external trigger (camsync)
reg external_timestamp; // embed local timestamp, 1 - embed received timestamp reg external_timestamp; // 0 - embed local timestamp, 1 - embed received timestamp
reg [31:0] camsync_period; reg [31:0] camsync_period;
reg [31:0] camsync_delay; reg [31:0] camsync_delay;
// reg [ 3:0] sensor_mask; // reg [ 3:0] sensor_mask;
......
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