[sv-cc] Relating to Mantis 1385

From: Moorhouse, Abigail <abigailm_at_.....>
Date: Tue Jul 18 2006 - 11:28:43 PDT
hi all,
 
I propose some questions and possible clarifying answers on this
somewhat thorny topic. See P1800 section 27.14 (the Variables object
model). I am using "elemental type" to mean *integar var* for an *array
var* of *integer var*, *real var* for an *array var* of *real var* and
so on, for both 1-D and multi-D *array var* (i.e. NOT for slices, which
I believe would have *array var* type).
 
These questions are designed to clarify the expected P1800 behavior,
from which it will be easier to see where there are backwards
compatibility issues.
 
Q1. Are elemental types from arrays returned by the var select
transition the same as variables returned by the vpiReg transition on
the same array? i.e. if put into vpi_compare_handles (assuming
equivalent indices) would they compare as the same object even though
the VPI types were different?
A1. I think the natural answer here is yes - in some sense, the var
select is an alias for the element. Though having two objects of
different VPI type compare to be the same thing is a bit disconcerting..
 
Q2. When an element from an array is passed into a user-defined systf or
obtained via vpi_handle_by_name, or
vpi_handle_by_index/vpi_handle_by_multi_index is its type the elemental
type or var select (CF now when a reg would be vpiReg but an element of
an integer var/time var/real var array would be vpiVarSelect). 
A2. The user must be told to code defensively for BOTH cases. However
the use of var select should be deprecated, and the tendency be to move
to the elemental types, especially for the new SV variable types.
Backwards compatibility is an issue for the cases described in the
question.
 
Q3. Why are some of the variables class transitions not valid on var
selects, for example the single transitions to module and scope?
A3. An oversight. By the answer to Q1, the var select and elemental
objects should behave identically
 
Q4. Does iterating for variables with vpiReg on a multi-d array (of any
elemental type) ever return a slice?
A4. No. (not as obvious an answer as you might think, though, it returns
variables class objects, and a variables class object could reasonably
be a slice).
 
Q5. Can you iterate for elemental types on other arrays than arrays of
Reg using the elemental type? For example, iterate with vpiIntegerVar on
an array of integer var?
A5. Not according to the LRM. But I predict users will be confused by
this.
 
Q6. Why are scalar bit var and scalar logic var of different types to
indicate the 2S/4S nature of these bits, but var bit is used for the
elemental bit of a vector for both 2S and 4S vector types?
A6. This has been willed where what is willed must be.
 
Q7. Can slices be returned from vpi_handle_by_name, vpi_handle_by_index
and vpi_handle_by_multi_index?
A7. Yes (don't see why not?)
 
Q8. Do iterations with the vpiMemory tag return 1-D vpiArrayVars of
anything except reg?
A8. No. Use vpiArrayVar, but you can't explicitly search only for 1-D
objects for anything except reg. (This answer because a memory is
explicitly defined as a 1-D array of reg).
 
Any thoughts? I'm sure there is a potential for discussion on these, and
I apologize if answers for these questions already exist in the
documentation..
Abi
Received on Tue Jul 18 11:28:56 2006

This archive was generated by hypermail 2.1.8 : Tue Jul 18 2006 - 11:29:18 PDT