Community
cancel
Showing results for 
Search instead for 
Did you mean: 
skon
Beginner
1,181 Views

Reading a file from external memory via System Console

Hello,

 

My design captures images from an external video source and records them to DDR3.

In addition to my custom logic, I also have a Jtag to Avalog master connected the DDR3 controller (via Qsys).

Is it possible to save a section of the memory (representing a single image) into a file on my hard drive via System Console ?

0 Kudos
4 Replies
RParks
Novice
66 Views

I've done something similar so this might help:

 

proc DDR3_read_to_file {} {

  set imagefile [open "C:/Users/RParks/system_console/scripts/image_read.mem" w]

  # set imagefile [open "/root/system_console/scripts/image_read.mem" w]

   

  set read_data [<ddr_read_command> <addr> <length>]

  # puts $read_data

   

  puts $imagefile [format "%s" $read_data]

   

  close $imagefile

}

skon
Beginner
66 Views

Hi,

Thanks for the reply.

 

But where in your script do you specify the DDR3 address range that you want to be copied to the file ?

RParks
Novice
66 Views

Hi, so my solution wasn't for DDR3 and you'd need to customise it for your system but in mine I wrote a separate proc <ddr_read_command> which took 2 arguments, the address and length.

 

The below might be a helpful starting point for you to write your own:

 

proc memory_rd_cmd {addr length} {

  variable claimed_path

   

  set readdata {}

  for {set i 0} {$i < $length} {incr i} {

    lappend readdata [master_read_32 $claimed_path [expr {$addr+$i}] 1]

  }

  return $readdata

}

skon
Beginner
66 Views

Thanks.

I'll try it.

 

I thought I'd easily find an online example for this exact scenario - but I can't.

Reply