Can anyone please help in writing a code to create pcell.I would like to have these as the pcell parameters:3-4 rectangles(layers),width,length and type..Each rectangle should use different layer like layer1 ACTIVE,layer2 POLY etc...I want the layers to be created based on parameter "type".
Based on this parameter it should create these rectangles..eg: if type is case("Width")- it should create single layer like layer1.if case is "overlap" it should create 2 layers say layer1 and layer2.
Can anyone please help me out..
The interface to a pcell is through its parameters. The pcell is drawn based on the data input through those parameters. The code you write for the pcell reads the values of the parameters and then creates the pcell contents.
You have to first create a set of requirements for the pcell. What should it do and how should it be controlled? What are the inputs to the pcell and what are the results for each input? You want to have as complete requirements as you can before you start.
Once you have captured the requirements, you can map them to the pcell parameters. Be aware that the parameters for a pcell are fixed when the pcell is compiled, you cannot add parameters on the fly, you can only change the values. For your application, you may want to pass in data structures describing the rectangles to be built based on the type parameter or you can build the layers and default widths and lengths into the pcell itself.
I often structure the code so that the data creation function can be executed in any cellView for easier testing. I pass in the cellView ID (the variable pcCellView during the execution of a pcell) . The previous post is an example of that methodology.This is a good starting point for you.
In reply to Austin CAD Guy:
Thanks Austin I created a simple pcell and its working fine.
But still finding it difficult to use "case" function in a pcell code encapsulation(ie both procedure and pcDefinePCell).As i mentioned earlier inside the case statement i wnt to pass "type" as my argument.So when i vary the "type" say "width" (in the pcell) my case statement should be able to develop 1 layer. When "type" is "space" case statement should fetch me two layers such that they get separated by another parameter like "spacing" and when type is "enclose" case statement should fetch 2 layers with layers being enclosed by another parameter "overlap".
So my formal arguments section should have 2 layers,separate width(w1,w2-for each layers),separate lengths(l1,l2),type,overlap,spacing and a comment option which specifies type we carried out.
So formal argument section should luk something like,
( (layer1 "POLY") (l1 0.5) (w1 0.75) (layer2 "ACTIVE") (l2 0.6) (w2 0.9) (type "width") (comment "width check") (spacing 0.75) (overlap 0.5) );end of parameters
How can i do these?
Can anyone just give me an example and help me out.
In reply to Messi:
The case statement is a conditional which evaluates the test once and branches to the matching condition. If the condition is a list, the conditional can match any of elements of the list. Note that after executing the code in the branch, execution automatically jumps to the next statement after the case statement and does not evaluate any other branches in the case statement.
case( type( "myType1" ;; Do myType1 stuff here)
( "width" ; Do width stuff here )
( ("length" "area") ;; Do stuff for either length or area)
( t ; Optional block if no other branch is executed ;; Stuff for the non matching types error( "%s: Unknown type %s." getCallingFunction(0) type ))
) ;; end of case statement.
Thanks alot for your help...