Skip to content
Snippets Groups Projects
Commit 088ccd50 authored by Pieter Donker's avatar Pieter Donker
Browse files

Task #893: backup and now round up to power of 2

parent b7af9ff9
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,7 @@ peripherals:
The real and the imaginary parts are concatenated: W_real in Lower part. W_imag in Higher part."
slave_discription: |
" "
-
# ram_ss_ss_wide
slave_prefix : BF
......@@ -45,12 +46,13 @@ peripherals:
fields:
-
field_name : ss_ss_wide
width: ceil_log2(g_bf.nof_subbands * c_nof_signal_paths_per_stream)
number_of_fields: g_bf.nof_input_streams * c_nof_signal_paths_per_stream # 16*4=64, nof_input_streams*nof_signal_paths_per_stream
width : 32
number_of_fields: g_bf.nof_subbands * g_bf.nof_input_streams * c_nof_signal_paths_per_stream # 16*4=64, nof_input_streams*nof_signal_paths_per_stream
field_description: |
"Contains the addresses to select from the stored subbands."
slave_discription: |
" "
-
# ram_st_sst_bf
slave_prefix : BF
......@@ -68,6 +70,7 @@ peripherals:
"Contains the weights.
The real and the imaginary parts are concatenated: W_real in Lower part. W_imag in Higher part."
slave_discription: |
-
# reg_st_sst_bf
slave_prefix : BF
......@@ -86,5 +89,6 @@ peripherals:
The a-input of the multiplier is updated every treshold clockcycle. Thereby cross statistics can be created."
slave_discription: |
" "
peripheral_description: |
"This is the beamformer unit"
......@@ -147,7 +147,7 @@ peripherals:
-
field_name : ram
width : g_data_w
number_of_fields: 2**ceil_log2(g_buf_nof_data)
number_of_fields: g_buf_nof_data
field_description: |
"Contains the data that is being captured."
slave_description: ""
......
......@@ -70,7 +70,8 @@ class RAM(BaseObject):
n_words = 0
for field in self.fields.values():
n_words += int(ceil(float(field.width()) / c_word_w)) * field.number_of_fields()
logger.debug("n_words=%d", n_words)
n_words = 2**ceil_log2(n_words)
self.set_kv('address_length', n_words)
def address_length(self, val=None):
......
......@@ -77,8 +77,8 @@ class Register(BaseObject):
n_words = 0
for field in self.fields.values():
n_words += int(ceil(float(field.width()) / c_word_w)) * field.number_of_fields()
self.set_kv('address_length', n_words) # ceil_pow2(n_words))
n_words = ceil_pow2(n_words) # round up to power of 2
self.set_kv('address_length', n_words)
def address_length(self, val=None):
""" set/get address_length of register
......
......@@ -176,12 +176,8 @@ class RomSystem(object):
for peripheral in peripherals.values():
nof_peri_inst = peripheral.number_of_peripherals()
for rkey, rval in peripheral.rams.items():
#n_addresses = rval.get_kv('address_length')
n_addresses = 0
for fkey, fval in rval.fields.items():
# n_words = width in bits rounded up to wordt_size bits
n_words = int(ceil(float(fval.width()) / self.word_size))
n_addresses += n_words * fval.number_of_fields()
n_addresses = rval.get_kv('address_length')
nof_inst = rval.number_of_slaves() * peripheral.number_of_peripherals()
if rval.user_defined_name() is not None:
_name = rval.user_defined_name()
......@@ -191,13 +187,15 @@ class RomSystem(object):
size_info.append([n_addresses, nof_inst, _name])
for rkey, rval in peripheral.registers.items():
n_addresses = 0
n_words = 0
for fkey, fval in rval.fields.items():
n_words = max(n_words, int(ceil(float(fval.width()) / float(self.word_size))))
n_addresses = max(n_addresses, fval.address_offset())
n_addresses = rval.get_kv('address_length')
n_addresses += 1
#n_addresses = 0
#n_words = 0
#for fkey, fval in rval.fields.items():
# n_words = max(n_words, int(ceil(float(fval.width()) / float(self.word_size))))
# n_addresses = max(n_addresses, fval.address_offset())
#
#n_addresses += 1
nof_inst = rval.number_of_slaves() * peripheral.number_of_peripherals()
if rval.user_defined_name() is not None:
_name = rval.user_defined_name()
......@@ -206,7 +204,8 @@ class RomSystem(object):
if _name.upper() in ('.REG_SYSTEM_INFO.', '.ROM_SYSTEM_INFO.', 'REG_SYSTEM_INFO', 'ROM_SYSTEM_INFO'):
continue
#print("%s %s" % (str(rkey), str(n_addresses * n_words)))
size_info.append([(n_addresses * n_words), nof_inst, _name])
#size_info.append([(n_addresses * n_words), nof_inst, _name])
size_info.append([n_addresses, nof_inst, _name])
size_info.sort(reverse=True)
for size, nof_inst, name in size_info:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment