Re: [vhdl-200x] Modular types

From: <>
Date: Thu Jul 10 2014 - 16:23:57 PDT

Le 2014-07-11 01:01, Brent Hayhoe a écrit :
> On 09/07/2014 21:08, wrote:
>> So, beyond the obvious case of binary numbers,
>> why are we spending time on other bases, since they
>> don't bring speed or ease advantages ?
>> CPUs support booleans mod 2^(2^n)) but not mod n^m...
> I mentioned earlier in these threads that my most obvious use would be
> in defining counters in RTL.
> Now the synthesis engine will generate a 2**n bit counter but that
> does not mean that it it is a 0 to 2**n-1 count.
> For instance, in telecommunication applications I may want to count
> octets in an ATM container, a modulo 48 count.

I'm still lost.

So far I haven't seen a practical case that requires a specific
non-binary "modular" language construct.

  * VHDL borrows ranges from Ada so you can tell your software :
     variable counter : integer range 0 to 47; -- or something like that
    the simulator and the synthesizer will know that 16 codes out of the
    64 will wrap around to 0.

  * In case you don't trust your system, you can write your counter like 
this :

    if counter >= 47 then
      counter := 0;
      counter := counter + 1;
    end if;

Most mature VHDL software will recognise these constructs and infer the
proper circuit, as far as I know.

What does a modular construct brings that the "range" does not ?

> Regards,

> Brent.

This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Jul 10 16:24:34 2014

This archive was generated by hypermail 2.1.8 : Thu Jul 10 2014 - 16:24:49 PDT