Cadence® system design and verification solutions, integrated under our Verification Suite, provide the simulation, acceleration, emulation, and management capabilities.
Verification Suite Related Products A-Z
Cadence® digital design and signoff solutions provide a fast path to design closure and better predictability, helping you meet your power, performance, and area (PPA) targets.
Full-Flow Digital Solution Related Products A-Z
Cadence® custom, analog, and RF design solutions can help you save time by automating many routine tasks, from block-level and mixed-signal simulation to routing and library characterization.
Overview Related Products A-Z
Driving efficiency and accuracy in advanced packaging, system planning, and multi-fabric interoperability, Cadence® package implementation products deliver the automation and accuracy.
Cadence® PCB design solutions enable shorter, more predictable design cycles with greater integration of component design and system-level simulation for a constraint-driven flow.
An open IP platform for you to customize your app-driven SoC design.
Comprehensive solutions and methodologies.
Helping you meet your broader business goals.
A global customer support infrastructure with around-the-clock help.
More Support Log In
24/7 Support - Cadence Online Support
Locate the latest software updates, service request, technical documentation, solutions and more in your personalized environment.
Cadence offers various software services for download. This page describes our offerings, including the Allegro FREE Physical Viewer.
The Cadence Academic Network helps build strong relationships between academia and industry, and promotes the proliferation of leading-edge technologies and methodologies at universities renowned for their engineering and design excellence.
Participate in CDNLive
A huge knowledge exchange platform for academia to network with industry. We are looking for academic speakers to talk about their research to the industry attendees at the Academic Track at CDNLive EMEA and Silicon Valley.
Come & Meet Us @ Events
A huge knowledge exchange platform for academia. We are looking for academic speakers to talk about their research to industry attendees.
Americas University Software Program
Join the 250+ qualified Americas member universities who have already incorporated Cadence EDA software into their classrooms and academic research projects.
EMEA University Software Program
In EMEA, Cadence works with EUROPRACTICE to ensure cost-effective availability of our extensive electronic design automation (EDA) tools for non-commercial activities.
Apply Now For Jobs
If you are a recent college graduate or a student looking for internship. Visit our exclusive job search page for interns and recent college graduate jobs.
Cadence is a Great Place to do great work
Learn more about our internship program and visit our careers page to do meaningful work and make a great impact.
Get the most out of your investment in Cadence technologies through a wide range of training offerings.
Overview All Courses Asia Pacific EMEANorth America
Instructor-led training [ILT] are live classes that are offered in our state-of-the-art classrooms at our worldwide training centers, at your site, or as a Virtual classroom.
Online Training is delivered over the web to let you proceed at your own pace, anytime and anywhere.
Exchange ideas, news, technical information, and best practices.
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.
It's not all about the technology. Here we exchange ideas on the Cadence Academic Network and other subjects of general interest.
Cadence is a leading provider of system design tools, software, IP, and services.
Get email delivery of the Cadence blog featured here
I want to show a few of these examples in this blog post (and a few upcoming posts) in hopes you may find some of the techniques useful.
One straightforward way to sum a given list of numbers is to use simple iteration and mimic a primitive microprocessor. That is, establish an accumulator initialized to zero, and continue to increment the accumulator by successive numbers from the list until the list is exhausted, and finally return the accumulated value.
(defun sumlist_1a (numbers)
(let ((sum 0))
(foreach number numbers
sum = sum + number)
I imagine the code in this function would look very similar in many different languages such as C or Java -- of course with syntax variations.
In SKILL++ (as well as in traditional SKILL) this is not a particularly efficient implementation because the SKILL virtual machine compiler, unlike a native compiler, is not able to make particularly good use of the processor registers. The way to force SKILL to use the processor registers is to organize your code, when possible, to call built-in compiled functions.
(defun sumlist_1b (numbers)
(apply plus numbers))
Remember -- to force this function to be defined as SKILL++ rather than traditional SKILL, you'll either need to load it from a file with a .ils extension, or you'll need two wrap the definition in (inScheme ...) when you copy and paste it into the CIWindow.
A quick test with measureTime shows that sumlist_1b is roughly 10 times faster than sumlist_1a on a 10,000 element list of numbers.
How does it work?
The plus function returns the sum in its argument list. For example: (plus 1 2 3 4 5) evaluates to 15.
(plus 1 2 3 4 5)
The apply function, when called with two arguments, calls the function designated by its first argument. In particular apply calls that function argument list given as its second argument. For example:
(apply plus '(1 2 3 4 5))
'(1 2 3 4 5)
Note that plus is used without a leading quote because in SKILL++ all global functions are available in a SKILL++ global variable of the same name. The variable plus evaluates to the plus function.
Since sumlist_1b is so much faster (execution-wise) and simpler (line-of-code-wise), it is very tempting to use, but be careful! It suffers from some limitations that do not exist with sumlist_1a. For example, sumlist_1b cannot sum the elements of the nil list. The sumlist_1a, however, claims the sum of the list nil is 0, which indeed sounds like a reasonable answer. Furthermore, sumlist_1a, claims that the sum of a singleton list such as (3.4) is the first (and only) element of the list, which again seems like a reasonable result.
Apply in other languages
Actually the apply function is not an invention of the SKILL (or SKILL++) language. It is in fact central to programming languages derived from lambda calculus. A quick search on Wikipedia finds an article explaining its use in several languages.
More to come
In the next posting, I'll show some ways to get the speed and conciseness of sumlist_1b without the caveats.
This what I want. Thanks.
Sure I will try with comp.cad.cadence. also.
Hi Ram, It seems like in your example, the fact that you have a list of points is not relevant. You want a function which takes a list of objects (of any types), and a list of booleans, and returns a new list which does a logical AND of the respective elements. Did I understand the question?
You can do this with (foreach mapcar ...) pretty easily.
(defun mask_list (domain mask)
(foreach mapcar (item use?) domain mask
(and use? item)))
Of course you can also write this with a direct call to mapcar rather than foreach.
The performance is identical, they differ only in surface syntax.
I personally find the (foreach ...) version a bit more readable.
(defun mask_list (domain mask)
(mapcar (lambda (item use?) (and use? item))
Also if you find the use of (and ...) difficult you can do the same thing with (when ..) which again should have the same performance characteristics.
(defun mask_list (domain mask)
(foreach mapcar (item use?) domain mask
(when use? item)))
With either version of the above function you should see that it works the same--selecting the items from the first list for which the corresponding item in the second list is non-nil.
(mask_list '(A B C D E) '(nil t t nil t))
(mask_list '((0 0) (1 2) (3 4) (5 6) (7 8)) '(nil t t nil t))
Does this help?
By the way, sometimes you can get answers to questions like these by posting a message to comp.cad.cadence.
Hi Jim, Thanks for the prompt reply. Your soultion helps. Also thanks for accepting my request on the tutorial topics. Looking forward -Ramakrishnan
Thanks for the prompt response. Your examples are working fine. Unfortunately my cadence version is 5.10...
I found that the two lists and their sublists have to be of same length to work flawlessly. This is what I am trying to do.
assume a path with following points and selection values
aPath~>points = list(1:2 1:3 2:3)
geGetSelSetFigPoint(aPath) = (nil t nil)
I'm expecting this result list(nil 1:3 nil)
I hate to ask direct answer but these mapcar functions are bouncing.
Thanks a lot for accepting my request on tutorial topics. I'm looking forward.
Hi Ram, thanks for the comment. I'll have to think about how to come up with a "extensive tutorial" on the mapping functions without being too esoteric.
In the mean time, here are a couple of functions you can try. Remember to load this code from a file with a .ils extension.
(defun add_lists (@rest lists)
(apply mapcar plus lists))
(add_lists '(1 2 3 4 5 6) '(2 3 4 5 6 7) '(0 1 2 3 4 5))
=> (3 6 9 12 15 18)
(defun add_points (@rest lists)
(apply mapcar add_lists lists))
(add_points '((0 0) (1 2) (3 4) (5 6)) '((1 1) (2 2) (3 3) (4 4)))
=> ((1 1) (3 4) (6 7) (9 10))
Do you have a function in your virtuoso named: mapinto? If so, you can implement add_points more efficiently with the caveat that it will destroy the given lists in generating the result. If I'm not mistaken mapinto is available in IC615.
(apply mapinto (car lists) add_lists lists))
(apply mapinto (car lists) plus lists))
I'll let you ponder over the subtle implementations of add_points and add_lists above for a while and see if you can understand how they work. Please play with them and experiment and let me know if you have more questions about them.
Hi Jim, Nice tutorials... I am looking for some extensive tutorials on mapcar, mapcan and other list traversing functions. I am trying to add to list of points element vise. eg.. '(1:2 3:4 5:6) + '(7:8 9:10 11:12) = '(8:10 12:14 16:18). Is it possible to do this only with mapcar or maplist functions? I understand that this can be done with foreach but its expensive is what I learnt from your tuts.