Skip to content

Commit

Permalink
Move isdefinition into separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
rsetaluri committed Oct 22, 2018
1 parent b4fda43 commit ce45893
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion magma/backend/blif.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from ..array import ArrayType
from ..port import INPUT, OUTPUT, INOUT
from ..clock import wiredefaultclock
from ..circuit import *
from ..is_definition import isdefinition

__all__ = ['compile']

Expand Down
2 changes: 1 addition & 1 deletion magma/backend/verilog.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from ..clock import ClockType, EnableType, ResetType
from ..array import ArrayKind, ArrayType
from ..bits import SIntType
from ..circuit import *
from ..is_definition import isdefinition
from ..clock import wiredefaultclock
import logging
import os
Expand Down
7 changes: 1 addition & 6 deletions magma/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from .debug import get_callee_frame_info, debug_info
from .logging import warning
from .port import report_wiring_warning
from .is_definition import isdefinition

__all__ = ['AnonymousCircuitType']
__all__ += ['AnonymousCircuit']
Expand All @@ -27,7 +28,6 @@
__all__ += ['getCurrentDefinition']
__all__ += ['magma_clear_circuit_cache']

__all__ += ['isdefinition']
__all__ += ['isprimitive']
__all__ += ['CopyInstance']
__all__ += ['circuit_type_method']
Expand Down Expand Up @@ -390,11 +390,6 @@ def popDefinition():
else:
currentDefinition = None

# A circuit is a definition if it has instances
def isdefinition(circuit):
'Return whether a circuit is a module definition'
return getattr(circuit, "is_definition", False)

def isprimitive(circuit):
return getattr(circuit, "primitive", False)

Expand Down
2 changes: 1 addition & 1 deletion magma/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from .backend import verilog, blif, firrtl, dot
from .config import get_compile_dir
from .logging import error
from .circuit import isdefinition
from .is_definition import isdefinition
from .logging import warning
import magma as m

Expand Down
4 changes: 4 additions & 0 deletions magma/is_definition.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# A circuit is a definition if it has instances
def isdefinition(circuit):
'Return whether a circuit is a module definition'
return getattr(circuit, "is_definition", False)
2 changes: 1 addition & 1 deletion magma/passes/clock.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ..circuit import isdefinition
from ..is_definition import isdefinition
from ..clock import wiredefaultclock
from .passes import DefinitionPass

Expand Down
2 changes: 1 addition & 1 deletion magma/passes/passes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ..circuit import isdefinition
from ..is_definition import isdefinition
from .tsort import tsort

__all__ = ['Pass', 'InstancePass', 'DefinitionPass', 'InstanceGraphPass']
Expand Down
2 changes: 1 addition & 1 deletion magma/simulator/mdb.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import print_function
from .python_simulator import PythonSimulator
from ..passes.debug_name import DebugNamePass
from ..circuit import *
from ..is_definition import isdefinition
from ..scope import *
from ..array import ArrayType
from ..bit import BitType
Expand Down
2 changes: 1 addition & 1 deletion magma/transforms.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections import namedtuple, OrderedDict
from .circuit import *
from .is_definition import isdefinition
from .bit import *
from .clock import ClockType, EnableType, ResetType, AsyncResetType, wiredefaultclock
from .array import *
Expand Down
2 changes: 1 addition & 1 deletion tests/test_circuit/test_is_definition.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from magma import *
from magma.circuit import isdefinition
from magma.is_definition import isdefinition


def test_is_definition():
Expand Down

0 comments on commit ce45893

Please sign in to comment.