• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. passing parameter values from csv file

Stats

  • Locked Locked
  • Replies 5
  • Subscribers 143
  • Views 15537
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

passing parameter values from csv file

anode
anode over 5 years ago

Hi,
Can anyone one let me know/show how to pass values of  PCell parameters from a csv file.

Many Thanks

Hosein

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 5 years ago

    Hi Hosein,

    What do you mean by "pass values of PCell parameters from a csv file"? What's in the CSV file? What are you expecting? PCell parameters are passed to the instance of a PCell, so it's unclear what you want here.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • anode
    anode over 5 years ago in reply to Andrew Beckett

    Hi Andrew,

    Thanks I found a workaround using some scripting .
    But here is my question.
    I have a Pcell with parameter such as length , width, pitch etc ..

    I have Excel sheet with these parameters and their numerous values . I wanted to write a code into my Pcell that could read the data from Excel sheet and produce many variiation of the PCell depending on the parameter values . This way can automate the Pcell which is controlled by the Excell sheet as and when different values called from the Excel sheet when ever user wanted.
    I had used some skill function to read the data and print it but was unable to relate them to my Pcell parameters.

    Best Regards
    Hosein

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 5 years ago in reply to anode

    Hi Hosein,

    There's no standard (public) function for reading an Excel spreadsheet or a CSV (we do have some capability in PCell Designer to read Excel to do this kind of thing, but it's not a public SKILL capability). You could write your own function to read CSV (that's not hard) and then use the data  you read to loop over the rows and then place instances with each of the parameters.This is straightforward enough to do with basic SKILL knowledge.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • anode
    anode over 5 years ago in reply to Andrew Beckett

    Hi Andrew

    Thanks for your reply.

    Although I understand the general concept but perhaps you would elaborate with couple lines of syntax how to read the rows lines by line and pass it to PCell parameters .

    Regards

    Hosein 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 5 years ago in reply to anode

    Hosein,

    I can't really write your code for you, but here's a very rough piece of code to do what you want. This is not thoroughly checked, and maybe you need more controls over the placement (this just steps the x value each time). It also isn't a very general CSV reader. Hopefully it will give you some ideas though - I did test it with a gpdk045 nmos1v device:

    /***************************************************************
    *                                                              *
    *                     CCFreadCSV(fileName)                     *
    *                                                              *
    *  Read a CSV file - returns a list of param names (the first  *
    *     row), and then a list of list of values (in order).      *
    *    Does not attempt to handle quoted strings - leave that    *
    *                as an exercise for the reader.                *
    *                                                              *
    ***************************************************************/
    
    procedure(CCFreadCSV(fileName)
        let((paramNames values inp line rows trailCR)
            ;----------------------------------------------------------------
            ; pattern for trailing carriage return
            ;----------------------------------------------------------------
            trailCR=pcreCompile("\n$")
            inp=infile(fileName)
            ;----------------------------------------------------------------
            ; First read the parameter names, then the rows of values.
            ; Uses tconc to ensure lines read in order
            ;----------------------------------------------------------------
            when(inp && gets(line inp)
                line=pcreReplace(trailCR line "" 1)
                paramNames=parseString(line ",")
                while(gets(line inp)
                    line=pcreReplace(trailCR line "" 1)
                    values=parseString(line ",")
                    rows=tconc(rows values)
                )
            )
            when(inp
                close(inp)
            )
            list(paramNames car(rows))
        )
    )
    
    /***************************************************************
    *                                                              *
    *          CCFplaceFromCSV(fileName libName cellName           *
    *             @key (viewName "layout") (step 2.0)              *
    *                 (cvId geGetEditCellView()))                  *
    *                                                              *
    *       Read parameter information from a file and place       *
    *              the instances, separated by step.               *
    *                                                              *
    ***************************************************************/
    
    procedure(CCFplaceFromCSV(fileName libName cellName 
            @key (viewName "layout") (step 2.0) (cvId geGetEditCellView()))
        let((param paramList master (x 0.0))
            master=dbOpenCellViewByType(libName cellName viewName)
            destructuringBind((paramNames rows) CCFreadCSV(fileName)
                foreach(row rows
                    ;--------------------------------------------------------
                    ; Convert the row into a list of lists suitable for
                    ; dbCreateParamList, converting the value to the right
                    ; type for the expected pCell parameter
                    ;--------------------------------------------------------
                    paramList=foreach(mapcar (paramName value) paramNames row
                        param=dbFindProp(master~>parameters paramName)
                        case(param->valueType
                            ("float" 
                                list(paramName "float" cdfParseFloatString(value))
                            )
                            ("boolean"
                                list(paramName "boolean" value=="t")
                            )
                            ("int"
                                list(paramName "int" atoi(value))
                            )
                            (t 
                                list(paramName "string" value)
                            )
                        )
                    )
                    ;--------------------------------------------------------
                    ; Then place and increment the current location
                    ;--------------------------------------------------------
                    dbCreateParamInst(cvId master "" x:0 "R0" 1 paramList)
                    x=x+step
                )
            )
            t
        )
    )
    

    Here's the CSV file I used to test it:

    fw,l,fingers,connectSD,switchSD,tap,tapCntRows
    600n,90n,5,Source,t,Detached,2
    800n,45n,3,Drain,nil,Integrated,1
    900n,45n,7,Both,nil,Integrated,1

    Finally, the SKILL function I called to test it:

    CCFplaceFromCSV("place.csv" "gpdk045" "nmos1v")

    Regards,

    Andrew.

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information