I'm trying to initialize an array of modules, and they each have 3 parameters, 2 of which are based on values that I define in a pair of reg packed arrays at the top of the module like this:

reg[31:0] k [0:63] = '{ 32'hd76aa478, 32'he8c7b756, 32'h242070db, 32'hc1bdceee, 32'hf57c0faf, 32'h4787c62a, 32'ha8304613, 32'hfd469501, 32'h698098d8, 32'h8b44f7af, 32'hffff5bb1, 32'h895cd7be, 32'h6b901122, 32'hfd987193, 32'ha679438e, 32'h49b40821, 32'hf61e2562, 32'hc040b340, 32'h265e5a51, 32'he9b6c7aa, 32'hd62f105d, 32'h02441453, 32'hd8a1e681, 32'he7d3fbc8, 32'h21e1cde6, 32'hc33707d6, 32'hf4d50d87, 32'h455a14ed, 32'ha9e3e905, 32'hfcefa3f8, 32'h676f02d9, 32'h8d2a4c8a, 32'hfffa3942, 32'h8771f681, 32'h6d9d6122, 32'hfde5380c, 32'ha4beea44, 32'h4bdecfa9, 32'hf6bb4b60, 32'hbebfbc70, 32'h289b7ec6, 32'heaa127fa, 32'hd4ef3085, 32'h04881d05, 32'hd9d4d039, 32'he6db99e5, 32'h1fa27cf8, 32'hc4ac5665, 32'hf4292244, 32'h432aff97, 32'hab9423a7, 32'hfc93a039, 32'h655b59c3, 32'h8f0ccc92, 32'hffeff47d, 32'h85845dd1, 32'h6fa87e4f, 32'hfe2ce6e0, 32'ha3014314, 32'h4e0811a1, 32'hf7537e82, 32'hbd3af235, 32'h2ad7d2bb, 32'heb86d391 };

and

reg[4:0] s [0:63] = '{ 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21 };

I'm accessing those values when instantiating the modules like this:

hash_op #(0,s[0],k[0]) hash_op_0( // <- ERROR HERE! .clk(clk), .a(a_initial), .b(b_initial), .c(c_initial), .d(d_initial), .m(message_padded), .a_out(bl_a[1]), .b_out(bl_b[1]), .c_out(bl_c[1]), .d_out(bl_d[1]), .m_out(bl_m[1]) ); generate genvar i; for(i = 1; i<64; i=i+1) begin : generate_hash_ops hash_op #(i,s[i],k[i]) hash_op_i( // <- ERROR HERE! .clk(clk), .a(bl_a[i]), .b(bl_b[i]), .c(bl_c[i]), .d(bl_d[i]), .m(bl_m[i]), .a_out(bl_a[i+1]), .b_out(bl_b[i+1]), .c_out(bl_c[i+1]), .d_out(bl_d[i+1]), .m_out(bl_m[i+1]) ); end endgenerate

but I keep getting this error:

λ iverilog -o test -c file_list.txt md5-core.v:49: error: Unable to bind parameter `k['sd0]' in `md5core' md5-core.v:49: error: Unable to bind parameter `s['sd0]' in `md5core' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[1]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[1]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[2]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[2]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[3]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[3]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[4]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[4]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[5]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[5]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[6]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[6]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[7]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[7]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[8]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[8]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[9]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[9]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[10]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[10]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[11]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[11]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[12]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[12]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[13]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[13]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[14]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[14]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[15]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[15]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[16]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[16]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[17]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[17]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[18]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[18]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[19]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[19]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[20]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[20]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[21]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[21]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[22]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[22]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[23]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[23]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[24]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[24]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[25]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[25]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[26]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[26]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[27]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[27]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[28]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[28]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[29]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[29]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[30]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[30]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[31]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[31]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[32]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[32]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[33]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[33]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[34]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[34]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[35]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[35]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[36]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[36]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[37]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[37]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[38]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[38]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[39]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[39]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[40]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[40]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[41]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[41]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[42]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[42]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[43]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[43]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[44]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[44]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[45]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[45]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[46]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[46]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[47]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[47]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[48]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[48]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[49]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[49]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[50]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[50]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[51]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[51]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[52]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[52]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[53]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[53]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[54]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[54]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[55]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[55]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[56]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[56]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[57]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[57]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[58]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[58]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[59]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[59]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[60]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[60]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[61]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[61]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[62]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[62]' md5-core.v:67: error: Unable to bind parameter `k[i]' in `md5core.generate_hash_ops[63]' md5-core.v:67: error: Unable to bind parameter `s[i]' in `md5core.generate_hash_ops[63]' 128 error(s) during elaboration.

Does anyone have any advice? I might be initializing the arrays wrong, or maybe verilog just doesn't support defining parameters based on array values, but I doubt that. Is there a more resource efficient to define my parameters? I don't ever use the values in these arrays beyond this generate sequence. "k" can be defined by a function instead, which I might use, but s cannot be.