def initialize_slave_lists(self):
        bus_type = self.controller.get_bus()
        paths = utils.get_local_verilog_paths()
        slave_list = utils.get_slave_list(bus_type, paths)

        peripheral_dict = {}
        memory_dict = {}

        for slave in slave_list:
            tags = vutils.get_module_tags(  filename = slave,
                                            keywords=["SDB_ABI_VERSION_MAJOR", "SDB_NAME"],
                                            bus = self.controller.get_bus(),
                                            user_paths = paths)
            #print "Tags: %s" % str(tags)
            #core_id = int(tags["keywords"]["SDB_NAME"])
            device_abi_major = int(tags["keywords"]["SDB_ABI_VERSION_MAJOR"], 0)
            memory_abi_major = device_manager.get_device_id_from_name("memory")
            if device_abi_major == memory_abi_major:
                memory_dict[tags["module"]] = tags
            else:
                peripheral_dict[tags["module"]] = tags

        self.project_actions.setup_peripheral_bus_list.emit(peripheral_dict)
        self.project_actions.setup_memory_bus_list.emit(memory_dict)
        #self.project_view.get_designer_scene().view.fit_in_view()
        self.project_actions.update_project_name.connect(self.actions.update_project_name)
        self.project_actions.add_constraint_file.connect(self.add_constraint)
        self.project_actions.remove_constraint_file.connect(self.remove_constraint)
        self.project_actions.add_default_board_constraint.connect(self.add_default_board_constraint)
        self.project_actions.remove_default_board_constraint.connect(self.remove_default_board_constraint)
        self.project_actions.commit_slave_parameters.connect(self.commit_slave_parameters)
        self.project_actions.commit_slave_integration_list.connect(self.commit_slave_integration_list)
Example #2
0
    def gen_som(self, tags = {}, buf = "", user_paths = [], debug = False):
        tags = copy.deepcopy(tags)
        self.rom_element_count = 0
        if "MEMORY" not in tags:
            tags["MEMORY"] = {}

        self.user_paths = user_paths
        board_name = tags["board"].lower()

        if not utils.board_exists(board_name):
            try:
                utils.install_remote_board_package(board_name)
            except IBuilderError as e:
                raise IBuilderError(                                            \
                                "Board %s could not be found, Attempted to "    \
                                "find it in the remote table and failed. If "   \
                                "this is a local board make sure to run the "   \
                                "local install" % (board_name))
                
        image_id = 0
        for key in tags.keys():
            if key.lower() == "image_id":
                image_id = tags[key]

        sm = som.SOM()
        sm.initialize_root()
        root = sm.get_root()
        #Add 1 for Root
        self.rom_element_count += 1

        peripheral = sm.insert_bus(root,
                                    name = "peripheral")
        memory = sm.insert_bus(     root,
                                    name = "memory")

        #Add one for SDB ROM
        self.rom_element_count += 1
        self.rom_element_count += 1
        version_major = device_manager.get_device_id_from_name("SDB")
        sdb_rom = sdbc.create_device_record(name = "SDB",
                                            version_major = version_major)

        #Add two for bridge and one extra for empty
        self.rom_element_count += 3

        #Peripheral Bus
        #Add one for interconnect
        self.rom_element_count += 1



        '''
        #Move all the platform peripherals to the front of the SDB Bus
        temp_unordered_platform_tags = {}
        temp_platform_tags = OrderedDict()
        temp_periph_tags = OrderedDict()
        minor_dict = {}
        peripheral_id = device_manager.get_device_id_from_name("platform")

        for key in tags["SLAVES"]:
            filename = tags["SLAVES"][key]["filename"]
            absfilename = utils.find_rtl_file_location(filename, self.user_paths)
            f = open(absfilename, 'r')
            slave_buffer = f.read()
            f.close()

            per = sdbc.create_device_record(name = key)
            per.parse_buffer(slave_buffer)

            if per.get_abi_version_major_as_int() == peripheral_id:
                minor = per.get_abi_version_minor_as_int()
                minor_dict[minor] = key
                temp_unordered_platform_tags[key] = tags["SLAVES"][key]
            else:
                temp_periph_tags[key] = tags["SLAVES"][key]

        if len(minor_dict.keys()) > 0:
            #Order the platforms in terms of their minor numbers
            ordered_keys = sorted(minor_dict.keys(), key=int)
            for okey in ordered_keys:
                key = minor_dict[okey]
                temp_platform_tags[key] = temp_unordered_platform_tags[key]
            
            #Add all the peripheral slaves
            for key in temp_periph_tags:
                temp_platform_tags[key] = temp_periph_tags[key]
            
            #Put the slaves back in the original dictionary
            tags["SLAVES"] = temp_platform_tags
        '''


        #Add one per peripheral
        for i in range (0, len(tags["SLAVES"])):
            key = tags["SLAVES"].keys()[i]

            if is_integration_required(tags["SLAVES"][key]):
                ir = generate_integration_record(tags["SLAVES"], key)
                #print "Inserting Integration record for: %s" % key
                sm.insert_component(peripheral, ir)

            filename = tags["SLAVES"][key]["filename"]
            absfilename = utils.find_rtl_file_location(filename, self.user_paths)
            f = open(absfilename, 'r')
            slave_buffer = f.read()
            f.close()

            per = sdbc.create_device_record(name = key)
            per.parse_buffer(slave_buffer)
            per.set_name(str(key))
            sm.insert_component(peripheral, per)
            self.rom_element_count += 1

        #Add one for empty
        self.rom_element_count += 1

        #Memory Bus
        #Add one for interconnect
        self.rom_element_count += 1

        #Add one per memory peripheral
        for i in range (0, len(tags["MEMORY"])):
            key = tags["MEMORY"].keys()[i]
            name = tags["MEMORY"][key]["filename"]
            absfilename = utils.find_rtl_file_location(name, self.user_paths)
            f = open(absfilename, 'r')
            memory_buffer = f.read()
            f.close()

            mem = sdbc.create_device_record(name = key)
            mem.parse_buffer(memory_buffer)
            mem.set_name(str(key))
            sm.insert_component(memory, mem)
            self.rom_element_count += 1

        #add one for empty
        self.rom_element_count += 1

        #TODO: add Add one for URL of repo ?? Maybe
        #TODO: add Add one for Synthesis Record
        self.rom_element_count += 1

        sdb_rom.set_size(self.rom_element_count * sdbc.SDB_ROM_RECORD_LENGTH)
        sm.insert_component(peripheral, sdb_rom, 0)

        #Generate the ROM image
        sm.set_child_spacing(root,       0x0100000000)
        sm.set_child_spacing(peripheral, 0x0001000000)
        return sm
Example #3
0
 def get_abi_major():
     return device_manager.get_device_id_from_name("gpio")
Example #4
0
    def gen_som(self, tags={}, buf="", user_paths=[], debug=False):
        tags = copy.deepcopy(tags)
        self.rom_element_count = 0
        if "MEMORY" not in tags:
            tags["MEMORY"] = {}

        self.user_paths = user_paths
        board_name = tags["board"].lower()

        if not utils.board_exists(board_name):
            try:
                utils.install_remote_board_package(board_name)
            except IBuilderError as e:
                raise IBuilderError(                                            \
                                "Board %s could not be found, Attempted to "    \
                                "find it in the remote table and failed. If "   \
                                "this is a local board make sure to run the "   \
                                "local install" % (board_name))

        image_id = 0
        for key in tags.keys():
            if key.lower() == "image_id":
                image_id = tags[key]

        sm = som.SOM()
        sm.initialize_root()
        root = sm.get_root()
        #Add 1 for Root
        self.rom_element_count += 1

        peripheral = sm.insert_bus(root, name="peripheral")
        memory = sm.insert_bus(root, name="memory")

        #Add one for SDB ROM
        self.rom_element_count += 1
        self.rom_element_count += 1
        version_major = device_manager.get_device_id_from_name("SDB")
        sdb_rom = sdbc.create_device_record(name="SDB",
                                            version_major=version_major)

        #Add two for bridge and one extra for empty
        self.rom_element_count += 3

        #Peripheral Bus
        #Add one for interconnect
        self.rom_element_count += 1
        '''
        #Move all the platform peripherals to the front of the SDB Bus
        temp_unordered_platform_tags = {}
        temp_platform_tags = OrderedDict()
        temp_periph_tags = OrderedDict()
        minor_dict = {}
        peripheral_id = device_manager.get_device_id_from_name("platform")

        for key in tags["SLAVES"]:
            filename = tags["SLAVES"][key]["filename"]
            absfilename = utils.find_rtl_file_location(filename, self.user_paths)
            f = open(absfilename, 'r')
            slave_buffer = f.read()
            f.close()

            per = sdbc.create_device_record(name = key)
            per.parse_buffer(slave_buffer)

            if per.get_abi_version_major_as_int() == peripheral_id:
                minor = per.get_abi_version_minor_as_int()
                minor_dict[minor] = key
                temp_unordered_platform_tags[key] = tags["SLAVES"][key]
            else:
                temp_periph_tags[key] = tags["SLAVES"][key]

        if len(minor_dict.keys()) > 0:
            #Order the platforms in terms of their minor numbers
            ordered_keys = sorted(minor_dict.keys(), key=int)
            for okey in ordered_keys:
                key = minor_dict[okey]
                temp_platform_tags[key] = temp_unordered_platform_tags[key]
            
            #Add all the peripheral slaves
            for key in temp_periph_tags:
                temp_platform_tags[key] = temp_periph_tags[key]
            
            #Put the slaves back in the original dictionary
            tags["SLAVES"] = temp_platform_tags
        '''

        #Add one per peripheral
        for i in range(0, len(tags["SLAVES"])):
            key = tags["SLAVES"].keys()[i]

            if is_integration_required(tags["SLAVES"][key]):
                ir = generate_integration_record(tags["SLAVES"], key)
                #print "Inserting Integration record for: %s" % key
                sm.insert_component(peripheral, ir)

            filename = tags["SLAVES"][key]["filename"]
            absfilename = utils.find_rtl_file_location(filename,
                                                       self.user_paths)
            f = open(absfilename, 'r')
            slave_buffer = f.read()
            f.close()

            per = sdbc.create_device_record(name=key)
            per.parse_buffer(slave_buffer)
            per.set_name(str(key))
            sm.insert_component(peripheral, per)
            self.rom_element_count += 1

        #Add one for empty
        self.rom_element_count += 1

        #Memory Bus
        #Add one for interconnect
        self.rom_element_count += 1

        #Add one per memory peripheral
        for i in range(0, len(tags["MEMORY"])):
            key = tags["MEMORY"].keys()[i]
            name = tags["MEMORY"][key]["filename"]
            absfilename = utils.find_rtl_file_location(name, self.user_paths)
            f = open(absfilename, 'r')
            memory_buffer = f.read()
            f.close()

            mem = sdbc.create_device_record(name=key)
            mem.parse_buffer(memory_buffer)
            mem.set_name(str(key))
            sm.insert_component(memory, mem)
            self.rom_element_count += 1

        #add one for empty
        self.rom_element_count += 1

        #TODO: add Add one for URL of repo ?? Maybe
        #TODO: add Add one for Synthesis Record
        self.rom_element_count += 1

        sdb_rom.set_size(self.rom_element_count * sdbc.SDB_ROM_RECORD_LENGTH)
        sm.insert_component(peripheral, sdb_rom, 0)

        #Generate the ROM image
        sm.set_child_spacing(root, 0x0100000000)
        sm.set_child_spacing(peripheral, 0x0001000000)
        return sm
Example #5
0
 def get_abi_major():
     return device_manager.get_device_id_from_name("dma writer")
 def get_abi_major():
     return device_manager.get_device_id_from_name("dma writer")
 def get_abi_major():
     return device_manager.get_device_id_from_name("gpio")