Low-level logical functions?

Børge Strand-Bergesen borge.strand at gmail.com
Sat Nov 7 19:19:29 CET 2009


Dear all,

I recently had very good use for logical operations. My problem was to
simulate some highly optimized hardware using plain (and on the
surface not highly optimized) C code.

Here is a feature suggestion. I frequently use Verilog to implement
and simulate DSP functionality. One strong feature of that language is
the ability to easily manipulate bits.

foo[4:0] <= bar[13:8]; would make the 5 LSBs of foo equal the selected
bits of bar, not touching any other part of foo. Similar bit-field
read/write in C would come in handy for some applications. I know it
is doable with shifting etc, but I know of no short form. Also, in
Verilog the binary data will overflow only within their allocated
size, just like the 4-bit operations 0x0 - 0x1 = 0xF.

Thanks,
Borge

On Sat, Nov 7, 2009 at 18:58, Barukh Ziv <barukh.ziv at gmail.com> wrote:
> Sincere all,
>
> Thank you very much for the prompt reply.
>
> If I understand correctly, internal functions cannot be called from outside
> code?
> Is there any planned date for v4.4 release?
>
> If you permit, I would like to ask another question: it looks like it may be
> beneficial to have carry-less arithmetic over integers in GMP. An important
> application of this is arithmetic over GF(2^m) (so called binary fields),
> which are important in Elliptic Curve Cryptography (ECC).
>
> It is true that cary-less addition/subtraction may be efficiently
> implemented by means of logical XOR. It's not the case for the
> multiplicaition, though. Using hardware support, this may be greatly
> optimized. Here's the message I received from Alfred Menezes, one of leading
> specialists in ECC:
> "Intel announced in 2008 that their future processors would be equipped with
> a "PCLMULQDQ" instruction for fast "carryless" multiplication of 64-bit
> binary polynomials. This instruction is very much anticipated because it
> will greatly speed up computations on elliptic curves over binary fields
> (including the so-called "Koblitz curves"). At present, elliptic curves over
> prime fields have the advantage because of the fast integer multiplication
> instructions available on Intel machines."
>
> As far as I know, a processor supporting the above instruction, is already
> in the market.
>
> Sincerely,
> Barukh.
>
> On Sat, Nov 7, 2009 at 2:15 PM, Barukh Ziv <barukh.ziv at gmail.com> wrote:
>
>>  Sincere all,
>>
>> I have being using GMP library for over half a year now, and I am really
>> satisfied with it, to say the least. I have found almost everything needed
>> there, and the speed is really impressive.
>>
>> Recently, I have encountered something that I would like to use in the
>> library, but didn't find it: the low-level functions (mpn_) do not seem to
>> include the logical operations and, or, and xor. As a use case for such
>> operations, I have the following example: efficient arithmetic over binary
>> fields GF(2^m).
>>
>> Could you please enlighten if I am missing something in this respect, and
>> if not, how difficult it would be to implement such an interface?
>>
>> Sorry if this question was discussed previously.
>>
>> Sincerely,
>> Barukh Ziv.
>>
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at gmplib.org
> https://gmplib.org/mailman/listinfo/gmp-discuss
>


More information about the gmp-discuss mailing list