Posted to tcl by cv19 at Mon May 03 21:10:15 GMT 2021view raw

  1. #########################################################
  2. # #
  3. # SDRAM_INIT #
  4. # BASE_ADDR: 0x0000_0000 #
  5. #########################################################
  6.  
  7. puts "Initializing SDRAM....."
  8. set start [clock seconds]
  9.  
  10. # Write some vertical lines to the screen
  11. # Starting at address 0x0, ending at address 0x2A300.
  12. #
  13. set addr [ format %x 0 ]
  14. for {set i 0} {$i < 720} {incr i} {
  15. for {set j 0} {$j < 1280} {incr j} {
  16. #DEBUG:
  17. puts "Writing Line: ${i}, Pixel: ${j} @ Address: ${addr}"
  18.  
  19. if {$j/3 < 427} { master_write_32 $mpath 0x$addr 0xFF000000
  20. } elseif {$j/3 < 854} { master_write_32 $mpath 0x$addr 0x00FF0000
  21. } else { master_write_32 $mpath 0x$addr 0x0000FF00 }
  22.  
  23. #DEBUG:
  24. puts [master_read_32 $mpath 0x$addr 1]
  25.  
  26. set addr [ format %x [ expr {"0x$addr" + 0x4} ] ]
  27. }
  28. }
  29.  
  30. set end [clock seconds]
  31. set min [expr {($end-$start)/60}]
  32. #DEBUG: puts "secs: [expr {$end-$start}] mins: ${min}"
  33. puts "SDRAM written in ${min} minutes, [expr {($end-$start)-(60*$min)}] seconds."