Data Structures - Getting started..

R

rh0dium

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top