On Wed, Mar 17, 2010 at 9:23 PM, Robert Smolinski <rsmol...@illinois.edu> wrote:
> Suraj Kurapati wrote:
>> As for the future of this project, I've had some new (rather
>> low-level) developments brewing since last year:
>>
>> * Ruby 1.9 coroutine support[1] for more efficient & consistent
>> behavior in all simulators.
>>
>> [1]: http://redmine.ruby-lang.org/issues/show/2294
>>
>
> It looks like [1] was a tricky issue to find/solve and that you had a decent
> challenge getting it in. It's very cool that you are continuing your work on
> the project. I've really enjoyed using your ruby-vpi so far.

Thanks for the encouragement.

> It seems to me
> that ruby's unique language features are a definite advantage in design
> verification.

Agreed.

> I figured out a work around to get to the array elements using the vpi
> function "vpi_handle_by_index", since I can't find the correct argument to
> pass to "to_a".

This explains why #to_a did not work: it uses vpi_iterate() instead of
vpi_handle_by_index():

  http://github.com/sunaku/ruby-vpi/blob/master/lib/ruby-vpi/core/handle.rb#L227

Currently there is no accessor implemented that uses vpi_handle_by_index():

  http://snk.tuxfamily.org/lib/ruby-vpi/#tbl:accessors

> Do you have any further tips / utility functions that you found useful? I'm
> trying to find an elegant function to shorten the call to get the interger
> value of a wire.

See http://snk.tuxfamily.org/lib/ruby-vpi/#vpi.handles

> The best I could do seems like overkill:
> def IntVal wire_name, module="DUT"
>  eval(module + "." + wire_name + ".intVal")

At first glance, I would change the above line to:

  module.send(wire_name).intVal

because eval() is frowned upon in the Ruby community.  It's a
necessary evil in some cases, but we generally try to avoid it.

Or better yet, you can use the VPI::Handle#/ method[2]:

  (module / wire_name).intVal

which is defined here:

  http://github.com/sunaku/ruby-vpi/blob/master/lib/ruby-vpi/core/handle.rb#L219

> end

Cheers.

Reply via email to