From ac3e78c55c765dfd899097dfee70015a3b03ad2e Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 10 Jun 2021 11:13:27 +0000 Subject: [PATCH 1/3] allow ioSpecs loadFromPinmux to undersand IoPin.ANALOG format --- cumulus/src/plugins/alpha/block/iospecs.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cumulus/src/plugins/alpha/block/iospecs.py b/cumulus/src/plugins/alpha/block/iospecs.py index a934fa6b..9bc39868 100644 --- a/cumulus/src/plugins/alpha/block/iospecs.py +++ b/cumulus/src/plugins/alpha/block/iospecs.py @@ -120,7 +120,7 @@ class IoSpecs ( object ): """ 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): raise ErrorMessage( 2, [ 'IoSpecs.loadFromPinmux(): ' 'JSON pinmux file not found.' @@ -128,10 +128,12 @@ class IoSpecs ( object ): with open(fileName) as fd: datas = utf8toStr( json.loads( fd.read(), object_hook=utf8toStr ) , ignoreDicts=True ) - self.addIoPadSpecs(datas['pads.east' ], IoPin.EAST ) - self.addIoPadSpecs(datas['pads.west' ], IoPin.WEST ) - self.addIoPadSpecs(datas['pads.north'], IoPin.NORTH ) - self.addIoPadSpecs(datas['pads.south'], IoPin.SOUTH ) + # check if pad is analog or not: last spec item starts with "A" + analog = IoPin.ANALOG if padDatas[-1][0] == 'A' else 0 + self.addIoPadSpecs(datas['pads.east' ], IoPin.EAST | analog ) + 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']: padName = padDatas[0] @@ -141,7 +143,8 @@ class IoSpecs ( object ): .format(padName) )) continue 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] ) trace( 560, '-' ) From ed3bdbe4552a57295020e47134827cbdcc00f4e0 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 10 Jun 2021 11:46:30 +0000 Subject: [PATCH 2/3] un-messed-up IoSpecs.loadFromPinmux, add new function for making a pad Analog --- cumulus/src/plugins/alpha/block/iospecs.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/cumulus/src/plugins/alpha/block/iospecs.py b/cumulus/src/plugins/alpha/block/iospecs.py index 9bc39868..19ed9a59 100644 --- a/cumulus/src/plugins/alpha/block/iospecs.py +++ b/cumulus/src/plugins/alpha/block/iospecs.py @@ -67,6 +67,9 @@ class IoPadSpec ( object ): self._id = IoPadSpec.id IoPadSpec.id += 1 + def setAnalog ( self ): + self.side |= IoPin.ANALOG + def addNets ( self, nets ): self.nets += nets @@ -128,12 +131,10 @@ class IoSpecs ( object ): with open(fileName) as fd: datas = utf8toStr( json.loads( fd.read(), object_hook=utf8toStr ) , ignoreDicts=True ) - # check if pad is analog or not: last spec item starts with "A" - analog = IoPin.ANALOG if padDatas[-1][0] == 'A' else 0 - self.addIoPadSpecs(datas['pads.east' ], IoPin.EAST | analog ) - self.addIoPadSpecs(datas['pads.west' ], IoPin.WEST | analog ) - self.addIoPadSpecs(datas['pads.north'], IoPin.NORTH | analog ) - self.addIoPadSpecs(datas['pads.south'], IoPin.SOUTH | analog ) + self.addIoPadSpecs(datas['pads.east' ], IoPin.EAST ) + self.addIoPadSpecs(datas['pads.west' ], IoPin.WEST ) + self.addIoPadSpecs(datas['pads.north'], IoPin.NORTH ) + self.addIoPadSpecs(datas['pads.south'], IoPin.SOUTH ) for padDatas in datas['pads.instances']: padName = padDatas[0] @@ -145,6 +146,10 @@ class IoSpecs ( object ): end = None # 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': + self._ioPadsLUT[padName].setAnalog() + # add the nets to the pad self._ioPadsLUT[padName].addNets( padDatas[1:end] ) trace( 560, '-' ) From 19b9f9e2e7656ad1d39f254cce2daa295999438c Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 10 Jun 2021 11:50:55 +0000 Subject: [PATCH 3/3] put in a temporary absolutely terrible hack for now to skip adding analog pins --- cumulus/src/plugins/alpha/block/iospecs.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cumulus/src/plugins/alpha/block/iospecs.py b/cumulus/src/plugins/alpha/block/iospecs.py index 19ed9a59..c0043cc5 100644 --- a/cumulus/src/plugins/alpha/block/iospecs.py +++ b/cumulus/src/plugins/alpha/block/iospecs.py @@ -119,9 +119,11 @@ class IoSpecs ( object ): actual_side |= IoPin.A_END 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. + 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 "%s".' % fileName ) if not os.path.isfile(fileName): @@ -147,7 +149,7 @@ class IoSpecs ( object ): # 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': + 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] )