hwt/simulator/shortcuts.py
def toSimModel(unit, targetPlatform=DummyPlatform(), dumpModelIn=None):
    """
    Create a simulation model for unit

    :param unit: interface level unit which you wont prepare for simulation
    :param targetPlatform: target platform for this synthes
    :param dumpModelIn: folder to where put sim model files
        (otherwise sim model will be constructed only in memory)
    """
    sim_code = toRtl(unit,
                     targetPlatform=targetPlatform,
                     saveTo=dumpModelIn,
                     serializer=SimModelSerializer)
    if dumpModelIn is not None:
        d = os.path.join(os.getcwd(), dumpModelIn)
        dInPath = d in sys.path
        if not dInPath:
            sys.path.insert(0, d)
        if unit._name in sys.modules:
            del sys.modules[unit._name]
        simModule = importlib.import_module(unit._name)

        if not dInPath:
            sys.path.remove(d)
    else:
        simModule = ModuleType('simModule')
        # python supports only ~100 opened brackets
        # it exceded it throws MemoryError: s_push: parser stack overflow
        exec(sim_code, simModule.__dict__)

    return simModule.__dict__[unit._name]
def toSimModel(unit, targetPlatform=DummyPlatform(), dumpModelIn=None):
    sim_code = toRtl(unit,
                     targetPlatform=targetPlatform,
                     saveTo=dumpModelIn,
                     serializer=SimModelSerializer)
    if dumpModelIn is not None:
        d = os.path.join(os.getcwd(), dumpModelIn)
        dInPath = d in sys.path
        if not dInPath:
            sys.path.insert(0, d)
        if unit._name in sys.modules:
            del sys.modules[unit._name]
        simModule = importlib.import_module(unit._name)

        if not dInPath:
            sys.path.remove(d)
    else:
        simModule = ModuleType('simModule')
        # python supports only ~100 opened brackets
        # it exceded it throws MemoryError: s_push: parser stack overflow
        exec(sim_code, simModule.__dict__)

    return simModule.__dict__[unit._name]
def toSimModel ( unit , targetPlatform = DummyPlatform ( ) , dumpModelIn = None ) : sim_code = toRtl ( unit , targetPlatform = targetPlatform , saveTo = dumpModelIn , serializer = SimModelSerializer ) if dumpModelIn is not None : d = os . path . join ( os . getcwd ( ) , dumpModelIn ) dInPath = d in sys . path if not dInPath : sys . path . insert ( 0 , d ) if unit . _name in sys . modules : del sys . modules [ unit . _name ] simModule = importlib . import_module ( unit . _name ) if not dInPath : sys . path . remove ( d ) else : simModule = ModuleType ( 'simModule' ) # python supports only ~100 opened brackets # it exceded it throws MemoryError: s_push: parser stack overflow exec ( sim_code , simModule . __dict__ ) return simModule . __dict__ [ unit . _name ]
Create a simulation model for unit

    :param unit: interface level unit which you wont prepare for simulation
    :param targetPlatform: target platform for this synthes
    :param dumpModelIn: folder to where put sim model files
        (otherwise sim model will be constructed only in memory)
Create a simulation model for unit