allow ioSpecs loadFromPinmux to undersand IoPin.ANALOG format

This commit is contained in:
Luke Kenneth Casson Leighton 2021-06-10 11:13:27 +00:00
parent 7961aab0e1
commit ac3e78c55c
1 changed files with 9 additions and 6 deletions

View File

@ -120,7 +120,7 @@ class IoSpecs ( object ):
""" """
Load ioPadsSpec from a LibreSOC generated pinmux file in JSON format. Load ioPadsSpec from a LibreSOC generated pinmux file in JSON format.
""" """
print( ' o Loading I/O pad specifications from "{}".'.format(fileName) ) print( ' o Loading I/O pad specifications from "%s".' % fileName )
if not os.path.isfile(fileName): if not os.path.isfile(fileName):
raise ErrorMessage( 2, [ 'IoSpecs.loadFromPinmux(): ' raise ErrorMessage( 2, [ 'IoSpecs.loadFromPinmux(): '
'JSON pinmux file not found.' 'JSON pinmux file not found.'
@ -128,10 +128,12 @@ class IoSpecs ( object ):
with open(fileName) as fd: with open(fileName) as fd:
datas = utf8toStr( json.loads( fd.read(), object_hook=utf8toStr ) datas = utf8toStr( json.loads( fd.read(), object_hook=utf8toStr )
, ignoreDicts=True ) , ignoreDicts=True )
self.addIoPadSpecs(datas['pads.east' ], IoPin.EAST ) # check if pad is analog or not: last spec item starts with "A"
self.addIoPadSpecs(datas['pads.west' ], IoPin.WEST ) analog = IoPin.ANALOG if padDatas[-1][0] == 'A' else 0
self.addIoPadSpecs(datas['pads.north'], IoPin.NORTH ) self.addIoPadSpecs(datas['pads.east' ], IoPin.EAST | analog )
self.addIoPadSpecs(datas['pads.south'], IoPin.SOUTH ) self.addIoPadSpecs(datas['pads.west' ], IoPin.WEST | analog )
self.addIoPadSpecs(datas['pads.north'], IoPin.NORTH | analog )
self.addIoPadSpecs(datas['pads.south'], IoPin.SOUTH | analog )
for padDatas in datas['pads.instances']: for padDatas in datas['pads.instances']:
padName = padDatas[0] padName = padDatas[0]
@ -141,7 +143,8 @@ class IoSpecs ( object ):
.format(padName) )) .format(padName) ))
continue continue
end = None end = None
if padDatas[-1] in '+-*': end = -1 # remove the direction info: + output - input * bi-directional
if padDatas[-1][-1] in '+-*': end = -1
self._ioPadsLUT[padName].addNets( padDatas[1:end] ) self._ioPadsLUT[padName].addNets( padDatas[1:end] )
trace( 560, '-' ) trace( 560, '-' )