Beispiel #1
0
 def getInstantiatedComponents(self):
     """Returns a tuple with the names of the components present in the architecture;
     actually only their name is returned"""
     
     #get the list of all component classes
     componentClasses = []
     for elem in self.components:
         for attr in dir(elem):
             attr = getattr(elem,attr)
             if hasattr(attr,'__class__'):
                 try:
                     if issubclass(attr,scwrapper.sc_object):
                         componentClasses.append(attr)
                 except:
                     pass
     
     #get components
     components = []
     tmpList = scwrapper.sc_get_curr_simcontext().get_child_objects()
     for i in range(0,len(tmpList)):
         currComp = tmpList[i]
         if hasattr(currComp,'name'):
             if componentClasses.count(currComp.__class__):
                 components.append(currComp.name())
     ##old strategy for getting components
     #for comp in self.compToConnection.keys():
     #    components.append(comp)
     return tuple(components)
Beispiel #2
0
    def reset(self):
        """ Resets the simulator to the initial state """ 
        global controller

        #check if an exception has occurred in systemc...
        if controller.error == True:
            print "\n\nSimulation cannot be restarted since an exception has been thrown!\n\n"
            return
            
        # Stop simulation
        if (controller.has_started() and not controller.is_ended()):
          controller.stop_simulation()
        
        # Delete All
        self.__delete_all_helper()

        # Reset OSEmulation
        cm_wrapper.ConcurrencyEmulatorBase.resetCEBase()
        bfdwrapper.BFDWrapper.resetBFDWrapper()
        #trapwrapper.OSEmulatorBase.reset()
        
        # Reset component manager
        manager.reset()

        # Reset power framework
        import power
        power.reset()
        
        # Reset breakpoints
        import breakpoints
        breakpoints.reset()

        # Reset SystemC (tricky)
        scwrapper.sc_get_curr_simcontext().reset()

        # Reset controller
        controller.reset_controller()
        
        self.controller = None
        del globals()['controller']
        for script in self.scripting_commands:
            del globals()[script.__name__]
        
                
        #instantiate a new controller and setup scripting commands (for simplicity all commands are restored...)
        self.setup_controller(self.interactive)
        self.setup_scripting_commands()
Beispiel #3
0
 def getCompInstance(self, name):
     """Given the component's SystemC name this method returns its instance"""
     tmpList = scwrapper.sc_get_curr_simcontext().get_child_objects()
     for i in range(0,len(tmpList)):
         currComp = tmpList[i]
         if hasattr(currComp,'name'):
             if currComp.name() == name:
                 return currComp
     return None