Sorry for the incomplete message, I accidentally hit the wrong key. As for you question: What should find_first_index and find_last_index return if not found? The answer is: an empty queue. One of the reasons why all locator methods return a queue is because they provide a general mechanism for returning "not-found". Arturo -----Original Message----- From: Arturo Salz Sent: Thursday, November 17, 2005 10:33 AM To: 'Rich, Dave'; sv-ec@eda.org Subject: RE: [sv-ec] 5.15 Array manipulation methods - question Dave, I don't know how you concluded from the LRM that array manipulation methods iterate over a single dimension. The example quoted by Shalom does suggest iteration over all (unpacked) dimensions. The array re-ordering methods are the only array manipulation methods that do explicitly specify a single dimension. What you suggest might be a reasonable approach, but a change nonetheless. As for you question: What should find_first_index and find_last_index return if not found? The answer is: a empty queue. One of the reasons why all locator methods return a queue is because they provide a general mechanism for returning -----Original Message----- From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of Rich, Dave Sent: Thursday, November 17, 2005 8:41 AM To: sv-ec@eda.org Subject: RE: [sv-ec] 5.15 Array manipulation methods - question Shalom, The array manipulation methods only iterate over a single dimension (dimension 1) unless you explicitly select a dimension. Unfortunately, this is only shown by example without normative text. (I would have preferred square brackets to select the index) Coincidentally, I was reading this yesterday too and found that not all array manipulation methods should return queues, only find, and find_index return queues. What should find_first_index and find_last_index return if not found? Unfortunately, the default value may also be a valid index. > -----Original Message----- > From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of > Bresticker, Shalom > Sent: Thursday, November 17, 2005 6:07 AM > To: sv-ec@eda.org > Subject: [sv-ec] 5.15 Array manipulation methods - question > > Hi, > > 5.15 ("Array manipulation methods") gives the impression that all these > methods relate to 1-dimensional arrays. Or at least, if the array is > multi-dimensional, then they relate to it as an array of arrays, since the > array type can be anything. > > So it makes sense that they return queues of array_type, and the index > locator methods return queues of indexes, where each index is of type int. > > I understood all that, till I got to 5.15.4 "Iterator index querying". > Suddenly I find that the methods seem to iterate over each individual > element of a multi-dimensional array, as in the last example: > > int mem[9:0][9:0], mem2[9:0][9:0]; > int q[$]; > ... > // find all items in mem that are greater than corresponding item in mem2 > q = mem.find( x ) with ( x > mem2[x.index(1)][x.index(2)] ); > > Now I'm confused about how it works. > > For example, what would I get in this example if I used mem.find_index > instead of mem.find? > > And what is the meaning of the previous code line from the same example: > > // find all items equal to their position (index) > q = arr.find with ( item == item.index ); > > My head hurts... > > Shalom Bresticker > Intel Jerusalem LAD DA > +972 2 589-6852 > +972 54 721-1033 > I don't represent Intel >Received on Thu Nov 17 10:36:36 2005
This archive was generated by hypermail 2.1.8 : Thu Nov 17 2005 - 10:36:48 PST