Do you want ":=" operator?

X

Xiangyu Yang

(I may start a new thread. )

gabriele said:
If you're working with hardware check out
http://www.aracnet.com/~ptkwt/ruby_stuff/RHDL/

Ruby Hardware Description Language :)

An interest thing.

In your RHDL you have to use .assign or .<< to do signal assignment,
annoying thing also in my code for HW CPU model.

In ruby, the "=" will assign other *object* to a *variable*, and can't
(and shouldn't) be overrided. There are no simple way to modify the
state of an *object* referenced by a *variable*. Using .assign or
overriding other operators to do this job are both ugly. I notice that
someone suggested ":=" operator which can be overrided. I dream of it
all the days :). If I have ":=", I'm sure that my CPU model will save
at least half of the current lines and the program will be much more
natural and clearer.

In short, when you use ruby to model some objects, the ability to
assign/modify the *object* state/value in simple expression way is very
useful. It provides the possibility of running ruby code *directly* to
model other worlds.
 
G

gabriele renzi

I can't use << and other operators, for they are all meaningful in my
CPU model and have precedence problem. And I can't force anybody to
program "R0.assign(R0&R1)" for my CPU, otherwise I will be kicked to
death. I have to translate "Rx=..." to "Rx.assign ...", then eval the
latter.

maybe:
R0.set or set(R0, newvalue) could be acceptable :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,111
Latest member
KetoBurn
Top