can't get custom cellview to work

Discussion in 'Cadence' started by andy.summers, Nov 10, 2008.

  1. andy.summers

    andy.summers Guest

    Hi - first post.

    What I'm trying to do would seem simple, but I can't get it to work!

    I want to create a new view type called "harnessFile". I added file
    called ember.reg to /<installDirectory>/share/cdssetup/registry/data
    which contains this...

    DataFormat harnessFile {
    Pattern = harness.cir;
    Default_Editor = Harness-Editor;
    dfII_ViewType = text.harness;
    Co_Managed = harness.cir master.tag prop.xx;
    }

    ViewAlias {
    text.harness = harnessFile;
    }

    I've also added a second ember.reg to /<installDirectory>/share/
    cdssetup/registry/tools which contains this...

    Tool Harness-Editor {
    Tool-Alias = $CDS_TEXT_EDITOR;
    }

    This seems to follow the convention used by the AdvanceMS tools we
    also have installed that work with ArtistLink.

    I expect to see a view category called "Harness-Editor" when I do
    create new cellview from the design manager. I don't!

    Yes, I've had a look at the other posts here that talk about PDF/HTML/
    etc. but I'm not using an external application here. I'm therefore
    presuming I don't need to use deRegApp - or do I? I found that
    particular part very confusing anyway. The Cadence Application
    Infrastructure User Guide, chapter 6 is also rather inpenetrable in
    this respect!

    Thanks, Andy.
     
    andy.summers, Nov 10, 2008
    #1
  2. Andrew Beckett wrote, on 01/02/09 08:16:
    Two files pasted in instead... be careful about the suffixes when creating separate files.

    /* abSpectreIncludeView.ils

    Author A.D.Beckett
    Group Custom IC (UK), Cadence Design Systems Ltd.
    Language SKILL
    Date Nov 11, 2008
    Modified
    By

    Means of netlisting include netlist views for spectre.

    Needs the view to be registered. For example, this can be done
    with a "data.reg" searched for in the setup.loc locations - e.g. it could
    be in the $CDS_SITE or home dir or current dir:

    An example data.reg file would be:

    DataFormat abSpectreNetlist { // Spectre netlist
    Pattern = netlist.scs;
    Default_Editor = Spectre-Netlist;
    dfII_ViewType = abSpectreNetlist;
    Co_Managed = master.tag data.dm netlist.scs netlist.oa;
    }

    Tool Spectre-Netlist {
    }

    If the file is for CDB, it would have:

    Co_Managed = master.tag prop.xx pc.db netlist.scs netlist.cdb;

    Note that no parsing is done of the included file - so it cannot contain terminals.
    It just netlists as a pure include statement.

    The flow is that you create an "include" view, of type "abSpectreNetlist".
    Then in ADE you add "include" to the switch and stop list. Place an instance of the
    corresponding symbol in your schematic, and then all will be OK.

    ***************************************************

    SCCS Info: @(#) abSpectreIncludeView.ils 11/11/08.18:05:33 1.1

    */

    (importSkillVar editor)
    (importSkillVar hicQuestionDialog)

    /****************************************************************
    * *
    * (abSpectreNetlistIncludeProc inst) *
    * *
    * Netlist Procedure used to netlist the include view when it is *
    * reached. *
    * *
    ****************************************************************/

    (defun abSpectreNetlistIncludeProc (inst)
    (let (formatter netlister ddId fileName)
    (setq formatter (nlGetFormatter inst))
    (setq netlister (nlGetNetlister formatter))
    (setq ddId (ddGetObj
    (nlGetLibName inst)
    (nlGetCellName inst)
    (nlGetViewName inst)
    "*"))
    (when ddId
    (setq fileName (getq ddId readPath)))
    (when fileName
    (nlPrintString netlister
    (sprintf nil "include \"%s\"" fileName))
    )
    ))


    /***************************************************************
    * *
    * (abRegisterSpectreTextView) *
    * *
    * Function to register the view type in DFII *
    * *
    ***************************************************************/

    (defun abRegisterSpectreTextView ()
    (deRegApp
    ?viewType "abSpectreNetlist"
    ?appName "Spectre Netlist"
    ?widgetType "none"
    ?dataTrigger 'abSpectreNetlistDataTrigger
    ?enableTrigger 'abSpectreNetlistEnableTrigger
    ?appTrigger 'abSpectreNetlistAppTrigger
    )
    )

    /***************************************************************
    * *
    * Trigger functions *
    * *
    ***************************************************************/

    (defun abSpectreNetlistDataTrigger (argList)
    (let ((mode (getq argList accessMode))
    (libName (getq argList libName))
    (cellName (getq argList cellName))
    (viewName (getq argList viewName))
    cv editCmd
    )
    (setq cv
    (abOpenTextCellView libName cellName viewName
    mode "abSpectreNetlist" nil))
    (when cv
    (case mode
    ;----------------------------------------------------------------
    ; In edit mode, bring up an editor, and then generate
    ; all the other data when editor exited
    ;----------------------------------------------------------------
    (("a" "w")
    (case editor
    (("vi" "vim") (setq editCmd (strcat "xterm -e " editor)))
    (t (setq editCmd editor))
    )
    (setq editCmd
    (strcat editCmd " " (getq cv fullPath)))
    (abIpcBeginProcessWithUserData
    editCmd
    ""
    'abSpectreNetlistDataHandler
    'abSpectreNetlistDataHandler
    'abSpectreNetlistExitHandler
    cv
    )
    )
    ;----------------------------------------------------------------
    ; Readonly - just view it
    ;----------------------------------------------------------------
    (t
    (view (getq cv fullPath))
    (abCloseTextCellView cv)
    )
    )
    )
    t
    )
    )

    (defun abSpectreNetlistDataHandler (_cid data _cv)
    (printf "%s" data)
    )

    /*******************************************************************
    * *
    * (abSpectreNetlistExitHandler _cid _status cv) *
    * *
    * Exit handler takes care of creating shadow database file, so OSS *
    * can switch into the view. *
    * Adds view-specific CDF to add netlisting procedure. *
    * Offers to create a symbol. *
    * Also closes the cellView, removing the lock. *
    * *
    *******************************************************************/
    (defun abSpectreNetlistExitHandler (_cid _status cv)
    (let (dbCv)
    (printf "Closing %s/%s/%s\n"
    (getq cv libName)
    (getq cv cellName)
    (getq cv viewName)
    )
    ;--------------------------------------------------------------------
    ; Create shadow file to stop at. No terminals need to be created, because
    ; we're not smart enough to parse the include file to check for terminals
    ;--------------------------------------------------------------------
    (setq dbCv
    (dbOpenCellViewByType
    (getq cv libName)
    (getq cv cellName)
    (getq cv viewName)
    "netlist"
    "wc"))
    (dbSave dbCv)
    (dbClose dbCv)
    ;--------------------------------------------------------------------
    ; Add the netlist procedure into the view-specific CDF
    ;--------------------------------------------------------------------
    (almSetNetlistProcedure
    (getq cv libName)
    (getq cv cellName)
    'abSpectreNetlistIncludeProc
    ?view (getq cv viewName)
    )
    ;--------------------------------------------------------------------
    ; Auto symbol creation. May need some tuning...
    ;--------------------------------------------------------------------
    (unless (ddGetObj (getq cv libName) (getq cv cellName) "symbol")
    (hiDisplayAppDBox
    ?name 'abSpectreNetlistCreateSymbol
    ?dboxBanner "Create Symbol"
    ?dboxText (sprintf nil "Cellview %s symbol does not exist.\nDo you want to create it?"
    (getq cv cellName))
    ;----------------------------------------------------------------
    ; Callback just dumbly creates symbol with no pins using current template
    ;----------------------------------------------------------------
    ?callback sprintf(nil "(schPinListToSymbol \"%s\" \"%s\" \"symbol\" nil)"
    (getq cv libName) (getq cv cellName))
    ?dialogStyle 'modal
    ?dialogType hicQuestionDialog
    ?buttonLayout 'YesNo
    )
    )
    ;--------------------------------------------------------------------
    ; Now close the "text" cellView
    ;--------------------------------------------------------------------
    (abCloseTextCellView cv)
    )
    )

    (defun abSpectreNetlistEnableTrigger (_argl)
    t
    )

    (defun abSpectreNetlistAppTrigger (_argl)
    t
    )

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


    /* abOpenTextCellView.il

    Author A.D.Beckett
    Group Custom IC (UK), Cadence Design Systems Ltd.
    Language SKILL
    Date Mar 31, 2000
    Modified
    By

    Simple PI for dealing with text cellViews. Typical use is
    as follows:

    cv=abOpenTextCellView("mylib" "mycell" "notes" "a")
    fprintf(cv->port "Testing 123\n")
    abCloseTextCellView(cv)

    Takes care of creating the files, locking them, and so on.

    Ideas for the future:

    1. Keep a record of all open text cellViews so that they
    can be accessed as a whole - e.g. to close all of them
    at once.
    2. Multiple calls to abOpenTextCellView() for the same file
    whilst still open should be handled gracefully - will just
    clobber it at the moment.

    ***************************************************

    SCCS Info: @(#) abOpenTextCellView.il 10/22/03.14:28:50 1.2

    */

    ;------------------------------------------------------------------------
    ; Structure for keeping track of a text object
    ;------------------------------------------------------------------------
    (defstruct abTextCellView libName cellName viewName fileName fullPath mode port)

    /************************************************************************
    * *
    * (abOpenTextCellView libName cellName viewName @optional (mode "r") *
    * (viewType "text") (openPort t)) *
    * *
    * Open up a text cellView in the same kind of way as a CDBA cellView. *
    * The cellView may be opened in "r","a", or "w" modes - default is "r". *
    * The return value is a structure instance, of which the most useful *
    * slot is the port slot - this enables you to read or write to the *
    * file in the cellView. *
    * Can choose the registered viewType, and also whether it should open *
    * a port or not; useful to turn off if you want to edit with an editor *
    * *
    ************************************************************************/

    (procedure (abOpenTextCellView libName cellName viewName @optional (mode "r")
    (viewType "text") (openPort t))
    (let ((fileTail (ddMapGetViewTypeFileName viewType))
    fileObj fileName lockId portId textObj
    (locked t))
    (setq fileObj (ddGetObj libName cellName viewName fileTail nil mode))
    (when fileObj
    (if (member mode '("a" "w"))
    (progn
    ;------------------------------------------------------
    ; Lock the file if in "a" or "w" mode
    ;------------------------------------------------------
    (setq fileName (getq fileObj writePath))
    (setq lockId (ddLockPath fileName))
    ;------------------------------------------------------
    ; If lockable, then try to open the file
    ;------------------------------------------------------
    (setq locked nil)
    (when (ddLockSet lockId "w" nil)
    (if
    (and openPort
    (null (setq portId (outfile fileName mode)))
    )
    ;-----------------------------------------------
    ; if it couldn't be opened, free the lock
    ;-----------------------------------------------
    (ddLockFree lockId)
    ;-----------------------------------------------
    ; Otherwise say it was locked
    ;-----------------------------------------------
    (setq locked t)
    )
    )
    )
    (progn
    ;------------------------------------------------------
    ; Otherwise if read mode, open file for read - don't
    ; bother locking it
    ;------------------------------------------------------
    (setq fileName (getq fileObj readPath))
    (when openPort
    (setq portId (infile fileName))
    )
    )
    )
    ;-----------------------------------------------------------
    ; If the file was opened OK, create the structure
    ; and it was locked (or readonly)
    ;-----------------------------------------------------------
    (when (and locked (or portId (null openPort)))
    (setq textObj
    (make_abTextCellView
    ?libName libName
    ?cellName cellName
    ?viewName viewName
    ?fileName fileTail
    ?fullPath fileName
    ?mode mode
    ?port portId
    )
    )
    )
    )
    ;-----------------------------------------------------------------
    ; Return the text object
    ;-----------------------------------------------------------------
    textObj
    ))

    /***********************************************************************
    * *
    * (abCloseTextCellView textObj) *
    * *
    * Close a text cellView, referenced by the textObj structure, as *
    * returned by abOpenTextCellView. This takes care of closing the file, *
    * removing the lock, and cleaning up if the file was empty. *
    * *
    ***********************************************************************/

    (procedure (abCloseTextCellView textObj)
    (let (lockId)
    ;-----------------------------------------------------------------
    ; Close the file itself
    ;-----------------------------------------------------------------
    (when (portp (getq textObj port))
    (close (getq textObj port)))
    ;-----------------------------------------------------------------
    ; Mark the port as nil, just to avoid accidents
    ;-----------------------------------------------------------------
    (putpropq textObj nil port)
    ;-----------------------------------------------------------------
    ; Free any locks on the file (if there were any)
    ;-----------------------------------------------------------------
    (setq lockId (ddLockPath (getq textObj fullPath)))
    (ddLockFree lockId)
    ;-----------------------------------------------------------------
    ; Release the object. This has the benefit of removing the cellView
    ; if the text file was empty
    ;-----------------------------------------------------------------
    (ddReleaseObj
    (ddGetObj
    (getq textObj libName)
    (getq textObj cellName)
    (getq textObj viewName)
    (getq textObj fileName)
    )
    )
    t
    ))
     
    Andrew Beckett, Jan 2, 2009
    #2
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 (here). After that, you can post your question and our members will help you out.