phanrahan / mantle

mantle library
Other
42 stars 10 forks source link

Can't Import Mantle If MANTLE and MANTLE_TARGET Environment Vars Not Set #59

Closed David-Durst closed 6 years ago

David-Durst commented 6 years ago

If I try to import mantle without setting the MANTLE and MANTLE_TARGET environment variables, I get the following error:

test_up.py:1: in <module>
    from aetherling.modules.up import UpSequential, UpParallel
../modules/up.py:3: in <module>
    from mantle import Register, CounterModM, Mux, Decode
../../../mantle/mantle/__init__.py:25: in <module>
    from mantle.common import *
../../../mantle/mantle/common/__init__.py:1: in <module>
    from .arith import *
../../../mantle/mantle/common/arith.py:1: in <module>
    from mantle import DefineAdd, DefineSub, DefineNegate, DefineASR
E   ImportError: cannot import name 'DefineAdd'

This occurs because https://github.com/phanrahan/mantle/blob/master/mantle/__init__.py#L11 imports the verilog version of mantle with this environment setting. This version doesn't have DefineAdd implemented. This used to work for me, so I'm not sure what has changed, but either:

  1. Mantle shouldn't crash with this configuration
  2. The docs need to tell users how to set one of these environment variables.
leonardt commented 6 years ago

Resolved by 7f83c28d6cc3d7cfd2bb342b27914b8626078517

I added more documentation about setting the MANTLE var in the README I also changed the default target to coreir since thats the one that's currently maintained and in use (rather than verilog)