示例#1
0
    def on_remove(self):
        '''|
        | Command 'remove' removes an interface from the .json file and updates the HW module design files
        |________'''
        interface_name = self.arguments[0]

        gdf = MFDesign()
        gdf.initialize(self.full_name)

        found = self.check_name(gdf, interface_name)

        if not found:
            err("Name not found: " + interface_name)
            exit(0)

        # Remove Interface
        gdf.interfaces[:] = [
            value for value in gdf.interfaces
            if value["name"] != interface_name
        ]
        # Remove Parameter
        gdf.parameters[:] = [
            value for value in gdf.parameters
            if value["name"] != interface_name
        ]

        gdf.overwrite = True
        print_json_file(gdf)

        gdf.update(self.full_name)
示例#2
0
    def on_add(self):
        '''|
        | Command 'add' adds an interface to the .json file and updates the HW module design files
        |________'''
        interface_type = self.arguments[0]
        
        gdf = MFDesign()
        gdf.initialize( self.full_name )

        found = self.check_name( gdf, self.opt_Name )

        if found:
            err("Can not add - interface with the same name exists: " + self.opt_Name)
            exit(0)

        if interface_type == 'HSD':
            gdf.interfaces.append({'push': self.opt_Push, 'direction': self.opt_Direction, 'data': self.opt_Data, 'type': interface_type, 'name': self.opt_Name})

        elif interface_type == 'Bus':
            gdf.interfaces.append({'interfaces': self.opt_BusType, 'type': interface_type, 'name': self.opt_Name})

        elif interface_type == 'Parameter':
            gdf.parameters.append({'value': self.opt_ParValue, 'name': self.opt_Name})

        elif interface_type == 'STAvln':
            gdf.interfaces.append({'direction': self.opt_Direction, 'width': self.opt_Data, 'type': interface_type, 'name': self.opt_Name})

        else: # this should not happen
            err("Unknown type: " + interface_type)
            exit(0)
            
        gdf.overwrite = True
        print_json_file( gdf )

        gdf.update( self.full_name )
示例#3
0
    def on_add(self):
        '''|
        | Command 'add' adds an interface to the .json file and updates the HW module design files
        |________'''
        interface_type = self.arguments[0]

        gdf = MFDesign()
        gdf.initialize(self.full_name)

        found = self.check_name(gdf, self.opt_Name)

        if found:
            err("Can not add - interface with the same name exists: " +
                self.opt_Name)
            exit(0)

        if interface_type == 'HSD':
            gdf.interfaces.append({
                'push': self.opt_Push,
                'direction': self.opt_Direction,
                'data': self.opt_Data,
                'type': interface_type,
                'name': self.opt_Name
            })

        elif interface_type == 'Bus':
            gdf.interfaces.append({
                'interfaces': self.opt_BusType,
                'type': interface_type,
                'name': self.opt_Name
            })

        elif interface_type == 'Parameter':
            gdf.parameters.append({
                'value': self.opt_ParValue,
                'name': self.opt_Name
            })

        elif interface_type == 'STAvln':
            gdf.interfaces.append({
                'direction': self.opt_Direction,
                'width': self.opt_Data,
                'type': interface_type,
                'name': self.opt_Name
            })

        else:  # this should not happen
            err("Unknown type: " + interface_type)
            exit(0)

        gdf.overwrite = True
        print_json_file(gdf)

        gdf.update(self.full_name)
示例#4
0
    def on_remove(self):
        '''|
        | Command 'remove' removes an interface from the .json file and updates the HW module design files
        |________'''
        interface_name = self.arguments[0]

        gdf = MFDesign()
        gdf.initialize( self.full_name )

        found = self.check_name( gdf, interface_name )

        if not found:
            err("Name not found: " + interface_name)
            exit(0)

        # Remove Interface
        gdf.interfaces[:] = [value for value in gdf.interfaces if value["name"] != interface_name]
        # Remove Parameter
        gdf.parameters[:] = [value for value in gdf.parameters if value["name"] != interface_name]

        gdf.overwrite = True
        print_json_file( gdf )

        gdf.update( self.full_name )