lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Maybe it could be interesting describing the kind of work I do.
Basically it is modeling chips and evaluate interconnect performances. 
That is I use traffic generators to generate bus transactions relying
upon heavily bit detailed protocols. Thus I generate requests which
include an address targeting specific part of the address map, so that I
generate them with masks... And then I need to analyze responses. There
it uses even more bitwise operation than writing the request itself
where constant can be predefined and added.
I find it cumbersome writing a new C++ traffic generator each time I
need to model a better distribution for traffic so encapsulating scripts
for that could be a great benefit.
And well I would prefer to have full expressivity in script language
rather having to write code in C/C++ side...
The last point is that also I expose this code to hardware designer who
are very used to read logical operations which can make code more
readable
if (a<<1)& (b | ~c) then ... 
is probably more easier to read than
if bit.and(a*2, bit.or(b, bit.not(c)) then
And with such fine grained operation, the overhead of C calls through
LuaStack starts to become a concern... 
Maybe this is not mainstream use of Lua, but I can imagine this can be
useful in game programming too. Well I can imagine using bits vectors to
code combine states of tiled maps. And well writing tester for any frame
base protocols can also need this. In the end we are used to see it in
so many languages that not having it is annoying, but having it will
surely make it very used.

-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Luiz Henrique
de Figueiredo
Sent: Tuesday, June 20, 2006 7:23 PM
To: Lua list
Subject: Re: Bitwsie operators in Lua

> This is surprising though, because a lot of configuration works are
> setting bits here and there...

Sure, but that does not mean that you want to set bits from Lua...
The Lua way is to provide options as strings and have a library
do the translation. You need a C library anyway to activate such
configurations, don't you?
--lhf

PS: For a C library that is extensible but does not use bits, see
pdflib.