sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
rh0dium's Avatar

Data Structures - Getting started..


Question posted by: rh0dium (Guest) on June 27th, 2008 05:27 PM
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?
0 Answers Posted
 
Not the answer you were looking for? Post your question . . .
197,042 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 197,042 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors