build/efinix/efinity: Fix Slice case on get_pin_location/get_pin_name.

This commit is contained in:
Florent Kermarrec 2021-10-22 20:01:31 +02:00
parent 62c7978cfd
commit 89b66be323
1 changed files with 17 additions and 3 deletions

View File

@ -7,6 +7,8 @@
import os import os
from migen.fhdl.structure import _Slice
from litex.build.generic_platform import * from litex.build.generic_platform import *
from litex.build.efinix import common, efinity from litex.build.efinix import common, efinity
from litex.build.efinix import EfinixDbParser from litex.build.efinix import EfinixDbParser
@ -68,22 +70,34 @@ class EfinixPlatform(GenericPlatform):
def get_pin_location(self, sig): def get_pin_location(self, sig):
if sig is None: if sig is None:
return None return None
assert len(sig) == 1
idx = 0
if isinstance(sig, _Slice):
idx = sig.start
sig = sig.value
sc = self.constraint_manager.get_sig_constraints() sc = self.constraint_manager.get_sig_constraints()
for s, pins, others, resource in sc: for s, pins, others, resource in sc:
if (s == sig) and (pins[0] != 'X'): if (s == sig) and (pins[0] != 'X'):
return pins return [pins[idx]]
return None return None
def get_pin_name(self, sig): def get_pin_name(self, sig):
if sig is None: if sig is None:
return None return None
assert len(sig) == 1
idx = 0
slc = False
if isinstance(sig, _Slice):
slc = True
idx = sig.start
sig = sig.value
sc = self.constraint_manager.get_sig_constraints() sc = self.constraint_manager.get_sig_constraints()
for s, pins, others, resource in sc: for s, pins, others, resource in sc:
if s == sig: if s == sig:
if resource[2]: if resource[2]:
return resource[0] + '_' + resource[2] return resource[0] + "_" + resource[2] + (f"{idx}" if slc else "")
else: else:
return resource[0] return resource[0] + (f"{idx}" if slc else "")
return None return None
def get_sig_constraint(self, sig): def get_sig_constraint(self, sig):