Late import of pyosys to not block if N/A in designflow/yosys.py.

This commit is contained in:
Jean-Paul Chaput 2023-03-06 14:58:39 +01:00
parent 461b81bb75
commit 842c2dfffc
1 changed files with 2 additions and 1 deletions

View File

@ -1,7 +1,6 @@
import os.path import os.path
from pathlib import Path from pathlib import Path
from pyosys import libyosys as yosys
from doit.exceptions import TaskFailed from doit.exceptions import TaskFailed
from .task import FlowTask from .task import FlowTask
@ -55,6 +54,7 @@ class Yosys ( FlowTask ):
return self.file_depend( 0 ) return self.file_depend( 0 )
def _run_pass ( self, command ): def _run_pass ( self, command ):
from pyosys import libyosys as yosys
if self.success is not True: return if self.success is not True: return
yosys.run_pass( command, self.tool ) yosys.run_pass( command, self.tool )
@ -84,6 +84,7 @@ class Yosys ( FlowTask ):
self._run_pass( 'hierarchy -top {}\n'.format( self.top )) self._run_pass( 'hierarchy -top {}\n'.format( self.top ))
def doTask ( self ): def doTask ( self ):
from pyosys import libyosys as yosys
from ..helpers.io import ErrorMessage from ..helpers.io import ErrorMessage
if self.liberty is None: if self.liberty is None:
e = ErrorMessage( 1, [ 'Yosys.doTask(): "liberty" has not been set' ] ) e = ErrorMessage( 1, [ 'Yosys.doTask(): "liberty" has not been set' ] )