1 Replies - 187 Views - Last Post: 03 December 2019 - 07:09 PM Rate Topic: -----

#1 koh   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 03-December 19

Unable to inherit from super class

Posted 03 December 2019 - 06:11 PM

I am trying to create new class to inherit and override function on the original super class. But it just does not work.

class StfGenericFieldContainer(object):
	def __init__(self, port, rmaInformation):
		super(StfGenericFieldContainer, self).__init__()
		self.port = port
		
		self.inputValid = []
		self.outputValid = []
		self.opcode = []
		self.group = []
		self.data = []
		
		self.INPUT_VALID = None
		self.OUTPUT_VALID = None
		self.GROUP = None
		self.DATA = None
		self.OPCODE = None
		self.opcodeName = None
		
		if rmaInformation:
			self.addInputValid(rmaInformation)
			self.addOutputValid(rmaInformation)
			self.addOpcode(rmaInformation)
			self.addGroup(rmaInformation)
			self.addData(rmaInformation)
			
			self.INPUT_VALID = int(self.getInputValidAsBinaryStr(), 2)
			self.OUTPUT_VALID = int(self.getOutputValidAsBinaryStr(), 2)
			self.GROUP = int(self.getGroupAsBinaryStr(), 2)
			self.DATA = int(self.getDataAsBinaryStr(), 2)
			self.OPCODE = int(self.getOpcodeAsBinaryStr(), 2)
			self.opcodeName = StfGenericFieldContainer.opcodeTable.get(int(self.OPCODE))
	
	def addData(self, rmaInformation):
		for pin in STFHandler.DATA_PIN_LIST:
			self.data.append(rmaInformation[getattr(self.port, pin)])


class STFHandler(AbstractHandler):
	TYPE = TesterPortConfig.TYPE_STF
	INPUT_VALID_PIN_LIST = ["INPUT_VALID"]
	OUTPUT_VALID_PIN_LIST = ["OUTPUT_VALID"]
	OPCODE_PIN_LIST = ['OPCODE0', 'OPCODE1', 'OPCODE2', 'OPCODE3']
	GROUP_PIN_LIST = ['GROUP0', 'GROUP1', 'GROUP2', 'GROUP3']
	DATA_PIN_LIST = ['DATA00', 'DATA01', 'DATA02', 'DATA03', 'DATA04', 'DATA05', 'DATA06', 'DATA07', 'DATA08', 'DATA09', 'DATA10', 'DATA11', 'DATA12', 'DATA13', 'DATA14', 'DATA15', 'DATA16', 'DATA17', 'DATA18', 'DATA19', 'DATA20', 'DATA21', 'DATA22', 'DATA23', 'DATA24', 'DATA25', 'DATA26', 'DATA27', 'DATA28', 'DATA29', 'DATA30', 'DATA31']
	DATA_24_PIN_LIST = ['DATA00', 'DATA01', 'DATA02', 'DATA03', 'DATA04', 'DATA05', 'DATA06', 'DATA07', 'DATA08', 'DATA09', 'DATA10', 'DATA11', 'DATA12', 'DATA13', 'DATA14', 'DATA15', 'DATA16', 'DATA17', 'DATA18', 'DATA19', 'DATA20', 'DATA21', 'DATA22', 'DATA23']
	ALL_PIN_LIST = DATA_PIN_LIST + GROUP_PIN_LIST + OPCODE_PIN_LIST + OUTPUT_VALID_PIN_LIST + INPUT_VALID_PIN_LIST
	
	def __init__(self, patternEmulator):

		#Save and setup
		self.patternEmulator = patternEmulator

		#All of the transactions, organized by domain
		self.transactions = {}


class StfGenericField(StfGenericFieldContainer, STFHandler):
	
	def __init__(self):
		blogger.debug("Hi")
		super(StfGenericFieldContainer, self).__init__(super)
		self.port = port
		
		self.inputValid = []
		self.outputValid = []
		self.opcode = []
		self.group = []
		self.data = []
		
		self.INPUT_VALID = None
		self.OUTPUT_VALID = None
		self.GROUP = None
		self.DATA = None
		self.OPCODE = None
		self.opcodeName = None

	def addData(self, rmaInformation):
		for pin in STFHandler.DATA_24_PIN_LIST:
			self.data.append(rmaInformation[getattr(self.port, pin)])


This post has been edited by astonecipher: 04 December 2019 - 08:28 AM
Reason for edit:: In the future please use the [code] tag button in the editor


Is This A Good Question/Topic? 0
  • +

Replies To: Unable to inherit from super class

#2 jon.kiparsky   User is offline

  • Beginner
  • member icon


Reputation: 11736
  • View blog
  • Posts: 19,932
  • Joined: 19-March 11

Re: Unable to inherit from super class

Posted 03 December 2019 - 07:09 PM

Quote

But it just does not work.


Be more specific. What do you expect to happen, and what happens instead? If you're seeing error messages, what are they?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1