( ESNUG 237 Item 4 ) ---------------------------------------------- [3/29/96]

From: ellement@sdd.hp.com (David Ellement)
Subject: Will Trade "How To Fake Out 2-D Arrays In Dc_shell" For "Functions"

Hello John,

Following the "offer a little, *then* ask for a little" philosophy, here's a
tidbit on list processing in dc_shell to simulate two dimensional arrays.
Often times I have wanted two addition features in the Design Compiler
script language: two dimensional arrays and functions.  I have found
a (clumsy) workaround to simulate dimensional arrays using the built-in
list processing capability.

To simulate a two dimensional array, I use a list and add or delete
items as n-tuples:

    array_list = { initial_row_1 initial_row_2 initial_row_3 }
      ...
    array_list = array_list + { next_row_1 next_row_2 next_row_3 }
      ...
    array_list = array_list + { last_row_1 last_row_2 last_row_3 }

Later, when I need to access a particular piece of information, I use
a foreach loop:

    item_1 = item_2 = item_3 = ""
    foreach (item, array_list) {
	if (item_1 == "") {
	    item_1 = item
	    continue
	}
	if (item_2 == "") {
	    item_2 = item
	    continue
	}
	item_3 = item

	/* use item_1, item_2, item_3 */

	item_1 = item_2 = item_3 = ""
    }

One use has been for a generic script to compile pieces of a design with
multiple clocks (not all of which are present in each piece) and for which
the name used for each clock is different in the different designs:

    /* in an initialization script */
    /* set clock data: { name period rising_edge skew } */
    clock_list = { "Clk" 50 0 0.5 }
    clock_list = clock_list + { "iClk" 50 25 0.8 }
    ...


    /* in the generic script */
    _name = _period = _rising_edge = _skew = ""
    foreach (item, clock_list) {
	if (_name == "") {
	    _name = item
	    continue
	}
	if (_period == "") {
	    _period = item
	    continue
	}
	if (_rising_edge == "") {
	    _rising_edge = item
	    continue
	}
	_skew = item

	create_clock -name _name -period _period \
	    -waveform { _rising_edge _rising_edge + _period / 2 } _name
	set_clock_skew -uncertainty _skew _name

	_name = _period = _rising_edge = _skew = ""
    }

Now I've contributed to ESNUG, I'd like to ask: Does anyone have a method to
provide something like "function" capability?

  - David Ellement
    Hewlett-Packard



 Sign up for the DeepChip newsletter.
Email
 Read what EDA tool users really think.


Feedback About Wiretaps ESNUGs SIGN UP! Downloads Trip Reports Advertise

"Relax. This is a discussion. Anything said here is just one engineer's opinion. Email in your dissenting letter and it'll be published, too."
This Web Site Is Modified Every 2-3 Days
Copyright 1991-2024 John Cooley.  All Rights Reserved.
| Contact John Cooley | Webmaster | Legal | Feedback Form |

   !!!     "It's not a BUG,
  /o o\  /  it's a FEATURE!"
 (  >  )
  \ - / 
  _] [_     (jcooley 1991)