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

From: Brad Pierce <Brad.Pierce_at_.....>
Date: Sun Feb 26 2006 - 15:29:24 PST
Of course, the function is a 32-to-8 compression, not a mux.

-- Brad

-----Original Message-----
From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of Brad
Pierce
Sent: Sunday, February 26, 2006 3:20 PM
To: sv-bc@eda.org
Subject: Re: [sv-bc] Aggregate / struct - 2 questions

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:29:35 2006

This archive was generated by hypermail 2.1.8 : Sun Feb 26 2006 - 15:30:08 PST