Generate and hierarchical references

From: Adam Krolnik (adamk@cyrix.com)
Date: Tue Dec 02 1997 - 03:11:27 PST


Good afternoon:

Here is an example I tried to explain at the meeting today. It seems that
this is currently not possible. Could we describe alternate ways of implementing this with the current definition? This way just seemed to be
the straightforward one.

   Adam Krolnik
   Verification Engineer
   Cyrix - ...
   Richardson TX. 75085

<p>// This is a dimm (a dual inline memory module [like a simm])
// They can be composed of different numbers of physical memory chips
// that have a different number of data bit ports and a different
// number of address bit ports. Depending on the type we should
// instantiate and connect them in different ways. We would like
// it to be parameterizable such that one could instantiate it and
// specify the configuration. Or one could defparam a new configuration.

module dimm;
  parameter dimm_type = "sms_16b208";
  //The simple example only defines a dimm_type. We could also
  // parameterize the data width and then consequently the number
  // of instances depends on the type and the memory width.
  input [12:0] ad;
  input ras, cas, we; // Simple controls for the memory.
  inout [63:0] data;
  
  // Instantiate the memories (8 for 16b208 and 4 for 16b216
  // Wait, we will later add a type of (2 for 16b232)
  generate
    case (dimm_type)
      "sms_16b208":
        for(i0 = 0; i0<8;i0 = i0 + 1)
          sms_16b208 m[i0](.ad(ad), .ras(ras), .cas(cas), .we(we),
                           .data(data[7+8*i0:8*i0]);
      "sms_16b216":
        for(i0 = 0; i0<4;i0 = i0 + 1)
          sms_16b216 m[i0](.ad(ad), .ras(ras), .cas(cas), .we(we),
                           .data(data[15+16*i0:16*i0]);
     endcase
  endgenerate

  task read_dimm;
    input[31:0] address;
    output[63:0] data;
    reg[31:0] phys_addr;
    begin
    phys_addr = fn(address);
    // Need way to specify this code if you are going to let me generate
    // the code above.
    generate
      case (dimm_type)
        "sms_16b208":
          for(i0 = 0;i0<8;i0 = i0 + 1)
            m[i0].read_dimm(phys_addr, data[7+8*i0:8*i0]);
        "sms_16b216":
          for(i0 = 0; i0<4;i0 = i0 + 1)
            m[i0].read_dimm(phys_addr, data[15+16*i0:16*i0]);
      endcase
    endgenerate
    end
  endtask

endmodule



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