diff --git a/tools/oneclick/prestudy/YAML/peripheral.py b/tools/oneclick/prestudy/YAML/peripheral.py index d3690dc7713337edfdbf91f95b5485a43b798738..9a358fb93b78f31330610cdaa07a4b75c1c46350 100644 --- a/tools/oneclick/prestudy/YAML/peripheral.py +++ b/tools/oneclick/prestudy/YAML/peripheral.py @@ -1,6 +1,6 @@ ############################################################################### # -# Copyright (C) 2012 +# Copyright (C) 2016 # ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/> # P.O.Box 2, 7990 AA Dwingeloo, The Netherlands # @@ -17,14 +17,19 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # +# Author Date +# HJ jan 2017 Original +# EK feb 2017 +# ############################################################################### ############################################################################### +import os import copy import yaml -from common import * +import common as cm field_modes = ["RO", "WO", "RW", "WP", "RR"] @@ -47,14 +52,14 @@ class Register: self.name = name self.fields = fields self.nof_inst = nof_inst - self.depth = self.nof_inst*2**ceil_log2(len(fields)) + self.depth = self.nof_inst * cm.ceil_pow2(len(fields)) def addField(self, name, width, mode, offset, default, descr): self.fields.append(Field(name, width, mode, offset, default, descr)) - self.depth = self.nof_inst*2**ceil_log2(len(fields)) + self.depth = self.nof_inst * cm.ceil_pow2(len(fields)) def setDepth(self): - self.depth = self.nof_inst*2**ceil_log2(len(self.fields)) + self.depth = self.nof_inst * cm.ceil_pow2(len(self.fields)) def setNof_inst(self, nof_inst): self.nof_inst = nof_inst @@ -119,9 +124,12 @@ class Peripheral: exec("%s = %d" % (parameter, self.parameters[parameter])) # Here the parameters of the peripheral are promoted to real python variables for ram in self.rams: ram.name = ram.name + self.postfix - ram.depth = self.nof_inst * 2 ** ceil_log2(eval(str(ram.depth))) # Here the variables are used to evaluate the true value for the depth parameter(taking int account the nof_inst as well) + print ram.depth + ram.depth = self.nof_inst * cm.ceil_pow2(eval(str(ram.depth))) # Here the variables are used to evaluate the true value for the depth parameter(taking int account the nof_inst as well) + print ram.depth print ram.width ram.width = eval(str(ram.width)) # Here the variables are used to evaluate the true value for the width parameter. + print ram.width print " " + ram.name + " " + "depth: " + str(ram.depth) print " " + ram.name + " " + "width: " + str(ram.width) @@ -163,7 +171,7 @@ class PeripheralLibrary: """Store the dictionaries from all fileName files in rootDir.""" self.rootDir = rootDir self.fileName = fileName # all peripheral files have the same fileName - self.filePaths = find_all_file_paths(rootDir, fileName) # list of all directory paths of peripheral files that are available in the rootDir tree + self.filePaths = cm.find_all_file_paths(rootDir, fileName) # list of all directory paths of peripheral files that are available in the rootDir tree if len(self.filePaths)==0: sys.exit('Error : No %s file found in %s directory tree.' % (fileName, rootDir)) self.filePathNames = [] # list of all directory paths + fileName of the available peripheral files