I wrote a set of scripts to make Cadence IC tools & Subversion work together. This requires subversion 1.4 or higher. Red Hat Enterprise Linux 4 by default ships with 1.3.
See also Pictorial Introduction to Using Cadence/Subversion for detailed tutorial on usage. This post is mostly about the guts of the scripts.
Note: this is not professional/enterprise Cadence/Subversion integration (which is much more powerful and highly recommended). My solution works well for personal or small team scenarios, where the users are patient and willing to put up with some debugging. There were a few problems that I had to solve:
Pesky .svn directories
The main problem is that Subversion puts .svn housekeeping directories everywhere. When I’d copy a cell, these directories would come along. This baggage caused subversion to get really confused. It would think that the new cell was a check-out of the old cell (not a copy with ancestry). It was clear that something needed to be done to prevent these copies. So, I created a copy hook to remove .svn directories from cadence copy commands; this is contained in svnCopyTrigger.il
. This solution isn’t complete–namely, when the analog design
environment (ADE) saves a simulation state, it seems to completely
obliterate the directory (including the .svn sub-directory) and re-save
the state information. What I’ve found that works is:
- remove the pre-existing ADE state directory (either in ./.artist_state or as cell-view)
- re-save the new state using ADE
- tar up the saved state
- svn up to restore the .svn directory
- untar the saved state (over-writing the state information but not the .svn directory)
I have automated steps 3,4,5 in a script called fixtilde
.
Locking
For a while, I went without locking. This worked well until someone else was working on the same design (as soon as it went to layout). My layout contractor would edit (for LVS) the same cell I was working out without me knowing (and vice versa). We’d each get stuck when we tried to check-in. So, it was clear that we needed a locking mechanism. This is where subversion (and not many other version control systems) shines: it has a very unobtrusive locking mechanism. By setting the correct properties, files will be dumped out with read-only UNIX permissions. By giving an svn lock
command, subversion will mark the file locked in the repository (thus allowing no one else to lock it) and make it writable in your working copy.
The only difficulty with this system is that it works on files only. There is no recursive lock command. So, I wrote a python script to recurse down directories and lock all files. I also wrote a script (lockify) to recursively put permissions (svn:lock-required) on all files in a directory so that subversion “requires” them to be locked before editing.
Note that locks can be bypassed by chmod
‘ing a directory. This is useful since you may want to try an edit that you don’t intend to check back in while someone else has it locked. The locking mechanism gives users a default way to avoid stepping on each others toes without paralyzing them.
Eventually, I found myself locking from the command-line so often, that I created Cadence procedures to do it (svnLockCell.il
and svnLockCellView.il
) and associated schematic/layout/symbol menu picks (in the menus
directory).
Adding
One final note is that subversion won’t place files/directories under version control unless you ask it to (svn add
). I found it tedious to go to the command line and do an svn add
for new items all the time. In addition, there are certain things you don’t want added (.cdslck files). So, I wrote procedures (svnAddCell.il
, svnAddCellView.il
) and associated menus to to perform these tasks. The addCell and addCellView procedure also puts the correct subversion properties on files to require locking. You can use the unlockify
command (from a UNIX shell) to remove these properties.
Usage
Untar the cdsvn2.tar file in your Cadence start directory (wherever you type icfb, icms, etc.). The tar file contains a svn.cdsinit file which needs to be loaded in your .cdsinit:
1 |
load("svn.cdsinit") |
In addition, it contains a cdsLibMgr.il file which sets up menu picks from the Library Manager. Finally, it contains a menus/ directory that has menu additions (Subversion>Lock View) for schematic, layout, and symbol editing windows.
The files
This tar file
contains all the cadence skill (.il) files, menu definitions (/menus), and command-line utilities (/bin). I am releasing it under the GPL. Note that this package comes with no warranty that it will work as intended. If you lose any data, money, or anything else because you chose to download it and run it, that’s your fault.
Update 2008-09-03
Added “Usage” section and added cdsLibMgr.il to TAR file.
Update 2008-09-04
Added some more missing files to CDSVN.tar: svn.env, example.cdsinit, svn.cdsinit, cadence_ignores.txt
Also, attributed a couple other people for this comp.cad.cadence post: Problem with Copying cells
svnCopyTrigger.il
Great set of scripts.
How will the updated subversion 1.7 working copy format influence this? Presumably many of the issues will be resolved since we won’t have .svn directories all over the place any more.
Kind regards,
Richard.
You just need to make sure that the cdsLibMgr.il is located in the directory where you start-up icfb. First time I was able to find some useful info on the cdsdoc: Cadence Library Manager User Guide. The setup.loc file defined the different paths where the cdsLibMgr.il is being searched:
————————————————————–
The file is loaded from the first location in the order defined in the Cadence setup search file (setup.loc) as described in Cadence Application Infrastructure User Guide. The typical order used to load this file is
* The current working directory
* The home directory
* The your_install_dir/share file
When a file is found from one of these locations, the file is loaded and the search stops.
You can customize the name for the cdsLibMgr.il file using a default setting in your .cdsenv file. For a detailed description of this setting, see “Using UNIX to Add Settings to the .cdsenv File”.
————————————————————–
This did the trick for me.
@VirtualCLD:
Hmm… that is very odd. The library manager and schematic menus are loaded using different methods. It’s weird that both of them are broken.
Could you try (as a debugging step) setting things up without the cdsvn sub-directory?
Also, can you try calling any of the functions defined in the scripts, to see if they are defined?
P.S. Sorry for the late response.
Thanks for the quick response. Unfortunately, I’ve tried placing the cdsvn directory below the working directory, while keeping the menu/ subdirectory in the Cadence working (start) dir, and editing the .cdsinit files. However, I still can’t seem to get the SVN menu options in the Library Manager or Schematic Editors. Maybe I have to modify the SKILL scripts with the new directory paths?
This is a great resource as I’ve just started to learn the headaches of using Cadence projects with subversion. I had two questions related to your scripts.
1) I see that if I extract the tar file, I get a CDSVN directory. I then can go into CDSVN and use THAT directory as my working directory. I could also copy the entire contents of CDSVN and paste it into my current icfb working directory and then edit the .cdsinit file from there. However, I would like to have the scripts all live in a sub-dir like this icfb_work_dir/cdsvn/ I would run icfb within icfb_work_dir, but the SKILL scripts would reside in the sub-dir ./cdsvn Unfortunately, when I do this, I can’t get the scripts to load properly and I no longer have the menu hooks. I realize this is purely an aesthetic/organizational request, but if you know how I could do this, I would greatly appreciate it.
2) I see the SVN copy commands in LibManager, but they seems to be basic Cell/View copy commands. They do not appear to support Hierarchical copying. Manually copying a singe Cell or View with svn copy from the console isn’t too bad, but where Cadence’s copy command is extremely useful is when you need to copy an entire hierarchy that consists of dozens of Cells (and there corresponding views). Is there a way to get Hierarchical Copying to work with your scripts, or would this require some advanced SKILL scripting (my SKILL knowledge pretty much zero)?
Hi, VirtualCLD. The scripts should work when you move them to a subdirectory (provided you change your .cdsinit files). However, the menu definitions are different. Cadence looks for menu additions in the menu/ subdirectory of the Cadence start directory. So, those have to be collocated.
@Dariusz:
I didn’t realize that the lock command arrived in subversion 1.4. Indeed, 1.3 is the version that ships with Red Hat Enterprise Linux–which most Cadence users are using. Thanks for posting the solution! Glad to hear it worked.
Hi,
I have found the problem. This is the subversion version number. I updated to 1.4 and everything works perfectly. Thanks once again for a great job.
Dariusz
Hi Poojan,
great work. Thanks for this extremelly useful scripts.
However, I am experiencing some issues with locking. When I did it through the popup menu
the error message appears, since the svn does not understand command lock.
I tried to solve the issue by replacing “svn lock” in your locking script to just “lock”,
as the lock command exists in /bin directory. Unfortunately, it does not solve the problem,
since some data incompatibilities are pointed out.
Therefore I would like to ask you if the way I choose is correct. Maybe the reason of my troubles is totally different.
Kind regards
Dariusz
[…] I previously blogged about some scripts I use to help Cadence & Subversion be more compatible. I received some feedback that the scripts were incomplete and came without any usage model. So, I went through an excercise to document the scripts and to make sure they were complete. […]
I updated the CDSVN.tar file again with more missing files. Thanks to Markus for pointing them out.
OK: I just updated the post & CDSVN.tar with the missing files (cdsLibMgr.il). Give it another try.
@Markus:
What you do is just read my mind and everything works. Got that? 🙂
Actually, I realize that I left out a key bit of information. To use the system, you need to add
load(“svn.cdsinit”)
in your .cdsinit file. (Or just type that into the CIW). This will load the svnAddCell/CV.il file for you. Once you do that, you should have the functions defined that will add the cell view.
I also realize that I left out a key file: cdsLibMgr.il which adds menu picks to the library manager.
I’m going to upload a new version of CDSVN.tar which should have this addition.
Sorry for the oversight, and thanks for your feedback (and patience).
Hi,
nice tools, but can you please explain how I must use the svnAddCell/CV.il? I’m not able to add a new cell to teh svn.
Thanks,
Markus