By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,171 Members | 776 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,171 IT Pros & Developers. It's quick & easy.

Data Structures - Getting started..

P: n/a
Hi all,

I have a primitive data structure which looks like this.

cells = [{'name': 'AND2X1',
'pins': [{'direction': 'input', 'name': 'A', 'type':
'signal'},
{'direction': 'input', 'name': 'B', 'type':
'signal'},
{'direction': 'output', 'name': 'Y', 'type':
'signal'},
{'direction': 'inout', 'name': 'VDD', 'type':
'power'},
{'direction': 'inout', 'name': 'VSS', 'type':
'ground'}],
'type': None},
{'name': 'AND2X2',
'pins': [{'direction': 'input', 'name': 'A', 'type':
'signal'},
{'direction': 'input', 'name': 'B', 'type':
'signal'},
{'direction': 'output', 'name': 'Y', 'type':
'signal'},
{'direction': 'inout', 'name': 'VDD', 'type':
'power'},
{'direction': 'inout', 'name': 'VSS', 'type':
'ground'}],
'type': None},]

I want to make me a 'more better' data structure where I could do the
following:

lef = IP() # My new fangled data structure
lef.add("AND2X1")
lef.AND2X.type("stdcell")
lef.AND2X.pin.add("A")
lef.AND2X.pin.A.direction=("Input")
lef.AND2X.pin.add("B")
lef.AND2X.pin.A.direction=("Input")
lef.AND2X.pin.add("Y")
lef.AND2X.pin.A.direction=("Output")
lef.AND2X.pin.A.type=("signal")

lef.add("AND3X1")
lef.AND2X.type("stdcell")
lef.AND2X.pin.add("A")
lef.AND2X.pin.A.direction=("Input")
lef.AND2X.pin.add("B")
lef.AND2X.pin.A.direction=("Input")
lef.AND2X.pin.add("Y")
lef.AND2X.pin.A.direction=("Output")
lef.AND2X.pin.A.type=("signal")

print lef.asList() # Would return ["AND2X1",
"AND3X1"]
print lef.AND2X1.pins.asList() # Would return ["A", "B", "Y"]

for x in lef:
print x.name # Would return AND2X1
print x.type # Would return stdcell (if used)
print x.pins # Would return pins (if used)

Can anyone get me started?
Jun 27 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.