Nios Memory calculations

Taken from Excel file of Florian

Settings CoE


In [14]:
import numpy as np
import math

def nios_memory_calculations(MemSection_width, MemSection_depth, MEMORY_SIZE, FrameSize, subpx):
  # calculations
  m_Data_frame_length = FrameSize

  numberOfSections = math.floor(float(MEMORY_SIZE)/float(MemSection_width*MemSection_depth))
  usableMemSize    = int(numberOfSections * (MemSection_width*MemSection_depth))


  m_number_of_sections = MEMORY_SIZE/(MemSection_width*MemSection_depth)
  m_N_Mem_Rows         = MemSection_width
  m_Section_Size       = (MemSection_width*MemSection_depth)/m_Data_frame_length # in frame numbers
  N_Frames_DDR_TH      = usableMemSize / m_Data_frame_length                     # number of frames for the full memory
  Mem_Row_Size_Frame   = N_Frames_DDR_TH / m_N_Mem_Rows                          # number of frames for the depth direction
  m_Mem_Row_Size       = Mem_Row_Size_Frame * m_Data_frame_length                # memory depth size in bytes
  m_N_Mem_Rows_Inv     = (2**32)/m_N_Mem_Rows                                    # ?

  print("-- Nios Memory Calculations ------")
  print("m_number_of_sections : {0:8} (0x{0:X})".format(int(m_number_of_sections)))
  print("m_N_Mem_Rows         : {0:8} (0x{0:X})".format(int(m_N_Mem_Rows)))
  print("m_Section_Size       : {0:8} (0x{0:X})".format(int(m_Section_Size)))
  print("N_Frames_DDR_TH      : {0:8} (0x{0:X})".format(int(N_Frames_DDR_TH)))
  print("Mem_Row_Size_Frame   : {0:8} (0x{0:X})".format(int(Mem_Row_Size_Frame)))
  print("m_Mem_Row_Size       : {0:8} (0x{0:X})".format(int(m_Mem_Row_Size)))
  print("m_N_Mem_Rows_Inv     : {0:8} (0x{0:X})".format(int(m_N_Mem_Rows_Inv)))# memory
  print("")
  
def calmar_cb_testbench_memory_calculations(MemSection_width, MemSection_depth, MEMORY_SIZE, FrameSize, subpx):
  # calculations
  m_Data_frame_length = FrameSize

  numberOfSections = math.floor(float(MEMORY_SIZE)/float(MemSection_width*MemSection_depth))
  usableMemSize    = int(numberOfSections * (MemSection_width*MemSection_depth))


  m_number_of_sections = MEMORY_SIZE/(MemSection_width*MemSection_depth)
  m_N_Mem_Rows         = MemSection_width
  m_Section_Size       = (MemSection_width*MemSection_depth)/m_Data_frame_length # in frame numbers
  N_Frames_DDR_TH      = usableMemSize / m_Data_frame_length                     # number of frames for the full memory
  Mem_Row_Size_Frame   = N_Frames_DDR_TH / m_N_Mem_Rows                          # number of frames for the depth direction
  m_Mem_Row_Size       = Mem_Row_Size_Frame * m_Data_frame_length                # memory depth size in bytes
  m_N_Mem_Rows_Inv     = (2**32)/m_N_Mem_Rows                                    # ?

  print("-- Calmar Controller Board Testbench ------")
  print("Memory Size     : {0:8} kBytes         (0x{0:X})".format(int(MEMORY_SIZE/1024)))
  print("Memory Rows     : {0:8} pixels (lines) (0x{0:X})".format(int(m_N_Mem_Rows)))
  print("Memory Row Size : {0:8} bytes          (0x{0:X})".format(int(m_Mem_Row_Size)))
  print("")

KonicaMinolta


In [15]:
# memory
MemSection_width = 1536*4
MemSection_depth = 8192
MEMORY_SIZE      = 1073741824  # Bytes
# ethernet
FrameSize = 8192
# fix values
subpx = 32  # scaling factor fpga

nios_memory_calculations(MemSection_width, MemSection_depth, MEMORY_SIZE, FrameSize, subpx)
calmar_cb_testbench_memory_calculations(MemSection_width, MemSection_depth, MEMORY_SIZE, FrameSize, subpx)


-- Nios Memory Calculations ------
m_number_of_sections :       21 (0x15)
m_N_Mem_Rows         :     6144 (0x1800)
m_Section_Size       :     6144 (0x1800)
N_Frames_DDR_TH      :   129024 (0x1F800)
Mem_Row_Size_Frame   :       21 (0x15)
m_Mem_Row_Size       :   172032 (0x2A000)
m_N_Mem_Rows_Inv     :   699050 (0xAAAAA)

-- Calmar Controller Board Testbench ------
Memory Size     :  1048576 kBytes         (0x100000)
Memory Rows     :     6144 pixels (lines) (0x1800)
Memory Row Size :   172032 bytes          (0x2A000)

Ricoh Gen5

Arcolor


In [16]:
# memory
MemSection_width = 2048*4
MemSection_depth = 24576
MEMORY_SIZE      = 1073741824  # Bytes
# ethernet
FrameSize = 8192
# fix values
subpx = 32  # scaling factor fpga

nios_memory_calculations(MemSection_width, MemSection_depth, MEMORY_SIZE, FrameSize, subpx)
calmar_cb_testbench_memory_calculations(MemSection_width, MemSection_depth, MEMORY_SIZE, FrameSize, subpx)


-- Nios Memory Calculations ------
m_number_of_sections :        5 (0x5)
m_N_Mem_Rows         :     8192 (0x2000)
m_Section_Size       :    24576 (0x6000)
N_Frames_DDR_TH      :   122880 (0x1E000)
Mem_Row_Size_Frame   :       15 (0xF)
m_Mem_Row_Size       :   122880 (0x1E000)
m_N_Mem_Rows_Inv     :   524288 (0x80000)

-- Calmar Controller Board Testbench ------
Memory Size     :  1048576 kBytes         (0x100000)
Memory Rows     :     8192 pixels (lines) (0x2000)
Memory Row Size :   122880 bytes          (0x1E000)