[prim] Make SECDED prim generation deterministic

There's no need for this to be parameterised by some seed and we're
going to need to build software with the right ECC constants (for ROM
image generation), so let's just pick a golden seed.

Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
diff --git a/hw/ip/prim/rtl/prim_secded_22_16_dec.sv b/hw/ip/prim/rtl/prim_secded_22_16_dec.sv
index 901ca4a..2dce2ac 100644
--- a/hw/ip/prim/rtl/prim_secded_22_16_dec.sv
+++ b/hw/ip/prim/rtl/prim_secded_22_16_dec.sv
@@ -2,8 +2,7 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 //
-// SECDED Decoder generated by
-// util/design/secded_gen.py -m 6 -k 16 -s 1592631616 -c hsiao
+// SECDED decoder generated by util/design/secded_gen.py
 
 module prim_secded_22_16_dec (
   input        [21:0] in,
@@ -15,30 +14,30 @@
   logic single_error;
 
   // Syndrome calculation
-  assign syndrome_o[0] = ^(in & 22'h019F41);
-  assign syndrome_o[1] = ^(in & 22'h027A34);
-  assign syndrome_o[2] = ^(in & 22'h0429CD);
-  assign syndrome_o[3] = ^(in & 22'h08C0AF);
-  assign syndrome_o[4] = ^(in & 22'h1074D2);
-  assign syndrome_o[5] = ^(in & 22'h20873A);
+  assign syndrome_o[0] = ^(in & 22'h01496E);
+  assign syndrome_o[1] = ^(in & 22'h02F20B);
+  assign syndrome_o[2] = ^(in & 22'h048ED8);
+  assign syndrome_o[3] = ^(in & 22'h087714);
+  assign syndrome_o[4] = ^(in & 22'h10ACA5);
+  assign syndrome_o[5] = ^(in & 22'h2011F3);
 
   // Corrected output calculation
-  assign d_o[0] = (syndrome_o == 6'hd) ^ in[0];
-  assign d_o[1] = (syndrome_o == 6'h38) ^ in[1];
-  assign d_o[2] = (syndrome_o == 6'he) ^ in[2];
-  assign d_o[3] = (syndrome_o == 6'h2c) ^ in[3];
-  assign d_o[4] = (syndrome_o == 6'h32) ^ in[4];
-  assign d_o[5] = (syndrome_o == 6'h2a) ^ in[5];
-  assign d_o[6] = (syndrome_o == 6'h15) ^ in[6];
-  assign d_o[7] = (syndrome_o == 6'h1c) ^ in[7];
-  assign d_o[8] = (syndrome_o == 6'h25) ^ in[8];
-  assign d_o[9] = (syndrome_o == 6'h23) ^ in[9];
-  assign d_o[10] = (syndrome_o == 6'h31) ^ in[10];
-  assign d_o[11] = (syndrome_o == 6'h7) ^ in[11];
-  assign d_o[12] = (syndrome_o == 6'h13) ^ in[12];
-  assign d_o[13] = (syndrome_o == 6'h16) ^ in[13];
-  assign d_o[14] = (syndrome_o == 6'h1a) ^ in[14];
-  assign d_o[15] = (syndrome_o == 6'h29) ^ in[15];
+  assign d_o[0] = (syndrome_o == 6'h32) ^ in[0];
+  assign d_o[1] = (syndrome_o == 6'h23) ^ in[1];
+  assign d_o[2] = (syndrome_o == 6'h19) ^ in[2];
+  assign d_o[3] = (syndrome_o == 6'h7) ^ in[3];
+  assign d_o[4] = (syndrome_o == 6'h2c) ^ in[4];
+  assign d_o[5] = (syndrome_o == 6'h31) ^ in[5];
+  assign d_o[6] = (syndrome_o == 6'h25) ^ in[6];
+  assign d_o[7] = (syndrome_o == 6'h34) ^ in[7];
+  assign d_o[8] = (syndrome_o == 6'h29) ^ in[8];
+  assign d_o[9] = (syndrome_o == 6'he) ^ in[9];
+  assign d_o[10] = (syndrome_o == 6'h1c) ^ in[10];
+  assign d_o[11] = (syndrome_o == 6'h15) ^ in[11];
+  assign d_o[12] = (syndrome_o == 6'h2a) ^ in[12];
+  assign d_o[13] = (syndrome_o == 6'h1a) ^ in[13];
+  assign d_o[14] = (syndrome_o == 6'hb) ^ in[14];
+  assign d_o[15] = (syndrome_o == 6'h16) ^ in[15];
 
   // err_o calc. bit0: single error, bit1: double error
   assign single_error = ^syndrome_o;
diff --git a/hw/ip/prim/rtl/prim_secded_22_16_enc.sv b/hw/ip/prim/rtl/prim_secded_22_16_enc.sv
index b72534e..7a058a3 100644
--- a/hw/ip/prim/rtl/prim_secded_22_16_enc.sv
+++ b/hw/ip/prim/rtl/prim_secded_22_16_enc.sv
@@ -2,8 +2,7 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 //
-// SECDED Encoder generated by
-// util/design/secded_gen.py -m 6 -k 16 -s 1592631616 -c hsiao
+// SECDED encoder generated by util/design/secded_gen.py
 
 module prim_secded_22_16_enc (
   input        [15:0] in,
@@ -12,12 +11,12 @@
 
   always_comb begin : p_encode
     out = 22'(in);
-    out[16] = ^(out & 22'h009F41);
-    out[17] = ^(out & 22'h007A34);
-    out[18] = ^(out & 22'h0029CD);
-    out[19] = ^(out & 22'h00C0AF);
-    out[20] = ^(out & 22'h0074D2);
-    out[21] = ^(out & 22'h00873A);
+    out[16] = ^(out & 22'h00496E);
+    out[17] = ^(out & 22'h00F20B);
+    out[18] = ^(out & 22'h008ED8);
+    out[19] = ^(out & 22'h007714);
+    out[20] = ^(out & 22'h00ACA5);
+    out[21] = ^(out & 22'h0011F3);
   end
 
 endmodule : prim_secded_22_16_enc
diff --git a/hw/ip/prim/rtl/prim_secded_28_22_dec.sv b/hw/ip/prim/rtl/prim_secded_28_22_dec.sv
index 4198d69..6614033 100644
--- a/hw/ip/prim/rtl/prim_secded_28_22_dec.sv
+++ b/hw/ip/prim/rtl/prim_secded_28_22_dec.sv
@@ -2,8 +2,7 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 //
-// SECDED Decoder generated by
-// util/design/secded_gen.py -m 6 -k 22 -s 1592631616 -c hsiao
+// SECDED decoder generated by util/design/secded_gen.py
 
 module prim_secded_28_22_dec (
   input        [27:0] in,
@@ -17,10 +16,10 @@
   // Syndrome calculation
   assign syndrome_o[0] = ^(in & 28'h07003FF);
   assign syndrome_o[1] = ^(in & 28'h090FC0F);
-  assign syndrome_o[2] = ^(in & 28'h1371C71);
+  assign syndrome_o[2] = ^(in & 28'h1271C71);
   assign syndrome_o[3] = ^(in & 28'h23B6592);
   assign syndrome_o[4] = ^(in & 28'h43DAAA4);
-  assign syndrome_o[5] = ^(in & 28'h82ED348);
+  assign syndrome_o[5] = ^(in & 28'h83ED348);
 
   // Corrected output calculation
   assign d_o[0] = (syndrome_o == 6'h7) ^ in[0];
@@ -43,7 +42,7 @@
   assign d_o[17] = (syndrome_o == 6'h2c) ^ in[17];
   assign d_o[18] = (syndrome_o == 6'h34) ^ in[18];
   assign d_o[19] = (syndrome_o == 6'h38) ^ in[19];
-  assign d_o[20] = (syndrome_o == 6'h1f) ^ in[20];
+  assign d_o[20] = (syndrome_o == 6'h3b) ^ in[20];
   assign d_o[21] = (syndrome_o == 6'h3d) ^ in[21];
 
   // err_o calc. bit0: single error, bit1: double error
diff --git a/hw/ip/prim/rtl/prim_secded_28_22_enc.sv b/hw/ip/prim/rtl/prim_secded_28_22_enc.sv
index 58e11f8..0f47b64 100644
--- a/hw/ip/prim/rtl/prim_secded_28_22_enc.sv
+++ b/hw/ip/prim/rtl/prim_secded_28_22_enc.sv
@@ -2,8 +2,7 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 //
-// SECDED Encoder generated by
-// util/design/secded_gen.py -m 6 -k 22 -s 1592631616 -c hsiao
+// SECDED encoder generated by util/design/secded_gen.py
 
 module prim_secded_28_22_enc (
   input        [21:0] in,
@@ -14,10 +13,10 @@
     out = 28'(in);
     out[22] = ^(out & 28'h03003FF);
     out[23] = ^(out & 28'h010FC0F);
-    out[24] = ^(out & 28'h0371C71);
+    out[24] = ^(out & 28'h0271C71);
     out[25] = ^(out & 28'h03B6592);
     out[26] = ^(out & 28'h03DAAA4);
-    out[27] = ^(out & 28'h02ED348);
+    out[27] = ^(out & 28'h03ED348);
   end
 
 endmodule : prim_secded_28_22_enc
diff --git a/hw/ip/prim/rtl/prim_secded_39_32_dec.sv b/hw/ip/prim/rtl/prim_secded_39_32_dec.sv
index 18371d2..e31cc97 100644
--- a/hw/ip/prim/rtl/prim_secded_39_32_dec.sv
+++ b/hw/ip/prim/rtl/prim_secded_39_32_dec.sv
@@ -2,8 +2,7 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 //
-// SECDED Decoder generated by
-// util/design/secded_gen.py -m 7 -k 32 -s 1592631616 -c hsiao
+// SECDED decoder generated by util/design/secded_gen.py
 
 module prim_secded_39_32_dec (
   input        [38:0] in,
@@ -15,47 +14,47 @@
   logic single_error;
 
   // Syndrome calculation
-  assign syndrome_o[0] = ^(in & 39'h01850E56A2);
-  assign syndrome_o[1] = ^(in & 39'h022E534C61);
-  assign syndrome_o[2] = ^(in & 39'h040901A9FE);
-  assign syndrome_o[3] = ^(in & 39'h087079A702);
-  assign syndrome_o[4] = ^(in & 39'h10CABA900D);
-  assign syndrome_o[5] = ^(in & 39'h20D3C44B18);
-  assign syndrome_o[6] = ^(in & 39'h4034A430D5);
+  assign syndrome_o[0] = ^(in & 39'h012606BD25);
+  assign syndrome_o[1] = ^(in & 39'h02DEBA8050);
+  assign syndrome_o[2] = ^(in & 39'h04413D89AA);
+  assign syndrome_o[3] = ^(in & 39'h0831234ED1);
+  assign syndrome_o[4] = ^(in & 39'h10C2C1323B);
+  assign syndrome_o[5] = ^(in & 39'h202DCC624C);
+  assign syndrome_o[6] = ^(in & 39'h4098505586);
 
   // Corrected output calculation
-  assign d_o[0] = (syndrome_o == 7'h52) ^ in[0];
-  assign d_o[1] = (syndrome_o == 7'hd) ^ in[1];
-  assign d_o[2] = (syndrome_o == 7'h54) ^ in[2];
+  assign d_o[0] = (syndrome_o == 7'h19) ^ in[0];
+  assign d_o[1] = (syndrome_o == 7'h54) ^ in[1];
+  assign d_o[2] = (syndrome_o == 7'h61) ^ in[2];
   assign d_o[3] = (syndrome_o == 7'h34) ^ in[3];
-  assign d_o[4] = (syndrome_o == 7'h64) ^ in[4];
-  assign d_o[5] = (syndrome_o == 7'h7) ^ in[5];
-  assign d_o[6] = (syndrome_o == 7'h46) ^ in[6];
-  assign d_o[7] = (syndrome_o == 7'h45) ^ in[7];
-  assign d_o[8] = (syndrome_o == 7'h2c) ^ in[8];
-  assign d_o[9] = (syndrome_o == 7'h29) ^ in[9];
-  assign d_o[10] = (syndrome_o == 7'hb) ^ in[10];
-  assign d_o[11] = (syndrome_o == 7'h26) ^ in[11];
+  assign d_o[4] = (syndrome_o == 7'h1a) ^ in[4];
+  assign d_o[5] = (syndrome_o == 7'h15) ^ in[5];
+  assign d_o[6] = (syndrome_o == 7'h2a) ^ in[6];
+  assign d_o[7] = (syndrome_o == 7'h4c) ^ in[7];
+  assign d_o[8] = (syndrome_o == 7'h45) ^ in[8];
+  assign d_o[9] = (syndrome_o == 7'h38) ^ in[9];
+  assign d_o[10] = (syndrome_o == 7'h49) ^ in[10];
+  assign d_o[11] = (syndrome_o == 7'hd) ^ in[11];
   assign d_o[12] = (syndrome_o == 7'h51) ^ in[12];
-  assign d_o[13] = (syndrome_o == 7'h4c) ^ in[13];
-  assign d_o[14] = (syndrome_o == 7'h23) ^ in[14];
-  assign d_o[15] = (syndrome_o == 7'h1c) ^ in[15];
-  assign d_o[16] = (syndrome_o == 7'he) ^ in[16];
-  assign d_o[17] = (syndrome_o == 7'h13) ^ in[17];
-  assign d_o[18] = (syndrome_o == 7'h61) ^ in[18];
-  assign d_o[19] = (syndrome_o == 7'h19) ^ in[19];
-  assign d_o[20] = (syndrome_o == 7'h1a) ^ in[20];
-  assign d_o[21] = (syndrome_o == 7'h58) ^ in[21];
-  assign d_o[22] = (syndrome_o == 7'h2a) ^ in[22];
-  assign d_o[23] = (syndrome_o == 7'h70) ^ in[23];
-  assign d_o[24] = (syndrome_o == 7'h25) ^ in[24];
-  assign d_o[25] = (syndrome_o == 7'h32) ^ in[25];
-  assign d_o[26] = (syndrome_o == 7'h43) ^ in[26];
-  assign d_o[27] = (syndrome_o == 7'h16) ^ in[27];
-  assign d_o[28] = (syndrome_o == 7'h68) ^ in[28];
-  assign d_o[29] = (syndrome_o == 7'h4a) ^ in[29];
-  assign d_o[30] = (syndrome_o == 7'h38) ^ in[30];
-  assign d_o[31] = (syndrome_o == 7'h31) ^ in[31];
+  assign d_o[13] = (syndrome_o == 7'h31) ^ in[13];
+  assign d_o[14] = (syndrome_o == 7'h68) ^ in[14];
+  assign d_o[15] = (syndrome_o == 7'h7) ^ in[15];
+  assign d_o[16] = (syndrome_o == 7'h1c) ^ in[16];
+  assign d_o[17] = (syndrome_o == 7'hb) ^ in[17];
+  assign d_o[18] = (syndrome_o == 7'h25) ^ in[18];
+  assign d_o[19] = (syndrome_o == 7'h26) ^ in[19];
+  assign d_o[20] = (syndrome_o == 7'h46) ^ in[20];
+  assign d_o[21] = (syndrome_o == 7'he) ^ in[21];
+  assign d_o[22] = (syndrome_o == 7'h70) ^ in[22];
+  assign d_o[23] = (syndrome_o == 7'h32) ^ in[23];
+  assign d_o[24] = (syndrome_o == 7'h2c) ^ in[24];
+  assign d_o[25] = (syndrome_o == 7'h13) ^ in[25];
+  assign d_o[26] = (syndrome_o == 7'h23) ^ in[26];
+  assign d_o[27] = (syndrome_o == 7'h62) ^ in[27];
+  assign d_o[28] = (syndrome_o == 7'h4a) ^ in[28];
+  assign d_o[29] = (syndrome_o == 7'h29) ^ in[29];
+  assign d_o[30] = (syndrome_o == 7'h16) ^ in[30];
+  assign d_o[31] = (syndrome_o == 7'h52) ^ in[31];
 
   // err_o calc. bit0: single error, bit1: double error
   assign single_error = ^syndrome_o;
diff --git a/hw/ip/prim/rtl/prim_secded_39_32_enc.sv b/hw/ip/prim/rtl/prim_secded_39_32_enc.sv
index b8ac367..67f270d 100644
--- a/hw/ip/prim/rtl/prim_secded_39_32_enc.sv
+++ b/hw/ip/prim/rtl/prim_secded_39_32_enc.sv
@@ -2,8 +2,7 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 //
-// SECDED Encoder generated by
-// util/design/secded_gen.py -m 7 -k 32 -s 1592631616 -c hsiao
+// SECDED encoder generated by util/design/secded_gen.py
 
 module prim_secded_39_32_enc (
   input        [31:0] in,
@@ -12,13 +11,13 @@
 
   always_comb begin : p_encode
     out = 39'(in);
-    out[32] = ^(out & 39'h00850E56A2);
-    out[33] = ^(out & 39'h002E534C61);
-    out[34] = ^(out & 39'h000901A9FE);
-    out[35] = ^(out & 39'h007079A702);
-    out[36] = ^(out & 39'h00CABA900D);
-    out[37] = ^(out & 39'h00D3C44B18);
-    out[38] = ^(out & 39'h0034A430D5);
+    out[32] = ^(out & 39'h002606BD25);
+    out[33] = ^(out & 39'h00DEBA8050);
+    out[34] = ^(out & 39'h00413D89AA);
+    out[35] = ^(out & 39'h0031234ED1);
+    out[36] = ^(out & 39'h00C2C1323B);
+    out[37] = ^(out & 39'h002DCC624C);
+    out[38] = ^(out & 39'h0098505586);
   end
 
 endmodule : prim_secded_39_32_enc
diff --git a/hw/ip/prim/rtl/prim_secded_64_57_dec.sv b/hw/ip/prim/rtl/prim_secded_64_57_dec.sv
index 43b3e39..61dfa5e 100644
--- a/hw/ip/prim/rtl/prim_secded_64_57_dec.sv
+++ b/hw/ip/prim/rtl/prim_secded_64_57_dec.sv
@@ -2,8 +2,7 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 //
-// SECDED Decoder generated by
-// util/design/secded_gen.py -m 7 -k 57 -s 1592631616 -c hsiao
+// SECDED decoder generated by util/design/secded_gen.py
 
 module prim_secded_64_57_dec (
   input        [63:0] in,
diff --git a/hw/ip/prim/rtl/prim_secded_64_57_enc.sv b/hw/ip/prim/rtl/prim_secded_64_57_enc.sv
index e1ca422..bf56b15 100644
--- a/hw/ip/prim/rtl/prim_secded_64_57_enc.sv
+++ b/hw/ip/prim/rtl/prim_secded_64_57_enc.sv
@@ -2,8 +2,7 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 //
-// SECDED Encoder generated by
-// util/design/secded_gen.py -m 7 -k 57 -s 1592631616 -c hsiao
+// SECDED encoder generated by util/design/secded_gen.py
 
 module prim_secded_64_57_enc (
   input        [56:0] in,
diff --git a/hw/ip/prim/rtl/prim_secded_72_64_dec.sv b/hw/ip/prim/rtl/prim_secded_72_64_dec.sv
index bfda545..0b7e7b8 100644
--- a/hw/ip/prim/rtl/prim_secded_72_64_dec.sv
+++ b/hw/ip/prim/rtl/prim_secded_72_64_dec.sv
@@ -2,8 +2,7 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 //
-// SECDED Decoder generated by
-// util/design/secded_gen.py -m 8 -k 64 -s 1592631616 -c hsiao
+// SECDED decoder generated by util/design/secded_gen.py
 
 module prim_secded_72_64_dec (
   input        [71:0] in,
@@ -15,14 +14,14 @@
   logic single_error;
 
   // Syndrome calculation
-  assign syndrome_o[0] = ^(in & 72'h019D000000001FFFFF);
-  assign syndrome_o[1] = ^(in & 72'h027600000FFFE0003F);
-  assign syndrome_o[2] = ^(in & 72'h0479003FF003E007C1);
-  assign syndrome_o[3] = ^(in & 72'h08A70FC0F03C207842);
-  assign syndrome_o[4] = ^(in & 72'h10D371C711C4438884);
-  assign syndrome_o[5] = ^(in & 72'h20F8B65926488C9108);
-  assign syndrome_o[6] = ^(in & 72'h40AEDAAA4A91152210);
-  assign syndrome_o[7] = ^(in & 72'h804FED348D221A4420);
+  assign syndrome_o[0] = ^(in & 72'h01B9000000001FFFFF);
+  assign syndrome_o[1] = ^(in & 72'h025E00000FFFE0003F);
+  assign syndrome_o[2] = ^(in & 72'h0467003FF003E007C1);
+  assign syndrome_o[3] = ^(in & 72'h08CD0FC0F03C207842);
+  assign syndrome_o[4] = ^(in & 72'h10B671C711C4438884);
+  assign syndrome_o[5] = ^(in & 72'h20B5B65926488C9108);
+  assign syndrome_o[6] = ^(in & 72'h40CBDAAA4A91152210);
+  assign syndrome_o[7] = ^(in & 72'h807AED348D221A4420);
 
   // Corrected output calculation
   assign d_o[0] = (syndrome_o == 8'h7) ^ in[0];
@@ -81,13 +80,13 @@
   assign d_o[53] = (syndrome_o == 8'hb0) ^ in[53];
   assign d_o[54] = (syndrome_o == 8'hd0) ^ in[54];
   assign d_o[55] = (syndrome_o == 8'he0) ^ in[55];
-  assign d_o[56] = (syndrome_o == 8'h9d) ^ in[56];
-  assign d_o[57] = (syndrome_o == 8'hda) ^ in[57];
-  assign d_o[58] = (syndrome_o == 8'hcb) ^ in[58];
-  assign d_o[59] = (syndrome_o == 8'he5) ^ in[59];
-  assign d_o[60] = (syndrome_o == 8'h37) ^ in[60];
-  assign d_o[61] = (syndrome_o == 8'h6e) ^ in[61];
-  assign d_o[62] = (syndrome_o == 8'hb6) ^ in[62];
+  assign d_o[56] = (syndrome_o == 8'h6d) ^ in[56];
+  assign d_o[57] = (syndrome_o == 8'hd6) ^ in[57];
+  assign d_o[58] = (syndrome_o == 8'h3e) ^ in[58];
+  assign d_o[59] = (syndrome_o == 8'hcb) ^ in[59];
+  assign d_o[60] = (syndrome_o == 8'hb3) ^ in[60];
+  assign d_o[61] = (syndrome_o == 8'hb5) ^ in[61];
+  assign d_o[62] = (syndrome_o == 8'hce) ^ in[62];
   assign d_o[63] = (syndrome_o == 8'h79) ^ in[63];
 
   // err_o calc. bit0: single error, bit1: double error
diff --git a/hw/ip/prim/rtl/prim_secded_72_64_enc.sv b/hw/ip/prim/rtl/prim_secded_72_64_enc.sv
index 5016575..cd0cec1 100644
--- a/hw/ip/prim/rtl/prim_secded_72_64_enc.sv
+++ b/hw/ip/prim/rtl/prim_secded_72_64_enc.sv
@@ -2,8 +2,7 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 //
-// SECDED Encoder generated by
-// util/design/secded_gen.py -m 8 -k 64 -s 1592631616 -c hsiao
+// SECDED encoder generated by util/design/secded_gen.py
 
 module prim_secded_72_64_enc (
   input        [63:0] in,
@@ -12,14 +11,14 @@
 
   always_comb begin : p_encode
     out = 72'(in);
-    out[64] = ^(out & 72'h009D000000001FFFFF);
-    out[65] = ^(out & 72'h007600000FFFE0003F);
-    out[66] = ^(out & 72'h0079003FF003E007C1);
-    out[67] = ^(out & 72'h00A70FC0F03C207842);
-    out[68] = ^(out & 72'h00D371C711C4438884);
-    out[69] = ^(out & 72'h00F8B65926488C9108);
-    out[70] = ^(out & 72'h00AEDAAA4A91152210);
-    out[71] = ^(out & 72'h004FED348D221A4420);
+    out[64] = ^(out & 72'h00B9000000001FFFFF);
+    out[65] = ^(out & 72'h005E00000FFFE0003F);
+    out[66] = ^(out & 72'h0067003FF003E007C1);
+    out[67] = ^(out & 72'h00CD0FC0F03C207842);
+    out[68] = ^(out & 72'h00B671C711C4438884);
+    out[69] = ^(out & 72'h00B5B65926488C9108);
+    out[70] = ^(out & 72'h00CBDAAA4A91152210);
+    out[71] = ^(out & 72'h007AED348D221A4420);
   end
 
 endmodule : prim_secded_72_64_enc
diff --git a/hw/ip/prim/rtl/prim_secded_hamming_22_16_dec.sv b/hw/ip/prim/rtl/prim_secded_hamming_22_16_dec.sv
index 34ce95c..40d697f 100644
--- a/hw/ip/prim/rtl/prim_secded_hamming_22_16_dec.sv
+++ b/hw/ip/prim/rtl/prim_secded_hamming_22_16_dec.sv
@@ -2,8 +2,7 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 //
-// SECDED Decoder generated by
-// util/design/secded_gen.py -m 6 -k 16 -s 1592631616 -c hamming
+// SECDED decoder generated by util/design/secded_gen.py
 
 module prim_secded_hamming_22_16_dec (
   input        [21:0] in,
diff --git a/hw/ip/prim/rtl/prim_secded_hamming_22_16_enc.sv b/hw/ip/prim/rtl/prim_secded_hamming_22_16_enc.sv
index fd01413..5b0f7df 100644
--- a/hw/ip/prim/rtl/prim_secded_hamming_22_16_enc.sv
+++ b/hw/ip/prim/rtl/prim_secded_hamming_22_16_enc.sv
@@ -2,8 +2,7 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 //
-// SECDED Encoder generated by
-// util/design/secded_gen.py -m 6 -k 16 -s 1592631616 -c hamming
+// SECDED encoder generated by util/design/secded_gen.py
 
 module prim_secded_hamming_22_16_enc (
   input        [15:0] in,
diff --git a/hw/ip/prim/rtl/prim_secded_hamming_39_32_dec.sv b/hw/ip/prim/rtl/prim_secded_hamming_39_32_dec.sv
index 9bcd7de..5410ce7 100644
--- a/hw/ip/prim/rtl/prim_secded_hamming_39_32_dec.sv
+++ b/hw/ip/prim/rtl/prim_secded_hamming_39_32_dec.sv
@@ -2,8 +2,7 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 //
-// SECDED Decoder generated by
-// util/design/secded_gen.py -m 7 -k 32 -s 1592631616 -c hamming
+// SECDED decoder generated by util/design/secded_gen.py
 
 module prim_secded_hamming_39_32_dec (
   input        [38:0] in,
diff --git a/hw/ip/prim/rtl/prim_secded_hamming_39_32_enc.sv b/hw/ip/prim/rtl/prim_secded_hamming_39_32_enc.sv
index 222e31d..d1906da 100644
--- a/hw/ip/prim/rtl/prim_secded_hamming_39_32_enc.sv
+++ b/hw/ip/prim/rtl/prim_secded_hamming_39_32_enc.sv
@@ -2,8 +2,7 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 //
-// SECDED Encoder generated by
-// util/design/secded_gen.py -m 7 -k 32 -s 1592631616 -c hamming
+// SECDED encoder generated by util/design/secded_gen.py
 
 module prim_secded_hamming_39_32_enc (
   input        [31:0] in,
diff --git a/hw/ip/prim/rtl/prim_secded_hamming_72_64_dec.sv b/hw/ip/prim/rtl/prim_secded_hamming_72_64_dec.sv
index e25de52..f219228 100644
--- a/hw/ip/prim/rtl/prim_secded_hamming_72_64_dec.sv
+++ b/hw/ip/prim/rtl/prim_secded_hamming_72_64_dec.sv
@@ -2,8 +2,7 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 //
-// SECDED Decoder generated by
-// util/design/secded_gen.py -m 8 -k 64 -s 1592631616 -c hamming
+// SECDED decoder generated by util/design/secded_gen.py
 
 module prim_secded_hamming_72_64_dec (
   input        [71:0] in,
diff --git a/hw/ip/prim/rtl/prim_secded_hamming_72_64_enc.sv b/hw/ip/prim/rtl/prim_secded_hamming_72_64_enc.sv
index 1fd06dd..8d8d381 100644
--- a/hw/ip/prim/rtl/prim_secded_hamming_72_64_enc.sv
+++ b/hw/ip/prim/rtl/prim_secded_hamming_72_64_enc.sv
@@ -2,8 +2,7 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 //
-// SECDED Encoder generated by
-// util/design/secded_gen.py -m 8 -k 64 -s 1592631616 -c hamming
+// SECDED encoder generated by util/design/secded_gen.py
 
 module prim_secded_hamming_72_64_enc (
   input        [63:0] in,
diff --git a/hw/ip/prim/rtl/prim_secded_pkg.sv b/hw/ip/prim/rtl/prim_secded_pkg.sv
index e14374b..ad93020 100644
--- a/hw/ip/prim/rtl/prim_secded_pkg.sv
+++ b/hw/ip/prim/rtl/prim_secded_pkg.sv
@@ -2,8 +2,8 @@
 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
 // SPDX-License-Identifier: Apache-2.0
 //
-// SECDED Encoder generated by
-// util/design/secded_gen.py -s 1592631616 from util/design/data/secded_cfg.hjson
+// SECDED package generated by
+// util/design/secded_gen.py from util/design/data/secded_cfg.hjson
 
 package prim_secded_pkg;
 
@@ -58,12 +58,12 @@
   function automatic logic [21:0] prim_secded_22_16_enc (logic [15:0] in);
     logic [21:0] out;
     out = 22'(in);
-    out[16] = ^(out & 22'h009F41);
-    out[17] = ^(out & 22'h007A34);
-    out[18] = ^(out & 22'h0029CD);
-    out[19] = ^(out & 22'h00C0AF);
-    out[20] = ^(out & 22'h0074D2);
-    out[21] = ^(out & 22'h00873A);
+    out[16] = ^(out & 22'h00496E);
+    out[17] = ^(out & 22'h00F20B);
+    out[18] = ^(out & 22'h008ED8);
+    out[19] = ^(out & 22'h007714);
+    out[20] = ^(out & 22'h00ACA5);
+    out[21] = ^(out & 22'h0011F3);
     return out;
   endfunction
 
@@ -77,30 +77,30 @@
     logic single_error;
 
     // Syndrome calculation
-    syndrome_o[0] = ^(in & 22'h019F41);
-    syndrome_o[1] = ^(in & 22'h027A34);
-    syndrome_o[2] = ^(in & 22'h0429CD);
-    syndrome_o[3] = ^(in & 22'h08C0AF);
-    syndrome_o[4] = ^(in & 22'h1074D2);
-    syndrome_o[5] = ^(in & 22'h20873A);
+    syndrome_o[0] = ^(in & 22'h01496E);
+    syndrome_o[1] = ^(in & 22'h02F20B);
+    syndrome_o[2] = ^(in & 22'h048ED8);
+    syndrome_o[3] = ^(in & 22'h087714);
+    syndrome_o[4] = ^(in & 22'h10ACA5);
+    syndrome_o[5] = ^(in & 22'h2011F3);
 
     // Corrected output calculation
-    d_o[0] = (syndrome_o == 6'hd) ^ in[0];
-    d_o[1] = (syndrome_o == 6'h38) ^ in[1];
-    d_o[2] = (syndrome_o == 6'he) ^ in[2];
-    d_o[3] = (syndrome_o == 6'h2c) ^ in[3];
-    d_o[4] = (syndrome_o == 6'h32) ^ in[4];
-    d_o[5] = (syndrome_o == 6'h2a) ^ in[5];
-    d_o[6] = (syndrome_o == 6'h15) ^ in[6];
-    d_o[7] = (syndrome_o == 6'h1c) ^ in[7];
-    d_o[8] = (syndrome_o == 6'h25) ^ in[8];
-    d_o[9] = (syndrome_o == 6'h23) ^ in[9];
-    d_o[10] = (syndrome_o == 6'h31) ^ in[10];
-    d_o[11] = (syndrome_o == 6'h7) ^ in[11];
-    d_o[12] = (syndrome_o == 6'h13) ^ in[12];
-    d_o[13] = (syndrome_o == 6'h16) ^ in[13];
-    d_o[14] = (syndrome_o == 6'h1a) ^ in[14];
-    d_o[15] = (syndrome_o == 6'h29) ^ in[15];
+    d_o[0] = (syndrome_o == 6'h32) ^ in[0];
+    d_o[1] = (syndrome_o == 6'h23) ^ in[1];
+    d_o[2] = (syndrome_o == 6'h19) ^ in[2];
+    d_o[3] = (syndrome_o == 6'h7) ^ in[3];
+    d_o[4] = (syndrome_o == 6'h2c) ^ in[4];
+    d_o[5] = (syndrome_o == 6'h31) ^ in[5];
+    d_o[6] = (syndrome_o == 6'h25) ^ in[6];
+    d_o[7] = (syndrome_o == 6'h34) ^ in[7];
+    d_o[8] = (syndrome_o == 6'h29) ^ in[8];
+    d_o[9] = (syndrome_o == 6'he) ^ in[9];
+    d_o[10] = (syndrome_o == 6'h1c) ^ in[10];
+    d_o[11] = (syndrome_o == 6'h15) ^ in[11];
+    d_o[12] = (syndrome_o == 6'h2a) ^ in[12];
+    d_o[13] = (syndrome_o == 6'h1a) ^ in[13];
+    d_o[14] = (syndrome_o == 6'hb) ^ in[14];
+    d_o[15] = (syndrome_o == 6'h16) ^ in[15];
 
     // err_o calc. bit0: single error, bit1: double error
     single_error = ^syndrome_o;
@@ -119,10 +119,10 @@
     out = 28'(in);
     out[22] = ^(out & 28'h03003FF);
     out[23] = ^(out & 28'h010FC0F);
-    out[24] = ^(out & 28'h0371C71);
+    out[24] = ^(out & 28'h0271C71);
     out[25] = ^(out & 28'h03B6592);
     out[26] = ^(out & 28'h03DAAA4);
-    out[27] = ^(out & 28'h02ED348);
+    out[27] = ^(out & 28'h03ED348);
     return out;
   endfunction
 
@@ -138,10 +138,10 @@
     // Syndrome calculation
     syndrome_o[0] = ^(in & 28'h07003FF);
     syndrome_o[1] = ^(in & 28'h090FC0F);
-    syndrome_o[2] = ^(in & 28'h1371C71);
+    syndrome_o[2] = ^(in & 28'h1271C71);
     syndrome_o[3] = ^(in & 28'h23B6592);
     syndrome_o[4] = ^(in & 28'h43DAAA4);
-    syndrome_o[5] = ^(in & 28'h82ED348);
+    syndrome_o[5] = ^(in & 28'h83ED348);
 
     // Corrected output calculation
     d_o[0] = (syndrome_o == 6'h7) ^ in[0];
@@ -164,7 +164,7 @@
     d_o[17] = (syndrome_o == 6'h2c) ^ in[17];
     d_o[18] = (syndrome_o == 6'h34) ^ in[18];
     d_o[19] = (syndrome_o == 6'h38) ^ in[19];
-    d_o[20] = (syndrome_o == 6'h1f) ^ in[20];
+    d_o[20] = (syndrome_o == 6'h3b) ^ in[20];
     d_o[21] = (syndrome_o == 6'h3d) ^ in[21];
 
     // err_o calc. bit0: single error, bit1: double error
@@ -182,13 +182,13 @@
   function automatic logic [38:0] prim_secded_39_32_enc (logic [31:0] in);
     logic [38:0] out;
     out = 39'(in);
-    out[32] = ^(out & 39'h00850E56A2);
-    out[33] = ^(out & 39'h002E534C61);
-    out[34] = ^(out & 39'h000901A9FE);
-    out[35] = ^(out & 39'h007079A702);
-    out[36] = ^(out & 39'h00CABA900D);
-    out[37] = ^(out & 39'h00D3C44B18);
-    out[38] = ^(out & 39'h0034A430D5);
+    out[32] = ^(out & 39'h002606BD25);
+    out[33] = ^(out & 39'h00DEBA8050);
+    out[34] = ^(out & 39'h00413D89AA);
+    out[35] = ^(out & 39'h0031234ED1);
+    out[36] = ^(out & 39'h00C2C1323B);
+    out[37] = ^(out & 39'h002DCC624C);
+    out[38] = ^(out & 39'h0098505586);
     return out;
   endfunction
 
@@ -202,47 +202,47 @@
     logic single_error;
 
     // Syndrome calculation
-    syndrome_o[0] = ^(in & 39'h01850E56A2);
-    syndrome_o[1] = ^(in & 39'h022E534C61);
-    syndrome_o[2] = ^(in & 39'h040901A9FE);
-    syndrome_o[3] = ^(in & 39'h087079A702);
-    syndrome_o[4] = ^(in & 39'h10CABA900D);
-    syndrome_o[5] = ^(in & 39'h20D3C44B18);
-    syndrome_o[6] = ^(in & 39'h4034A430D5);
+    syndrome_o[0] = ^(in & 39'h012606BD25);
+    syndrome_o[1] = ^(in & 39'h02DEBA8050);
+    syndrome_o[2] = ^(in & 39'h04413D89AA);
+    syndrome_o[3] = ^(in & 39'h0831234ED1);
+    syndrome_o[4] = ^(in & 39'h10C2C1323B);
+    syndrome_o[5] = ^(in & 39'h202DCC624C);
+    syndrome_o[6] = ^(in & 39'h4098505586);
 
     // Corrected output calculation
-    d_o[0] = (syndrome_o == 7'h52) ^ in[0];
-    d_o[1] = (syndrome_o == 7'hd) ^ in[1];
-    d_o[2] = (syndrome_o == 7'h54) ^ in[2];
+    d_o[0] = (syndrome_o == 7'h19) ^ in[0];
+    d_o[1] = (syndrome_o == 7'h54) ^ in[1];
+    d_o[2] = (syndrome_o == 7'h61) ^ in[2];
     d_o[3] = (syndrome_o == 7'h34) ^ in[3];
-    d_o[4] = (syndrome_o == 7'h64) ^ in[4];
-    d_o[5] = (syndrome_o == 7'h7) ^ in[5];
-    d_o[6] = (syndrome_o == 7'h46) ^ in[6];
-    d_o[7] = (syndrome_o == 7'h45) ^ in[7];
-    d_o[8] = (syndrome_o == 7'h2c) ^ in[8];
-    d_o[9] = (syndrome_o == 7'h29) ^ in[9];
-    d_o[10] = (syndrome_o == 7'hb) ^ in[10];
-    d_o[11] = (syndrome_o == 7'h26) ^ in[11];
+    d_o[4] = (syndrome_o == 7'h1a) ^ in[4];
+    d_o[5] = (syndrome_o == 7'h15) ^ in[5];
+    d_o[6] = (syndrome_o == 7'h2a) ^ in[6];
+    d_o[7] = (syndrome_o == 7'h4c) ^ in[7];
+    d_o[8] = (syndrome_o == 7'h45) ^ in[8];
+    d_o[9] = (syndrome_o == 7'h38) ^ in[9];
+    d_o[10] = (syndrome_o == 7'h49) ^ in[10];
+    d_o[11] = (syndrome_o == 7'hd) ^ in[11];
     d_o[12] = (syndrome_o == 7'h51) ^ in[12];
-    d_o[13] = (syndrome_o == 7'h4c) ^ in[13];
-    d_o[14] = (syndrome_o == 7'h23) ^ in[14];
-    d_o[15] = (syndrome_o == 7'h1c) ^ in[15];
-    d_o[16] = (syndrome_o == 7'he) ^ in[16];
-    d_o[17] = (syndrome_o == 7'h13) ^ in[17];
-    d_o[18] = (syndrome_o == 7'h61) ^ in[18];
-    d_o[19] = (syndrome_o == 7'h19) ^ in[19];
-    d_o[20] = (syndrome_o == 7'h1a) ^ in[20];
-    d_o[21] = (syndrome_o == 7'h58) ^ in[21];
-    d_o[22] = (syndrome_o == 7'h2a) ^ in[22];
-    d_o[23] = (syndrome_o == 7'h70) ^ in[23];
-    d_o[24] = (syndrome_o == 7'h25) ^ in[24];
-    d_o[25] = (syndrome_o == 7'h32) ^ in[25];
-    d_o[26] = (syndrome_o == 7'h43) ^ in[26];
-    d_o[27] = (syndrome_o == 7'h16) ^ in[27];
-    d_o[28] = (syndrome_o == 7'h68) ^ in[28];
-    d_o[29] = (syndrome_o == 7'h4a) ^ in[29];
-    d_o[30] = (syndrome_o == 7'h38) ^ in[30];
-    d_o[31] = (syndrome_o == 7'h31) ^ in[31];
+    d_o[13] = (syndrome_o == 7'h31) ^ in[13];
+    d_o[14] = (syndrome_o == 7'h68) ^ in[14];
+    d_o[15] = (syndrome_o == 7'h7) ^ in[15];
+    d_o[16] = (syndrome_o == 7'h1c) ^ in[16];
+    d_o[17] = (syndrome_o == 7'hb) ^ in[17];
+    d_o[18] = (syndrome_o == 7'h25) ^ in[18];
+    d_o[19] = (syndrome_o == 7'h26) ^ in[19];
+    d_o[20] = (syndrome_o == 7'h46) ^ in[20];
+    d_o[21] = (syndrome_o == 7'he) ^ in[21];
+    d_o[22] = (syndrome_o == 7'h70) ^ in[22];
+    d_o[23] = (syndrome_o == 7'h32) ^ in[23];
+    d_o[24] = (syndrome_o == 7'h2c) ^ in[24];
+    d_o[25] = (syndrome_o == 7'h13) ^ in[25];
+    d_o[26] = (syndrome_o == 7'h23) ^ in[26];
+    d_o[27] = (syndrome_o == 7'h62) ^ in[27];
+    d_o[28] = (syndrome_o == 7'h4a) ^ in[28];
+    d_o[29] = (syndrome_o == 7'h29) ^ in[29];
+    d_o[30] = (syndrome_o == 7'h16) ^ in[30];
+    d_o[31] = (syndrome_o == 7'h52) ^ in[31];
 
     // err_o calc. bit0: single error, bit1: double error
     single_error = ^syndrome_o;
@@ -361,14 +361,14 @@
   function automatic logic [71:0] prim_secded_72_64_enc (logic [63:0] in);
     logic [71:0] out;
     out = 72'(in);
-    out[64] = ^(out & 72'h009D000000001FFFFF);
-    out[65] = ^(out & 72'h007600000FFFE0003F);
-    out[66] = ^(out & 72'h0079003FF003E007C1);
-    out[67] = ^(out & 72'h00A70FC0F03C207842);
-    out[68] = ^(out & 72'h00D371C711C4438884);
-    out[69] = ^(out & 72'h00F8B65926488C9108);
-    out[70] = ^(out & 72'h00AEDAAA4A91152210);
-    out[71] = ^(out & 72'h004FED348D221A4420);
+    out[64] = ^(out & 72'h00B9000000001FFFFF);
+    out[65] = ^(out & 72'h005E00000FFFE0003F);
+    out[66] = ^(out & 72'h0067003FF003E007C1);
+    out[67] = ^(out & 72'h00CD0FC0F03C207842);
+    out[68] = ^(out & 72'h00B671C711C4438884);
+    out[69] = ^(out & 72'h00B5B65926488C9108);
+    out[70] = ^(out & 72'h00CBDAAA4A91152210);
+    out[71] = ^(out & 72'h007AED348D221A4420);
     return out;
   endfunction
 
@@ -382,14 +382,14 @@
     logic single_error;
 
     // Syndrome calculation
-    syndrome_o[0] = ^(in & 72'h019D000000001FFFFF);
-    syndrome_o[1] = ^(in & 72'h027600000FFFE0003F);
-    syndrome_o[2] = ^(in & 72'h0479003FF003E007C1);
-    syndrome_o[3] = ^(in & 72'h08A70FC0F03C207842);
-    syndrome_o[4] = ^(in & 72'h10D371C711C4438884);
-    syndrome_o[5] = ^(in & 72'h20F8B65926488C9108);
-    syndrome_o[6] = ^(in & 72'h40AEDAAA4A91152210);
-    syndrome_o[7] = ^(in & 72'h804FED348D221A4420);
+    syndrome_o[0] = ^(in & 72'h01B9000000001FFFFF);
+    syndrome_o[1] = ^(in & 72'h025E00000FFFE0003F);
+    syndrome_o[2] = ^(in & 72'h0467003FF003E007C1);
+    syndrome_o[3] = ^(in & 72'h08CD0FC0F03C207842);
+    syndrome_o[4] = ^(in & 72'h10B671C711C4438884);
+    syndrome_o[5] = ^(in & 72'h20B5B65926488C9108);
+    syndrome_o[6] = ^(in & 72'h40CBDAAA4A91152210);
+    syndrome_o[7] = ^(in & 72'h807AED348D221A4420);
 
     // Corrected output calculation
     d_o[0] = (syndrome_o == 8'h7) ^ in[0];
@@ -448,13 +448,13 @@
     d_o[53] = (syndrome_o == 8'hb0) ^ in[53];
     d_o[54] = (syndrome_o == 8'hd0) ^ in[54];
     d_o[55] = (syndrome_o == 8'he0) ^ in[55];
-    d_o[56] = (syndrome_o == 8'h9d) ^ in[56];
-    d_o[57] = (syndrome_o == 8'hda) ^ in[57];
-    d_o[58] = (syndrome_o == 8'hcb) ^ in[58];
-    d_o[59] = (syndrome_o == 8'he5) ^ in[59];
-    d_o[60] = (syndrome_o == 8'h37) ^ in[60];
-    d_o[61] = (syndrome_o == 8'h6e) ^ in[61];
-    d_o[62] = (syndrome_o == 8'hb6) ^ in[62];
+    d_o[56] = (syndrome_o == 8'h6d) ^ in[56];
+    d_o[57] = (syndrome_o == 8'hd6) ^ in[57];
+    d_o[58] = (syndrome_o == 8'h3e) ^ in[58];
+    d_o[59] = (syndrome_o == 8'hcb) ^ in[59];
+    d_o[60] = (syndrome_o == 8'hb3) ^ in[60];
+    d_o[61] = (syndrome_o == 8'hb5) ^ in[61];
+    d_o[62] = (syndrome_o == 8'hce) ^ in[62];
     d_o[63] = (syndrome_o == 8'h79) ^ in[63];
 
     // err_o calc. bit0: single error, bit1: double error
diff --git a/hw/ip/rom_ctrl/util/mem.py b/hw/ip/rom_ctrl/util/mem.py
index 8ee9be7..560c0b2 100644
--- a/hw/ip/rom_ctrl/util/mem.py
+++ b/hw/ip/rom_ctrl/util/mem.py
@@ -3,15 +3,27 @@
 # Licensed under the Apache License, Version 2.0, see LICENSE for details.
 # SPDX-License-Identifier: Apache-2.0
 
+import os
 import random
 import re
 import subprocess
+import sys
 import tempfile
 from typing import BinaryIO, IO, List, Optional, TextIO, Tuple
 
 from elftools.elf.elffile import ELFFile  # type: ignore
 
 
+_REPO_ROOT = os.path.join(os.path.dirname(__file__), '../../../..')
+_UTIL_DESIGN = os.path.normpath(os.path.join(_REPO_ROOT, 'util/design'))
+old_sys_path = sys.path
+try:
+    sys.path = sys.path + [_UTIL_DESIGN]
+    import secded_gen  # type: ignore
+finally:
+    sys.path = old_sys_path
+
+
 def red_xor32(word: int) -> int:
     '''Reduction XOR for a uint32'''
     word = (word & 0xffff) ^ (word >> 16)
@@ -21,17 +33,14 @@
     return (word & 0x1) ^ (word >> 1)
 
 
-def add_ecc32(word: int) -> int:
+def add_ecc32(word: int, bitmasks: List[int]) -> int:
     '''Add Hsiao (39,32) ECC bits to a 32-bit unsigned word'''
     assert 0 <= word < (1 << 32)
-    b0 = red_xor32(word ^ 0x00850e56a2) << 32
-    b1 = red_xor32(word ^ 0x002e534c61) << 33
-    b2 = red_xor32(word ^ 0x000901a9fe) << 34
-    b3 = red_xor32(word ^ 0x007079a702) << 35
-    b4 = red_xor32(word ^ 0x00caba900d) << 36
-    b5 = red_xor32(word ^ 0x00d3c44b18) << 37
-    b6 = red_xor32(word ^ 0x0034a430d5) << 38
-    return word | b0 | b1 | b2 | b3 | b4 | b5 | b6
+    assert len(bitmasks) == 7
+    ret = word
+    for idx, bitmask in enumerate(bitmasks):
+        ret |= red_xor32(word ^ bitmask) << (32 + idx)
+    return ret
 
 
 class MemChunk:
@@ -76,7 +85,9 @@
         bits, to make 39-bit words.
 
         '''
-        self.words = [add_ecc32(w) for w in self.words]
+        codes = secded_gen.gen_code('hsiao', 32, 7)
+        bitmasks = secded_gen.calc_bitmasks(32, 7, codes, False)
+        self.words = [add_ecc32(w, bitmasks) for w in self.words]
 
 
 class MemFile:
diff --git a/util/design/secded_gen.py b/util/design/secded_gen.py
index 4a32f64..0178f2e 100755
--- a/util/design/secded_gen.py
+++ b/util/design/secded_gen.py
@@ -29,6 +29,10 @@
 # secded configurations
 SECDED_CFG_FILE = "util/design/data/secded_cfg.hjson"
 
+# The seed we use to initialise the PRNG when running the randomised algorithm
+# to choose constants for Hsiao codes.
+_RND_SEED = 123
+
 
 def min_paritysize(k):
     # SECDED --> Hamming distance 'd': 4
@@ -192,12 +196,6 @@
 
 def verify(cfgs):
     error = 0
-
-    # Check that the provided seed is 32-bit int
-    if (cfgs['seed'].bit_length() > 31):
-        error += 1
-        log.error("Seed {} must be a 32-bit integer".format(cfgs['seed']))
-
     for cfg in cfgs['cfgs']:
         if (cfg['k'] <= 1 or cfg['k'] > 120):
             error += 1
@@ -223,7 +221,19 @@
     return error
 
 
-def generate(cfgs, args, seed):
+def gen_code(codetype, k, m):
+    # The hsiao_code generator uses (pseudo)random values to pick good ECC
+    # constants. Rather than exposing the seed, we pick a fixed one here to
+    # ensure everything stays stable in future.
+    old_rnd_state = random.getstate()
+    random.seed(_RND_SEED)
+    try:
+        return globals()["_{}_code".format(codetype)](k, m)
+    finally:
+        random.setstate(old_rnd_state)
+
+
+def generate(cfgs, args):
     pkg_out_str = ""
     pkg_type_str = ""
     for cfg in cfgs['cfgs']:
@@ -233,13 +243,10 @@
         n = k + m
         codetype = cfg['code_type']
         suffix = CODE_OPTIONS[codetype]
-        codes = []
-
-        # update value based on target selection
-        codes = globals()["{}_code".format(codetype)](cfg['k'], cfg['m'])
+        codes = gen_code(codetype, k, m)
 
         # write out rtl files
-        write_enc_dec_files(n, k, m, seed, codes, suffix, args.outdir, codetype)
+        write_enc_dec_files(n, k, m, codes, suffix, args.outdir, codetype)
 
         # write out package typedefs
         pkg_type_str += print_pkg_types(n, k, m, codes, suffix, codetype)
@@ -251,13 +258,13 @@
 
     # write out package file
     full_pkg_str = pkg_type_str + pkg_out_str
-    write_pkg_file(seed, args.outdir, full_pkg_str)
+    write_pkg_file(args.outdir, full_pkg_str)
 
 
 # k = data bits
 # m = parity bits
 # generate hsiao code
-def hsiao_code(k, m):
+def _hsiao_code(k, m):
     # using itertools combinations, generate odd number of 1 in a row
 
     required_row = k  # k rows are needed, decreasing everytime when it acquite
@@ -344,7 +351,7 @@
 # k = data bits
 # m = parity bits
 # generate hamming code
-def hamming_code(k, m):
+def _hamming_code(k, m):
 
     n = k + m
 
@@ -385,28 +392,26 @@
     return codes
 
 
-def write_pkg_file(s, outdir, pkg_str):
-
+def write_pkg_file(outdir, pkg_str):
     with open(outdir + "/" + "prim_secded_pkg.sv", "w") as f:
-        outstr = '''{}// SECDED Encoder generated by
-// util/design/secded_gen.py -s {} from {}
+        outstr = '''{}// SECDED package generated by
+// util/design/secded_gen.py from {}
 
 package prim_secded_pkg;
 {}
 
 endpackage
-'''.format(COPYRIGHT, s, SECDED_CFG_FILE, pkg_str)
+'''.format(COPYRIGHT, SECDED_CFG_FILE, pkg_str)
         f.write(outstr)
 
 
-def write_enc_dec_files(n, k, m, s, codes, suffix, outdir, codetype):
+def write_enc_dec_files(n, k, m, codes, suffix, outdir, codetype):
     enc_out = print_enc(n, k, m, codes)
 
     module_name = "prim_secded%s_%d_%d" % (suffix, n, k)
 
     with open(outdir + "/" + module_name + "_enc.sv", "w") as f:
-        outstr = '''{}// SECDED Encoder generated by
-// util/design/secded_gen.py -m {} -k {} -s {} -c {}
+        outstr = '''{}// SECDED encoder generated by util/design/secded_gen.py
 
 module {}_enc (
   input        [{}:0] in,
@@ -417,15 +422,13 @@
 {}  end
 
 endmodule : {}_enc
-'''.format(COPYRIGHT, m, k, s, codetype, module_name, (k - 1), (n - 1),
-           enc_out, module_name)
+'''.format(COPYRIGHT, module_name, (k - 1), (n - 1), enc_out, module_name)
         f.write(outstr)
 
     dec_out = print_dec(n, k, m, codes, codetype)
 
     with open(outdir + "/" + module_name + "_dec.sv", "w") as f:
-        outstr = '''{}// SECDED Decoder generated by
-// util/design/secded_gen.py -m {} -k {} -s {} -c {}
+        outstr = '''{}// SECDED decoder generated by util/design/secded_gen.py
 
 module {}_dec (
   input        [{}:0] in,
@@ -436,8 +439,8 @@
 
 {}
 endmodule : {}_dec
-'''.format(COPYRIGHT, m, k, s, codetype, module_name, (n - 1), (k - 1),
-           (m - 1), dec_out, module_name)
+'''.format(COPYRIGHT, module_name, (n - 1), (k - 1), (m - 1),
+           dec_out, module_name)
         f.write(outstr)
 
 
@@ -575,10 +578,6 @@
         description='''This tool generates Single Error Correction Double Error
         Detection(SECDED) encoder and decoder modules in SystemVerilog.
         ''')
-    parser.add_argument('-s',
-                        type=int,
-                        metavar='<seed>',
-                        help='Custom seed for RNG.')
     parser.add_argument('--no_fpv',
                         action='store_true',
                         help='Do not generate FPV testbench.')
@@ -611,15 +610,8 @@
     if (error):
         exit(1)
 
-    # If no seed is provided from the command line, use the seed provided in
-    # data/secded_cfg.hjson by default, such that runs of this script can be
-    # reproduced.
-    random.seed()
-    rand_seed = config['seed'] if args.s is None else args.s
-    random.seed(rand_seed)
-
     # Generate outputs
-    generate(config, args, rand_seed)
+    generate(config, args)
 
 
 if __name__ == "__main__":