fhdl/verilog: Add optional platform parameter and set platform to specials.

Being able to access the platform when lowering specials is required for Efinity.
This commit is contained in:
Florent Kermarrec 2021-10-22 20:00:27 +02:00
parent 2a775e1493
commit 62c7978cfd
2 changed files with 9 additions and 2 deletions

View file

@ -435,7 +435,11 @@ class GenericPlatform:
return named_sc, named_pc
def get_verilog(self, fragment, **kwargs):
return verilog.convert(fragment, self.constraint_manager.get_io_signals(), **kwargs)
return verilog.convert(fragment,
ios = self.constraint_manager.get_io_signals(),
platform = self,
**kwargs
)
def get_edif(self, fragment, cell_library, vendor, device, **kwargs):
return edif.convert(

View file

@ -458,7 +458,7 @@ class DummyAttrTranslate(dict):
def __getitem__(self, k):
return (k, "true")
def convert(f, ios=set(), name="top",
def convert(f, ios=set(), name="top", platform=None,
special_overrides = dict(),
attr_translate = DummyAttrTranslate(),
regular_comb = True):
@ -492,6 +492,9 @@ def convert(f, ios=set(), name="top",
f = lower_basics(f)
# Lower specials.
if platform is not None:
for s in f.specials:
s.platform = platform
f, lowered_specials = lower_specials(special_overrides, f)
# Lower basics (for basics included in specials).