# Path: sydpy/_util/_util.py
# def getio_vars(func, intfs):
#         
# #     varnames = func.__code__.co_varnames
# #     symdict = {intf.name: intf for _,intf in intfs.items()}
#     symdict = intfs
# 
# #     try:    
# #         if func.arch == True:
# #             (arch_args, arch_ports, arch_confs, arch_arg_defs, arch_annot) = get_arch_args(func)
# #         
# #             for p in arch_ports:
# #                 symdict[p] = p
# #                 
# #     except AttributeError:
# #         pass
# 
#     if func.__code__.co_freevars:
#         for n, c in zip(func.__code__.co_freevars, func.__closure__):
#             try:
#                 symdict[n] = c.cell_contents
#             except NameError:
#                 raise NameError(n)
#     
#     
#     s = inspect.getsource(func)
#     tree = ast.parse(_dedent(s))
# 
# #     from astmonkey import visitors, transformers
# #     
# #     node = transformers.ParentNodeTransformer().visit(tree)
# #     visitor = visitors.GraphNodeVisitor()
# #     visitor.visit(node)
# #     
# #     visitor.graph.write_png('graph.png')
# 
#     v = _SigNameVisitor(symdict)
#     v.visit(tree)
#     
#     return v.inputs, v.outputs
# 
# Path: sydpy/_simulator.py
# def simwait(events=None):
#     """Delay process execution by waiting for events."""
#     sim = RequiredVariable('Simulator')
#     sim.wait(events)


from greenlet import greenlet
from sydpy._util._util import getio_vars
from sydpy._simulator import simwait
        else:
            self.func(**self.func_params)
            simwait()
            
    def exit_func(self):
        if self._exit_func:
            self._exit_func()
   
    def __str__(self):
        return self.name
    
    def __repr__(self):
        return self.__str__()
    
class AlwaysAcquire(Process):
    """Wrapper class for functions that implement processes in user modules.
    
    This wrapper is used for processes with single interface in sensitivity
    list. The process is triggered when a new value can be popped via 
    interface."""
     
    def run(self):
        arch_active = self.module.architectures[self.arch]['active']
        while(1):
            if arch_active:
                val = self.senslist[0].blk_pop()
            else:
                simwait(self.senslist[0].e.updated)
                val = self.senslist[0].read()
                

# Path: sydpy/_util/_util.py
# def getio_vars(func, intfs):
#         
# #     varnames = func.__code__.co_varnames
# #     symdict = {intf.name: intf for _,intf in intfs.items()}
#     symdict = intfs
# 
# #     try:    
# #         if func.arch == True:
# #             (arch_args, arch_ports, arch_confs, arch_arg_defs, arch_annot) = get_arch_args(func)
# #         
# #             for p in arch_ports:
# #                 symdict[p] = p
# #                 
# #     except AttributeError:
# #         pass
# 
#     if func.__code__.co_freevars:
#         for n, c in zip(func.__code__.co_freevars, func.__closure__):
#             try:
#                 symdict[n] = c.cell_contents
#             except NameError:
#                 raise NameError(n)
#     
#     
#     s = inspect.getsource(func)
#     tree = ast.parse(_dedent(s))
# 
# #     from astmonkey import visitors, transformers
# #     
# #     node = transformers.ParentNodeTransformer().visit(tree)
# #     visitor = visitors.GraphNodeVisitor()
# #     visitor.visit(node)
# #     
# #     visitor.graph.write_png('graph.png')
# 
#     v = _SigNameVisitor(symdict)
#     v.visit(tree)
#     
#     return v.inputs, v.outputs
# 
# Path: sydpy/_simulator.py
# def simwait(events=None):
#     """Delay process execution by waiting for events."""
#     sim = RequiredVariable('Simulator')
#     sim.wait(events)


# Path: sydpy/_process.py
from greenlet import greenlet
from sydpy._util._util import getio_vars
from sydpy._simulator import simwait

        else:
            self.func(**self.func_params)
            simwait()
            
    def exit_func(self):
        if self._exit_func:
            self._exit_func()
   
    def __str__(self):
        return self.name
    
    def __repr__(self):
        return self.__str__()
    
class AlwaysAcquire(Process):
    """Wrapper class for functions that implement processes in user modules.
    
    This wrapper is used for processes with single interface in sensitivity
    list. The process is triggered when a new value can be popped via 
    interface."""
     
    def run(self):
        arch_active = self.module.architectures[self.arch]['active']
        while(1):
            if arch_active:
                val = self.senslist[0].blk_pop()
            else:
                simwait(self.senslist[0].e.updated)
                val = self.senslist[0].read()
                

            self.func(val, **self.func_params)