mirror of
https://github.com/myhdl/myhdl.git
synced 2024-12-14 07:44:38 +08:00
turn profiling (for tracing) off for compile functions
This commit is contained in:
parent
6a383a8702
commit
d9eac86566
@ -25,12 +25,14 @@ __date__ = "$Date$"
|
|||||||
|
|
||||||
from __future__ import generators
|
from __future__ import generators
|
||||||
|
|
||||||
|
import sys
|
||||||
import inspect
|
import inspect
|
||||||
from types import FunctionType
|
from types import FunctionType
|
||||||
import compiler
|
import compiler
|
||||||
|
|
||||||
from myhdl import Signal
|
from myhdl import Signal
|
||||||
from myhdl._util import _isgeneratorfunction
|
from myhdl._util import _isgeneratorfunction
|
||||||
|
from myhdl import _traceSignals
|
||||||
|
|
||||||
class Error(Exception):
|
class Error(Exception):
|
||||||
"""always_comb Error"""
|
"""always_comb Error"""
|
||||||
@ -59,8 +61,8 @@ class EmbeddedFunctionError(Error):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def always_comb(func):
|
def always_comb(func):
|
||||||
|
sys.setprofile(None)
|
||||||
f = inspect.getouterframes(inspect.currentframe())[1][0]
|
f = inspect.getouterframes(inspect.currentframe())[1][0]
|
||||||
if type(func) is not FunctionType:
|
if type(func) is not FunctionType:
|
||||||
raise ArgumentError
|
raise ArgumentError
|
||||||
@ -77,6 +79,7 @@ def always_comb(func):
|
|||||||
if isinstance(v, Signal) and n not in varnames:
|
if isinstance(v, Signal) and n not in varnames:
|
||||||
sigdict[n] = v
|
sigdict[n] = v
|
||||||
c = _AlwaysComb(func, sigdict)
|
c = _AlwaysComb(func, sigdict)
|
||||||
|
sys.setprofile(_traceSignals._profileFunc)
|
||||||
return c.genfunc()
|
return c.genfunc()
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,14 +31,18 @@ __author__ = "Jan Decaluwe <jan@jandecaluwe.com>"
|
|||||||
__revision__ = "$Revision$"
|
__revision__ = "$Revision$"
|
||||||
__date__ = "$Date$"
|
__date__ = "$Date$"
|
||||||
|
|
||||||
|
import sys
|
||||||
import inspect
|
import inspect
|
||||||
|
|
||||||
from types import GeneratorType
|
from types import GeneratorType
|
||||||
|
|
||||||
from myhdl import Cosimulation
|
from myhdl import Cosimulation
|
||||||
from myhdl._util import _isgeneratorfunction, _isGenSeq
|
from myhdl._util import _isgeneratorfunction, _isGenSeq
|
||||||
|
from myhdl import _traceSignals
|
||||||
|
|
||||||
|
|
||||||
def instances():
|
def instances():
|
||||||
|
sys.setprofile(None)
|
||||||
f = inspect.currentframe()
|
f = inspect.currentframe()
|
||||||
d = inspect.getouterframes(f)[1][0].f_locals
|
d = inspect.getouterframes(f)[1][0].f_locals
|
||||||
l = []
|
l = []
|
||||||
@ -47,14 +51,17 @@ def instances():
|
|||||||
l.append(v)
|
l.append(v)
|
||||||
elif _isGenSeq(v):
|
elif _isGenSeq(v):
|
||||||
l.append(v)
|
l.append(v)
|
||||||
|
sys.setprofile(_traceSignals._profileFunc)
|
||||||
return l
|
return l
|
||||||
|
|
||||||
|
|
||||||
def processes():
|
def processes():
|
||||||
|
sys.setprofile(None)
|
||||||
f = inspect.currentframe()
|
f = inspect.currentframe()
|
||||||
d = inspect.getouterframes(f)[1][0].f_locals
|
d = inspect.getouterframes(f)[1][0].f_locals
|
||||||
l = []
|
l = []
|
||||||
for v in d.values():
|
for v in d.values():
|
||||||
if _isgeneratorfunction(v):
|
if _isgeneratorfunction(v):
|
||||||
l.append(v()) # call it
|
l.append(v()) # call it
|
||||||
|
sys.setprofile(_traceSignals._profileFunc)
|
||||||
return l
|
return l
|
||||||
|
@ -45,6 +45,7 @@ from myhdl import _simulator, Signal, __version__
|
|||||||
from myhdl._util import _isGenSeq, _isgeneratorfunction
|
from myhdl._util import _isGenSeq, _isgeneratorfunction
|
||||||
|
|
||||||
_tracing = 0
|
_tracing = 0
|
||||||
|
_profileFunc = None
|
||||||
|
|
||||||
class Error(Exception):
|
class Error(Exception):
|
||||||
""" traceSignals Error"""
|
""" traceSignals Error"""
|
||||||
@ -164,10 +165,12 @@ def _findInstanceName(framerec):
|
|||||||
class _HierExtr(object):
|
class _HierExtr(object):
|
||||||
|
|
||||||
def __init__(self, name, dut, *args, **kwargs):
|
def __init__(self, name, dut, *args, **kwargs):
|
||||||
|
global _profileFunc
|
||||||
self.names = [name]
|
self.names = [name]
|
||||||
self.instances = instances = []
|
self.instances = instances = []
|
||||||
self.level = 0
|
self.level = 0
|
||||||
sys.setprofile(self.extractor)
|
_profileFunc = self.extractor
|
||||||
|
sys.setprofile(_profileFunc)
|
||||||
try:
|
try:
|
||||||
_top = dut(*args, **kwargs)
|
_top = dut(*args, **kwargs)
|
||||||
finally:
|
finally:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user