Re: [sv-bc] Aggregate / struct - 2 questions

From: Brad Pierce <Brad.Pierce_at_.....>
Date: Sun Feb 26 2006 - 15:20:13 PST
Cliff,

In my opinion, a clearer way to write the following mux

>   function [7:0] gen_crc (int d);
>     for (int i=0;i<8;i++) gen_crc[i]=^d[(i*4)+:4];
>   endfunction

is to use a packed MDA, e.g.,

    function [7:0] gen_crc (bit [7:0] [3:0] d);
      for (int i=0;i<8;i++) gen_crc[i] = ^d[i];
    endfunction

or

    function [7:0] gen_crc (bit [7:0] [3:0] d);
      foreach (gen_crc[i]) gen_crc[i] = ^d[i];
    endfunction

-- Brad
Received on Sun Feb 26 15:20:26 2006

This archive was generated by hypermail 2.1.8 : Sun Feb 26 2006 - 15:22:33 PST