Cadence® system design and verification solutions, integrated under our System Development Suite, provide the simulation, acceleration, emulation, and management capabilities.
System Development 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.
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.
Get the most out of your investment in Cadence technologies through a wide range of training offerings.
This course combines our Allegro PCB Editor Basic Techniques, followed by Allegro PCB Editor Intermediate Techniques.
Virtuoso Analog Design Environment Verifier 16.7
Learn learn to perform requirements-driven analog verification using the Virtuoso ADE Verifier tool.
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 technlogy. 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.
In this posting of we show yet another implementation of sumlist using an operator which will be new to many readers. While the do construct is common to many lisp dialects, particularly Scheme implementations, it is somewhat controversial as some people love it, and some people hate it. Some people find it elegant and expressive, and other find it terse and awkward. I'll present it here and let you decide for yourself.
Recall the implementation of sumlist_1a which accepts a list of numbers as its argument and returns the arithmetic of these numbers.
(defun sumlist_1a (numbers) (let ((sum 0)) (foreach number numbers sum = sum + number) sum))
Here is yet another implementation of the sumlist function which we've seen in the past several postings. This version of the function uses the (do ...) construct.
(defun sumlist_5a (numbers) (do ((remaining numbers (cdr remaining)) (sum_so_far 0 (plus sum_so_far (car remaining)))) ((null remaining) sum_so_far)))
Evolution of Lisp
An excerpt from Evolution of Lisp:
Examining the example
The sumlist_5a uses do to iterate two variables remaining and sum_so_far from their respective initial values to their final values, using respective formulas to update the variables to their next values.
As was mentioned above, the syntax of do is somewhat off-putting. There are lots of parentheses, and several interdependent components which you have to get right. The following is an itemization of the various parts of the (do ...) loop.
(do ((remaining numbers (cdr remaining)) (sum_so_far 0 (plus sum_so_far (car remaining)))) ((null remaining) sum_so_far))
remaining = numbers
sum_so_far = 0
remaining = (cdr remaining)
sum_so_far = (plus sum_so_far (car remaining))
(do ((remaining numbers (cdr remaining)) (sum_so_far 0 (plus sum_so_far (car remaining)))) ((null remaining) sum_so_far) (println remaining) (printf "partial sum = %L\n" sum_so_far))
One way to think of the SKILL do is as a mixture or generalization of several iteration constructs.
Do as for
The following is like a (for ...) loop.
(do ((i 0 i+1)) (i==100 t) ; return t because for always returns t (println i))
(for i 0 100 (println i))
Do as foreach
The following is like a (foreach ...) loop.
(let ((some_list '(a b c d))) (do ((sub some_list (cdr sub)) (item (car some_list) (cadr sub))) ((null sub) some_list) ; return some_list because foreach returns the list it iterated over (println item)))
(let ((some_list '(a b c d))) (foreach i some_list (println i)))
Do as a mixture of for and foreach
The (foreach ...) iterates successively through a given list of items. The (for ...) loop iterates successively through a range of integers, given the lower and upper bounds of the range. If you want to iterate one variable through a given list while simultaneously iterating another variable through a range of integers, you can use the (do ...) loop.
(let ((some_list '(a b c d ...))) (do ((index 0 (add1 index)) (sub some_list (cdr sub)) (item (car some_list) (cadr sub))) ((null sub) t) (printf "The %d'th of the list is %L\n" index item)))
The 0'th of the list is aThe 1'th of the list is bThe 2'th of the list is cThe 3'th of the list is dThe 4'th of the list is eThe 5'th of the list is fThe 6'th of the list is g
The SKILL do can be tricky to use. It allows the programmer control of several parallel iteration variables, all of which are potentially incremented according to different rules. You may also explicitly determine the return value, which is fixed and useless for other iteration constructs such as (for ...). You may also specify a series of expressions to evaluate when the iteration finishes while the iteration variables are still in scope holding their final values.
Hopefully you can use the steps above as sort of a cookbook.
More to come
Glad you found the "do loop" interesting. You'll find that it does not work in traditional SKILL, you have to use SKILL++. So you'll need to name your file with a .ils extension, or you'll need to wrap the function definition with (inScheme ...).
Here is what happens if you try to use do directly in the CIWindow.
CIW> (inScheme (do () (t)))
CIW> (do () (t))
*Error* do: not supported in SKILL - do(nil (t))
<<< Stack Trace >>>
I recently found this reader question which was lost in my inbox.
I discovered the "do" syntax on your latest post "skill for the skilled (part5)"
This is very interesting. But I discovered that unfortunatly, skill interpretor that is embedded with Virtuoso does not support it.
Is there any plan to support it ? Did i make a mistake trying it ?
Thanks for your feedback