Compare commits

...

3 Commits

Author SHA1 Message Date
Luke Kenneth Casson Leighton 19b9f9e2e7 put in a temporary absolutely terrible hack for now to skip adding analog pins 2021-06-10 11:50:55 +00:00
Luke Kenneth Casson Leighton ed3bdbe455 un-messed-up IoSpecs.loadFromPinmux, add new function for
making a pad Analog
2021-06-10 11:46:30 +00:00
Luke Kenneth Casson Leighton ac3e78c55c allow ioSpecs loadFromPinmux to undersand IoPin.ANALOG format 2021-06-10 11:13:27 +00:00
1 changed files with 13 additions and 3 deletions

View File

@ -67,6 +67,9 @@ class IoPadSpec ( object ):
self._id = IoPadSpec.id self._id = IoPadSpec.id
IoPadSpec.id += 1 IoPadSpec.id += 1
def setAnalog ( self ):
self.side |= IoPin.ANALOG
def addNets ( self, nets ): def addNets ( self, nets ):
self.nets += nets self.nets += nets
@ -116,11 +119,13 @@ class IoSpecs ( object ):
actual_side |= IoPin.A_END actual_side |= IoPin.A_END
self.addIoPadSpec( padName, actual_side) self.addIoPadSpec( padName, actual_side)
def loadFromPinmux ( self, fileName ): def loadFromPinmux ( self, fileName , cheat_dont_do_analog=False):
""" """
Load ioPadsSpec from a LibreSOC generated pinmux file in JSON format. Load ioPadsSpec from a LibreSOC generated pinmux file in JSON format.
The cheat_dont_do_analog is there, sigh, because nsxlib doesn't
have analog pads. it's a terrible hack.
""" """
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.'
@ -141,7 +146,12 @@ 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
# check if pad is analog or not: last spec item starts with "A"
if padDatas[-1][0] == 'A' and not cheat_dont_do_analog:
self._ioPadsLUT[padName].setAnalog()
# add the nets to the pad
self._ioPadsLUT[padName].addNets( padDatas[1:end] ) self._ioPadsLUT[padName].addNets( padDatas[1:end] )
trace( 560, '-' ) trace( 560, '-' )