Re: Generated instance question

From: Tom Fitzpatrick (tfitz@cadence.com)
Date: Wed Apr 14 1999 - 07:55:24 PDT


BAD MSG:
Thanks Adam. That's not what I was hoping to hear, however.
-Lines: 72
Content-Type: text/plain; charset="us-ascii"
Content-Length: 2339
X-Status: $$$$
X-UID: 0000000858
Status: RO

But this does get me thinking a bit. If I use a for loop in a generate
statement, then aren't I actually producing an array of generated
instances? The current proposal doesn't specify how to subscript each
instance explicitly.

The nested example given is:

parameter SIZE = 2;
genvar i, j, k, m;
generate
  for (i=0; i<SIZE+1; i=i+1) begin
    M1 N1(); // instantiates N1[i]
    for (j=0; j<SIZE; j=j+1) begin
      M2 N2(); // instantiates N2[i][j]
      for (k=0; k<SIZE; k=k+1) begin
        M3 N3(); // instantiates N3[i][j][k]
      end
    end
    if (i>0)
      for (m=0; m<SIZE; m=m+1) begin
        M4 N4(); // instantiates N4[i][m]
      end
  end
endgenerate

  // some of the generated instance names are:
  // N1[0]
  // N2[0][0] N2[0][1]
  // N3[0][0][0] N3[0][0][1] N3[0][1][0] N3[0][1][1]
  // N4[1][0] N4[1][1]
  // Note: there are no instance names N1 N2 N3 N4

The only problem with this is that it forces the naming of each instance to
begin with the outermost genvar and proceed inward. If for some reason I
wanted to arrange my instances of M2 to be N2[i][j], but my instances of M3
to be N3[k][j][i], I couldn't do it. It also doesn't make it entirely
intuitive when a generated instance has a subscript and when it doesn't.

I'd like to propose a friendly ammendment to this proposal that will
explicitly require the genvar in the instance name of an instance array.
The above example would then look like this:

parameter SIZE = 2;
genvar i, j, k, m;
generate
  for (i=0; i<SIZE+1; i=i+1) begin
    M1 N1[i](); // instantiates N1[i]
    for (j=0; j<SIZE; j=j+1) begin
      M2 N2[i][j](); // instantiates N2[i][j]
      for (k=0; k<SIZE; k=k+1) begin
        M3 N3[i][j][k](); // instantiates N3[i][j][k]
        M3a N3a[k][j][i](); // Instantiates N3a[k][j][i]
      end
    end
    if (i>0)
      for (m=0; m<SIZE; m=m+1) begin
        M4 N4[i][m](); // instantiates N4[i][m]
      end
  end
endgenerate

<p>Fire away!
-Tom

---------------
Tom Fitzpatrick

Senior Technical Marketing Manager Cadence Design Systems, Inc.
RTL Verification Flow/Product Engineering 270 Billerica Rd.
Design and Verification R&D Chelmsford, MA 01824
x6438 (978)446-6438



This archive was generated by hypermail 2.1.4 : Mon Jul 08 2002 - 12:53:26 PDT and
sponsored by Boyd Technology, Inc.