Re: [vhdl-200x] Modular types

From: <whygee@f-cpu.org>
Date: Sat Jul 12 2014 - 15:12:28 PDT
Le 2014-07-11 18:41, tgingold@free.fr a écrit :
> There is no obvious definition of logicals
> and shift operators for not mod 2**n types.

Well, in certain Galois fields, shifts are multiplies or divisions
(depending on the direction), AND is multiply, (X)OR is 
addition/subtraction...
This is how LFSR are derived from the equations :-)

> So I suppose nobody would
> use them (and we could revisit this issue at a later revision).

The first thing is to allow people to do it, then let them do it...
We all have personal tastes and we shouldn't let ours prevent
others from doing their own stuff (to a reasonable extent).

The 2^N case can be defined, and other bases left undefined for now,
but I have another issue to raise.

Going back to my experience of "emulating" modulars with plain VHDL,
in the case of GHDL, integers can be "shifted" left by using 2**N
wich internally uses the "pow()" subroutine... Which is SLOW,
while a shift should take at most a few cycles and instructions.

IF we define/provide non-binary bases, the simulator writers will
want to implement the general case, potentially disregarding the
other important case (base=2) which requires a specific, and
desired fast, implementation. Because it requires 2 handling strategies
and reasonable people will want to code for the "general cases"
that gives the same result as the "special case" anyway.
Just like using "pow()" with base 2.0 gives the same result as
a shift.

If we start deciding that "base=2 also defines booleans and shifts",
this would force people to implement "the expected" behaviour" in 2^N
(using the native CPU instructions and map to std_logic_vector or 
bit_vector).

After all, what decent CPU doesn't have shift/rotate/and/or/xor 
instructions ?
And why would a language prevent the user from using them ?

> Tristan.
yg


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Sat Jul 12 15:12:47 2014

This archive was generated by hypermail 2.1.8 : Sat Jul 12 2014 - 15:13:25 PDT