aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim StroĢˆmbergson <joachim@secworks.se>2018-09-04 15:01:17 +0200
committerJoachim StroĢˆmbergson <joachim@secworks.se>2018-09-04 15:01:17 +0200
commitef8a8eae18b6cd4aae7c19940a1d9be389f8952e (patch)
tree0365ce79294c743d534c270713a67acce90f8531
parent2fb042d7158d4bd5315ef7b716334a7f45aa0928 (diff)
Updated rtl and tb to support parameterized memory size.
-rw-r--r--src/rtl/keywrap.v13
-rw-r--r--src/tb/tb_keywrap.v573
2 files changed, 291 insertions, 295 deletions
diff --git a/src/rtl/keywrap.v b/src/rtl/keywrap.v
index dc18d92..f8fcbd7 100644
--- a/src/rtl/keywrap.v
+++ b/src/rtl/keywrap.v
@@ -48,7 +48,7 @@
//
//======================================================================
-module keywrap #(parameter ADDR_BITS = 15)
+module keywrap #(parameter ADDR_BITS = 13)
(
input wire clk,
input wire reset_n,
@@ -94,15 +94,12 @@ module keywrap #(parameter ADDR_BITS = 15)
localparam ADDR_KEY6 = 8'h16;
localparam ADDR_KEY7 = 8'h17;
- localparam ADDR_R_DATA0 = 8'h80;
- localparam ADDR_R_DATA127 = 8'hff;
-
localparam CORE_NAME0 = 32'h6b657920; // "key "
localparam CORE_NAME1 = 32'h77726170; // "wrap"
localparam CORE_VERSION = 32'h302e3830; // "0.80"
-
localparam MEM_BITS = ADDR_BITS - 1;
+ localparam RLEN_BITS = ADDR_BITS - 2;
localparam PAD = ADDR_BITS - 8;
@@ -119,8 +116,8 @@ module keywrap #(parameter ADDR_BITS = 15)
reg keylen_reg;
reg config_we;
- reg [12 : 0] rlen_reg;
- reg rlen_we;
+ reg [(RLEN_BITS - 1) : 0] rlen_reg;
+ reg rlen_we;
reg [31 : 0] a0_reg;
reg a0_we;
@@ -214,7 +211,7 @@ module keywrap #(parameter ADDR_BITS = 15)
next_reg <= 1'h0;
encdec_reg <= 1'h0;
keylen_reg <= 1'h0;
- rlen_reg <= 13'h0;
+ rlen_reg <= {RLEN_BITS{1'h0}};
valid_reg <= 1'h0;
ready_reg <= 1'h0;
a0_reg <= 32'h0;
diff --git a/src/tb/tb_keywrap.v b/src/tb/tb_keywrap.v
index c53790b..f514525 100644
--- a/src/tb/tb_keywrap.v
+++ b/src/tb/tb_keywrap.v
@@ -46,6 +46,10 @@ module tb_keywrap();
parameter CLK_HALF_PERIOD = 1;
parameter CLK_PERIOD = 2 * CLK_HALF_PERIOD;
+ parameter ADDR_BITS = 13;
+ parameter MEM_BASE = {1'h1, {(ADDR_BITS - 1){1'h0}}};
+
+
// API for the core.
localparam ADDR_NAME0 = 8'h00;
localparam ADDR_NAME1 = 8'h01;
@@ -80,7 +84,6 @@ module tb_keywrap();
localparam ADDR_R_DATA0 = 8'h80;
localparam ADDR_R_DATA127 = 8'hff;
- localparam DUT_ASPACE = 12;
//----------------------------------------------------------------
// Register and Wire declarations.
@@ -92,14 +95,14 @@ module tb_keywrap();
reg [31 : 0] read_data;
reg [127 : 0] result_data;
- reg tb_clk;
- reg tb_reset_n;
- reg tb_cs;
- reg tb_we;
- reg [(DUT_ASPACE - 1) : 0] tb_address;
- reg [31 : 0] tb_write_data;
- wire [31 : 0] tb_read_data;
- wire tb_error;
+ reg tb_clk;
+ reg tb_reset_n;
+ reg tb_cs;
+ reg tb_we;
+ reg [(ADDR_BITS -1 ) : 0] tb_address;
+ reg [31 : 0] tb_write_data;
+ wire [31 : 0] tb_read_data;
+ wire tb_error;
//----------------------------------------------------------------
@@ -415,16 +418,15 @@ module tb_keywrap();
// Write the R bank to be written to.
// Write the R blocks to be processed.
write_word(ADDR_RLEN, 32'h00000004);
- write_word(ADDR_R_BANK, 32'h0);
- write_word(ADDR_R_DATA0 + 0, 32'h46f87f58);
- write_word(ADDR_R_DATA0 + 1, 32'hcdda4200);
- write_word(ADDR_R_DATA0 + 2, 32'hf53d99ce);
- write_word(ADDR_R_DATA0 + 3, 32'h2e49bdb7);
- write_word(ADDR_R_DATA0 + 4, 32'h6212511f);
- write_word(ADDR_R_DATA0 + 5, 32'he0cd4d0b);
- write_word(ADDR_R_DATA0 + 6, 32'h5f37a27d);
- write_word(ADDR_R_DATA0 + 7, 32'h45a28800);
+ write_word(MEM_BASE + 0, 32'h46f87f58);
+ write_word(MEM_BASE + 1, 32'hcdda4200);
+ write_word(MEM_BASE + 2, 32'hf53d99ce);
+ write_word(MEM_BASE + 3, 32'h2e49bdb7);
+ write_word(MEM_BASE + 4, 32'h6212511f);
+ write_word(MEM_BASE + 5, 32'he0cd4d0b);
+ write_word(MEM_BASE + 6, 32'h5f37a27d);
+ write_word(MEM_BASE + 7, 32'h45a28800);
// Write magic words to A.
write_word(ADDR_A0, 32'ha65959a6);
@@ -501,16 +503,15 @@ module tb_keywrap();
// Write the R bank to be written to.
// Write the R blocks to be processed.
write_word(ADDR_RLEN, 32'h00000004);
- write_word(ADDR_R_BANK, 32'h0);
- write_word(ADDR_R_DATA0 + 0, 32'h59a69492);
- write_word(ADDR_R_DATA0 + 1, 32'hbb7e2cd0);
- write_word(ADDR_R_DATA0 + 2, 32'h0160d2eb);
- write_word(ADDR_R_DATA0 + 3, 32'hef9bf4d4);
- write_word(ADDR_R_DATA0 + 4, 32'heb16fbf7);
- write_word(ADDR_R_DATA0 + 5, 32'h98f1340f);
- write_word(ADDR_R_DATA0 + 6, 32'h6df6558a);
- write_word(ADDR_R_DATA0 + 7, 32'h4fb84cd0);
+ write_word(MEM_BASE + 0, 32'h59a69492);
+ write_word(MEM_BASE + 1, 32'hbb7e2cd0);
+ write_word(MEM_BASE + 2, 32'h0160d2eb);
+ write_word(MEM_BASE + 3, 32'hef9bf4d4);
+ write_word(MEM_BASE + 4, 32'heb16fbf7);
+ write_word(MEM_BASE + 5, 32'h98f1340f);
+ write_word(MEM_BASE + 6, 32'h6df6558a);
+ write_word(MEM_BASE + 7, 32'h4fb84cd0);
// Write magic words to A.
write_word(ADDR_A0, 32'h57e3b669);
@@ -585,136 +586,135 @@ module tb_keywrap();
// Write the R bank to be written to.
// Write the R blocks to be processed.
write_word(ADDR_RLEN, 32'h00000040);
- write_word(ADDR_R_BANK, 32'h0);
-
- write_word(ADDR_R_DATA0 + 0, 32'h8af887c5);
- write_word(ADDR_R_DATA0 + 1, 32'h8dfbc38e);
- write_word(ADDR_R_DATA0 + 2, 32'he0423eef);
- write_word(ADDR_R_DATA0 + 3, 32'hcc0e032d);
- write_word(ADDR_R_DATA0 + 4, 32'hcc79dd11);
- write_word(ADDR_R_DATA0 + 5, 32'h6638ca65);
- write_word(ADDR_R_DATA0 + 6, 32'had75dca2);
- write_word(ADDR_R_DATA0 + 7, 32'ha2459f13);
- write_word(ADDR_R_DATA0 + 8, 32'h934dbe61);
- write_word(ADDR_R_DATA0 + 9, 32'ha62cb26d);
- write_word(ADDR_R_DATA0 + 10, 32'h8bbddbab);
- write_word(ADDR_R_DATA0 + 11, 32'hf9bf52bb);
- write_word(ADDR_R_DATA0 + 12, 32'he137ef1d);
- write_word(ADDR_R_DATA0 + 13, 32'h3e30eacf);
- write_word(ADDR_R_DATA0 + 14, 32'h0fe456ec);
- write_word(ADDR_R_DATA0 + 15, 32'h808d6798);
- write_word(ADDR_R_DATA0 + 16, 32'hdc29fe54);
- write_word(ADDR_R_DATA0 + 17, 32'hfa1f784a);
- write_word(ADDR_R_DATA0 + 18, 32'ha3c11cf3);
- write_word(ADDR_R_DATA0 + 19, 32'h94050095);
- write_word(ADDR_R_DATA0 + 20, 32'h81d3f1d5);
- write_word(ADDR_R_DATA0 + 21, 32'h96843813);
- write_word(ADDR_R_DATA0 + 22, 32'ha6685e50);
- write_word(ADDR_R_DATA0 + 23, 32'h3fac8535);
- write_word(ADDR_R_DATA0 + 24, 32'he0c06ecc);
- write_word(ADDR_R_DATA0 + 25, 32'ha8561b6a);
- write_word(ADDR_R_DATA0 + 26, 32'h1f22c578);
- write_word(ADDR_R_DATA0 + 27, 32'heefb6919);
- write_word(ADDR_R_DATA0 + 28, 32'h12be2e16);
- write_word(ADDR_R_DATA0 + 29, 32'h67946101);
- write_word(ADDR_R_DATA0 + 30, 32'hae8c3501);
- write_word(ADDR_R_DATA0 + 31, 32'he6c66eb1);
- write_word(ADDR_R_DATA0 + 32, 32'h7e14f260);
- write_word(ADDR_R_DATA0 + 33, 32'h8c9ce6fb);
- write_word(ADDR_R_DATA0 + 34, 32'hab4a1597);
- write_word(ADDR_R_DATA0 + 35, 32'hed49ccb3);
- write_word(ADDR_R_DATA0 + 36, 32'h930b1060);
- write_word(ADDR_R_DATA0 + 37, 32'hf98c97d8);
- write_word(ADDR_R_DATA0 + 38, 32'hdc4ce81e);
- write_word(ADDR_R_DATA0 + 39, 32'h35279c4d);
- write_word(ADDR_R_DATA0 + 40, 32'h30d1bf86);
- write_word(ADDR_R_DATA0 + 41, 32'hc9b919a3);
- write_word(ADDR_R_DATA0 + 42, 32'hce4f0109);
- write_word(ADDR_R_DATA0 + 43, 32'he77929e5);
- write_word(ADDR_R_DATA0 + 44, 32'h8c4c3aeb);
- write_word(ADDR_R_DATA0 + 45, 32'h5de1ec5e);
- write_word(ADDR_R_DATA0 + 46, 32'h0afa38ae);
- write_word(ADDR_R_DATA0 + 47, 32'h896df912);
- write_word(ADDR_R_DATA0 + 48, 32'h1c72c255);
- write_word(ADDR_R_DATA0 + 49, 32'h141f2f5c);
- write_word(ADDR_R_DATA0 + 50, 32'h9a51be50);
- write_word(ADDR_R_DATA0 + 51, 32'h72547cf8);
- write_word(ADDR_R_DATA0 + 52, 32'ha3b06740);
- write_word(ADDR_R_DATA0 + 53, 32'h4e62f961);
- write_word(ADDR_R_DATA0 + 54, 32'h5a02479c);
- write_word(ADDR_R_DATA0 + 55, 32'hf8c202e7);
- write_word(ADDR_R_DATA0 + 56, 32'hfeb2e258);
- write_word(ADDR_R_DATA0 + 57, 32'h314e0ebe);
- write_word(ADDR_R_DATA0 + 58, 32'h62878a5c);
- write_word(ADDR_R_DATA0 + 59, 32'h4ecd4e9d);
- write_word(ADDR_R_DATA0 + 60, 32'hf7dab2e1);
- write_word(ADDR_R_DATA0 + 61, 32'hfa9a7b53);
- write_word(ADDR_R_DATA0 + 62, 32'h2c2169ac);
- write_word(ADDR_R_DATA0 + 63, 32'hedb7998d);
- write_word(ADDR_R_DATA0 + 64, 32'h5cd8a711);
- write_word(ADDR_R_DATA0 + 65, 32'h8848ce7e);
- write_word(ADDR_R_DATA0 + 66, 32'he9fb2f68);
- write_word(ADDR_R_DATA0 + 67, 32'he28c2b27);
- write_word(ADDR_R_DATA0 + 68, 32'h9ddc064d);
- write_word(ADDR_R_DATA0 + 69, 32'hb70ad73c);
- write_word(ADDR_R_DATA0 + 70, 32'h6dbe10c5);
- write_word(ADDR_R_DATA0 + 71, 32'he1c56a70);
- write_word(ADDR_R_DATA0 + 72, 32'h9c1407f9);
- write_word(ADDR_R_DATA0 + 73, 32'h3a727cce);
- write_word(ADDR_R_DATA0 + 74, 32'h1075103a);
- write_word(ADDR_R_DATA0 + 75, 32'h4009ae2f);
- write_word(ADDR_R_DATA0 + 76, 32'h7731b7d7);
- write_word(ADDR_R_DATA0 + 77, 32'h1756eee1);
- write_word(ADDR_R_DATA0 + 78, 32'h19b828ef);
- write_word(ADDR_R_DATA0 + 79, 32'h4ed61eff);
- write_word(ADDR_R_DATA0 + 80, 32'h16493553);
- write_word(ADDR_R_DATA0 + 81, 32'h2a94fa8f);
- write_word(ADDR_R_DATA0 + 82, 32'he62dc2e2);
- write_word(ADDR_R_DATA0 + 83, 32'h2cf20f16);
- write_word(ADDR_R_DATA0 + 84, 32'h8ae65f4b);
- write_word(ADDR_R_DATA0 + 85, 32'h6785286c);
- write_word(ADDR_R_DATA0 + 86, 32'h253f365f);
- write_word(ADDR_R_DATA0 + 87, 32'h29453a47);
- write_word(ADDR_R_DATA0 + 88, 32'h9dc2824b);
- write_word(ADDR_R_DATA0 + 89, 32'h8bdabd96);
- write_word(ADDR_R_DATA0 + 90, 32'h2da3b76a);
- write_word(ADDR_R_DATA0 + 91, 32'he9c8a720);
- write_word(ADDR_R_DATA0 + 92, 32'h155e158f);
- write_word(ADDR_R_DATA0 + 93, 32'he389c8cc);
- write_word(ADDR_R_DATA0 + 94, 32'h7fa6ad52);
- write_word(ADDR_R_DATA0 + 95, 32'h2c951b5c);
- write_word(ADDR_R_DATA0 + 96, 32'h236bf964);
- write_word(ADDR_R_DATA0 + 97, 32'hb5b1bfb0);
- write_word(ADDR_R_DATA0 + 98, 32'h98a39835);
- write_word(ADDR_R_DATA0 + 99, 32'h759b9540);
- write_word(ADDR_R_DATA0 + 100, 32'h4b72b17f);
- write_word(ADDR_R_DATA0 + 101, 32'h7dbcda93);
- write_word(ADDR_R_DATA0 + 102, 32'h6177ae05);
- write_word(ADDR_R_DATA0 + 103, 32'h9269f41e);
- write_word(ADDR_R_DATA0 + 104, 32'hcdac81a4);
- write_word(ADDR_R_DATA0 + 105, 32'h9f5bbfd2);
- write_word(ADDR_R_DATA0 + 106, 32'he801392a);
- write_word(ADDR_R_DATA0 + 107, 32'h043ef068);
- write_word(ADDR_R_DATA0 + 108, 32'h73550a67);
- write_word(ADDR_R_DATA0 + 109, 32'hfcbc039f);
- write_word(ADDR_R_DATA0 + 110, 32'h0b5d30ce);
- write_word(ADDR_R_DATA0 + 111, 32'h490baa97);
- write_word(ADDR_R_DATA0 + 112, 32'h9dbbaf9e);
- write_word(ADDR_R_DATA0 + 113, 32'h53d45d7e);
- write_word(ADDR_R_DATA0 + 114, 32'h2dff26b2);
- write_word(ADDR_R_DATA0 + 115, 32'hf7e6628d);
- write_word(ADDR_R_DATA0 + 116, 32'hed694217);
- write_word(ADDR_R_DATA0 + 117, 32'ha39f454b);
- write_word(ADDR_R_DATA0 + 118, 32'h288e7906);
- write_word(ADDR_R_DATA0 + 119, 32'hb79faf4a);
- write_word(ADDR_R_DATA0 + 120, 32'h407a7d20);
- write_word(ADDR_R_DATA0 + 121, 32'h7646f930);
- write_word(ADDR_R_DATA0 + 122, 32'h96a157f0);
- write_word(ADDR_R_DATA0 + 123, 32'hd1dca05a);
- write_word(ADDR_R_DATA0 + 124, 32'h7f92e318);
- write_word(ADDR_R_DATA0 + 125, 32'hfc1ff62c);
- write_word(ADDR_R_DATA0 + 126, 32'he2de7f12);
- write_word(ADDR_R_DATA0 + 127, 32'h9b187053);
+
+ write_word(MEM_BASE + 0, 32'h8af887c5);
+ write_word(MEM_BASE + 1, 32'h8dfbc38e);
+ write_word(MEM_BASE + 2, 32'he0423eef);
+ write_word(MEM_BASE + 3, 32'hcc0e032d);
+ write_word(MEM_BASE + 4, 32'hcc79dd11);
+ write_word(MEM_BASE + 5, 32'h6638ca65);
+ write_word(MEM_BASE + 6, 32'had75dca2);
+ write_word(MEM_BASE + 7, 32'ha2459f13);
+ write_word(MEM_BASE + 8, 32'h934dbe61);
+ write_word(MEM_BASE + 9, 32'ha62cb26d);
+ write_word(MEM_BASE + 10, 32'h8bbddbab);
+ write_word(MEM_BASE + 11, 32'hf9bf52bb);
+ write_word(MEM_BASE + 12, 32'he137ef1d);
+ write_word(MEM_BASE + 13, 32'h3e30eacf);
+ write_word(MEM_BASE + 14, 32'h0fe456ec);
+ write_word(MEM_BASE + 15, 32'h808d6798);
+ write_word(MEM_BASE + 16, 32'hdc29fe54);
+ write_word(MEM_BASE + 17, 32'hfa1f784a);
+ write_word(MEM_BASE + 18, 32'ha3c11cf3);
+ write_word(MEM_BASE + 19, 32'h94050095);
+ write_word(MEM_BASE + 20, 32'h81d3f1d5);
+ write_word(MEM_BASE + 21, 32'h96843813);
+ write_word(MEM_BASE + 22, 32'ha6685e50);
+ write_word(MEM_BASE + 23, 32'h3fac8535);
+ write_word(MEM_BASE + 24, 32'he0c06ecc);
+ write_word(MEM_BASE + 25, 32'ha8561b6a);
+ write_word(MEM_BASE + 26, 32'h1f22c578);
+ write_word(MEM_BASE + 27, 32'heefb6919);
+ write_word(MEM_BASE + 28, 32'h12be2e16);
+ write_word(MEM_BASE + 29, 32'h67946101);
+ write_word(MEM_BASE + 30, 32'hae8c3501);
+ write_word(MEM_BASE + 31, 32'he6c66eb1);
+ write_word(MEM_BASE + 32, 32'h7e14f260);
+ write_word(MEM_BASE + 33, 32'h8c9ce6fb);
+ write_word(MEM_BASE + 34, 32'hab4a1597);
+ write_word(MEM_BASE + 35, 32'hed49ccb3);
+ write_word(MEM_BASE + 36, 32'h930b1060);
+ write_word(MEM_BASE + 37, 32'hf98c97d8);
+ write_word(MEM_BASE + 38, 32'hdc4ce81e);
+ write_word(MEM_BASE + 39, 32'h35279c4d);
+ write_word(MEM_BASE + 40, 32'h30d1bf86);
+ write_word(MEM_BASE + 41, 32'hc9b919a3);
+ write_word(MEM_BASE + 42, 32'hce4f0109);
+ write_word(MEM_BASE + 43, 32'he77929e5);
+ write_word(MEM_BASE + 44, 32'h8c4c3aeb);
+ write_word(MEM_BASE + 45, 32'h5de1ec5e);
+ write_word(MEM_BASE + 46, 32'h0afa38ae);
+ write_word(MEM_BASE + 47, 32'h896df912);
+ write_word(MEM_BASE + 48, 32'h1c72c255);
+ write_word(MEM_BASE + 49, 32'h141f2f5c);
+ write_word(MEM_BASE + 50, 32'h9a51be50);
+ write_word(MEM_BASE + 51, 32'h72547cf8);
+ write_word(MEM_BASE + 52, 32'ha3b06740);
+ write_word(MEM_BASE + 53, 32'h4e62f961);
+ write_word(MEM_BASE + 54, 32'h5a02479c);
+ write_word(MEM_BASE + 55, 32'hf8c202e7);
+ write_word(MEM_BASE + 56, 32'hfeb2e258);
+ write_word(MEM_BASE + 57, 32'h314e0ebe);
+ write_word(MEM_BASE + 58, 32'h62878a5c);
+ write_word(MEM_BASE + 59, 32'h4ecd4e9d);
+ write_word(MEM_BASE + 60, 32'hf7dab2e1);
+ write_word(MEM_BASE + 61, 32'hfa9a7b53);
+ write_word(MEM_BASE + 62, 32'h2c2169ac);
+ write_word(MEM_BASE + 63, 32'hedb7998d);
+ write_word(MEM_BASE + 64, 32'h5cd8a711);
+ write_word(MEM_BASE + 65, 32'h8848ce7e);
+ write_word(MEM_BASE + 66, 32'he9fb2f68);
+ write_word(MEM_BASE + 67, 32'he28c2b27);
+ write_word(MEM_BASE + 68, 32'h9ddc064d);
+ write_word(MEM_BASE + 69, 32'hb70ad73c);
+ write_word(MEM_BASE + 70, 32'h6dbe10c5);
+ write_word(MEM_BASE + 71, 32'he1c56a70);
+ write_word(MEM_BASE + 72, 32'h9c1407f9);
+ write_word(MEM_BASE + 73, 32'h3a727cce);
+ write_word(MEM_BASE + 74, 32'h1075103a);
+ write_word(MEM_BASE + 75, 32'h4009ae2f);
+ write_word(MEM_BASE + 76, 32'h7731b7d7);
+ write_word(MEM_BASE + 77, 32'h1756eee1);
+ write_word(MEM_BASE + 78, 32'h19b828ef);
+ write_word(MEM_BASE + 79, 32'h4ed61eff);
+ write_word(MEM_BASE + 80, 32'h16493553);
+ write_word(MEM_BASE + 81, 32'h2a94fa8f);
+ write_word(MEM_BASE + 82, 32'he62dc2e2);
+ write_word(MEM_BASE + 83, 32'h2cf20f16);
+ write_word(MEM_BASE + 84, 32'h8ae65f4b);
+ write_word(MEM_BASE + 85, 32'h6785286c);
+ write_word(MEM_BASE + 86, 32'h253f365f);
+ write_word(MEM_BASE + 87, 32'h29453a47);
+ write_word(MEM_BASE + 88, 32'h9dc2824b);
+ write_word(MEM_BASE + 89, 32'h8bdabd96);
+ write_word(MEM_BASE + 90, 32'h2da3b76a);
+ write_word(MEM_BASE + 91, 32'he9c8a720);
+ write_word(MEM_BASE + 92, 32'h155e158f);
+ write_word(MEM_BASE + 93, 32'he389c8cc);
+ write_word(MEM_BASE + 94, 32'h7fa6ad52);
+ write_word(MEM_BASE + 95, 32'h2c951b5c);
+ write_word(MEM_BASE + 96, 32'h236bf964);
+ write_word(MEM_BASE + 97, 32'hb5b1bfb0);
+ write_word(MEM_BASE + 98, 32'h98a39835);
+ write_word(MEM_BASE + 99, 32'h759b9540);
+ write_word(MEM_BASE + 100, 32'h4b72b17f);
+ write_word(MEM_BASE + 101, 32'h7dbcda93);
+ write_word(MEM_BASE + 102, 32'h6177ae05);
+ write_word(MEM_BASE + 103, 32'h9269f41e);
+ write_word(MEM_BASE + 104, 32'hcdac81a4);
+ write_word(MEM_BASE + 105, 32'h9f5bbfd2);
+ write_word(MEM_BASE + 106, 32'he801392a);
+ write_word(MEM_BASE + 107, 32'h043ef068);
+ write_word(MEM_BASE + 108, 32'h73550a67);
+ write_word(MEM_BASE + 109, 32'hfcbc039f);
+ write_word(MEM_BASE + 110, 32'h0b5d30ce);
+ write_word(MEM_BASE + 111, 32'h490baa97);
+ write_word(MEM_BASE + 112, 32'h9dbbaf9e);
+ write_word(MEM_BASE + 113, 32'h53d45d7e);
+ write_word(MEM_BASE + 114, 32'h2dff26b2);
+ write_word(MEM_BASE + 115, 32'hf7e6628d);
+ write_word(MEM_BASE + 116, 32'hed694217);
+ write_word(MEM_BASE + 117, 32'ha39f454b);
+ write_word(MEM_BASE + 118, 32'h288e7906);
+ write_word(MEM_BASE + 119, 32'hb79faf4a);
+ write_word(MEM_BASE + 120, 32'h407a7d20);
+ write_word(MEM_BASE + 121, 32'h7646f930);
+ write_word(MEM_BASE + 122, 32'h96a157f0);
+ write_word(MEM_BASE + 123, 32'hd1dca05a);
+ write_word(MEM_BASE + 124, 32'h7f92e318);
+ write_word(MEM_BASE + 125, 32'hfc1ff62c);
+ write_word(MEM_BASE + 126, 32'he2de7f12);
+ write_word(MEM_BASE + 127, 32'h9b187053);
// Write magic words to A.
write_word(ADDR_A0, 32'ha65959a6);
@@ -787,136 +787,135 @@ module tb_keywrap();
// Write the R bank to be written to.
// Write the R blocks to be processed.
write_word(ADDR_RLEN, 32'h00000040);
- write_word(ADDR_R_BANK, 32'h0);
-
- write_word(ADDR_R_DATA0 + 0, 32'h4501c1ec);
- write_word(ADDR_R_DATA0 + 1, 32'hadc6b5e3);
- write_word(ADDR_R_DATA0 + 2, 32'hf1c23c29);
- write_word(ADDR_R_DATA0 + 3, 32'heca60890);
- write_word(ADDR_R_DATA0 + 4, 32'h5f9cabdd);
- write_word(ADDR_R_DATA0 + 5, 32'h46e34a55);
- write_word(ADDR_R_DATA0 + 6, 32'he1f7ac83);
- write_word(ADDR_R_DATA0 + 7, 32'h08e75c90);
- write_word(ADDR_R_DATA0 + 8, 32'h3675982b);
- write_word(ADDR_R_DATA0 + 9, 32'hda99173a);
- write_word(ADDR_R_DATA0 + 10, 32'h2ba57d2c);
- write_word(ADDR_R_DATA0 + 11, 32'hcf2e01a0);
- write_word(ADDR_R_DATA0 + 12, 32'h2589f89d);
- write_word(ADDR_R_DATA0 + 13, 32'hfd4b3c7f);
- write_word(ADDR_R_DATA0 + 14, 32'hd229ec91);
- write_word(ADDR_R_DATA0 + 15, 32'hc9d0c46e);
- write_word(ADDR_R_DATA0 + 16, 32'ha5dee3c0);
- write_word(ADDR_R_DATA0 + 17, 32'h48cd4611);
- write_word(ADDR_R_DATA0 + 18, 32'hbfeadc9b);
- write_word(ADDR_R_DATA0 + 19, 32'hf26daa1e);
- write_word(ADDR_R_DATA0 + 20, 32'h02cb72e2);
- write_word(ADDR_R_DATA0 + 21, 32'h22cf3dab);
- write_word(ADDR_R_DATA0 + 22, 32'h120dd1e8);
- write_word(ADDR_R_DATA0 + 23, 32'hc2dd9bd5);
- write_word(ADDR_R_DATA0 + 24, 32'h8bbefa5d);
- write_word(ADDR_R_DATA0 + 25, 32'h14526abd);
- write_word(ADDR_R_DATA0 + 26, 32'h1e8d2170);
- write_word(ADDR_R_DATA0 + 27, 32'ha6ba8283);
- write_word(ADDR_R_DATA0 + 28, 32'hc243ec2f);
- write_word(ADDR_R_DATA0 + 29, 32'hd5ef0703);
- write_word(ADDR_R_DATA0 + 30, 32'h0b1ef5f6);
- write_word(ADDR_R_DATA0 + 31, 32'h9f9620e4);
- write_word(ADDR_R_DATA0 + 32, 32'hb17a3639);
- write_word(ADDR_R_DATA0 + 33, 32'h34100588);
- write_word(ADDR_R_DATA0 + 34, 32'h7b9ffc79);
- write_word(ADDR_R_DATA0 + 35, 32'h35335947);
- write_word(ADDR_R_DATA0 + 36, 32'h03e5dcae);
- write_word(ADDR_R_DATA0 + 37, 32'h67bd0ce7);
- write_word(ADDR_R_DATA0 + 38, 32'ha3c98ca6);
- write_word(ADDR_R_DATA0 + 39, 32'h5815a4d0);
- write_word(ADDR_R_DATA0 + 40, 32'h67f27e6e);
- write_word(ADDR_R_DATA0 + 41, 32'h66d6636c);
- write_word(ADDR_R_DATA0 + 42, 32'hebb78973);
- write_word(ADDR_R_DATA0 + 43, 32'h2566a52a);
- write_word(ADDR_R_DATA0 + 44, 32'hc3970e14);
- write_word(ADDR_R_DATA0 + 45, 32'hc37310dc);
- write_word(ADDR_R_DATA0 + 46, 32'h2fcee0e7);
- write_word(ADDR_R_DATA0 + 47, 32'h39a16291);
- write_word(ADDR_R_DATA0 + 48, 32'h029fd2b4);
- write_word(ADDR_R_DATA0 + 49, 32'hd534e304);
- write_word(ADDR_R_DATA0 + 50, 32'h45474b26);
- write_word(ADDR_R_DATA0 + 51, 32'h711a8b3e);
- write_word(ADDR_R_DATA0 + 52, 32'h1ee3cc88);
- write_word(ADDR_R_DATA0 + 53, 32'hb09e8b17);
- write_word(ADDR_R_DATA0 + 54, 32'h45b6cc0f);
- write_word(ADDR_R_DATA0 + 55, 32'h067624ec);
- write_word(ADDR_R_DATA0 + 56, 32'hb232db75);
- write_word(ADDR_R_DATA0 + 57, 32'h0b01fe54);
- write_word(ADDR_R_DATA0 + 58, 32'h57fdea77);
- write_word(ADDR_R_DATA0 + 59, 32'hb251b10f);
- write_word(ADDR_R_DATA0 + 60, 32'he95d3eee);
- write_word(ADDR_R_DATA0 + 61, 32'hdb083bdf);
- write_word(ADDR_R_DATA0 + 62, 32'h109c41db);
- write_word(ADDR_R_DATA0 + 63, 32'ha26cc965);
- write_word(ADDR_R_DATA0 + 64, 32'h4f787bf9);
- write_word(ADDR_R_DATA0 + 65, 32'h5735ff07);
- write_word(ADDR_R_DATA0 + 66, 32'h070b175c);
- write_word(ADDR_R_DATA0 + 67, 32'hea8b6230);
- write_word(ADDR_R_DATA0 + 68, 32'h2e6087b9);
- write_word(ADDR_R_DATA0 + 69, 32'h1a041547);
- write_word(ADDR_R_DATA0 + 70, 32'h46056910);
- write_word(ADDR_R_DATA0 + 71, 32'h99f1a9e2);
- write_word(ADDR_R_DATA0 + 72, 32'hb626c4b3);
- write_word(ADDR_R_DATA0 + 73, 32'hbb7aeb8e);
- write_word(ADDR_R_DATA0 + 74, 32'had9922bc);
- write_word(ADDR_R_DATA0 + 75, 32'h3617cb42);
- write_word(ADDR_R_DATA0 + 76, 32'h7c669b88);
- write_word(ADDR_R_DATA0 + 77, 32'hbe5f98ae);
- write_word(ADDR_R_DATA0 + 78, 32'ha7edb8b0);
- write_word(ADDR_R_DATA0 + 79, 32'h063bec80);
- write_word(ADDR_R_DATA0 + 80, 32'haf4c081f);
- write_word(ADDR_R_DATA0 + 81, 32'h89778d7c);
- write_word(ADDR_R_DATA0 + 82, 32'h7242ddae);
- write_word(ADDR_R_DATA0 + 83, 32'h88e8d3af);
- write_word(ADDR_R_DATA0 + 84, 32'hf1f80e57);
- write_word(ADDR_R_DATA0 + 85, 32'h5e1aab4a);
- write_word(ADDR_R_DATA0 + 86, 32'h5d115bc2);
- write_word(ADDR_R_DATA0 + 87, 32'h7636fd14);
- write_word(ADDR_R_DATA0 + 88, 32'hd19bc594);
- write_word(ADDR_R_DATA0 + 89, 32'h33f69763);
- write_word(ADDR_R_DATA0 + 90, 32'h5ecd870d);
- write_word(ADDR_R_DATA0 + 91, 32'h17e7f5b0);
- write_word(ADDR_R_DATA0 + 92, 32'h04dee400);
- write_word(ADDR_R_DATA0 + 93, 32'h1cddc34a);
- write_word(ADDR_R_DATA0 + 94, 32'hb6e377ee);
- write_word(ADDR_R_DATA0 + 95, 32'hb3fb08e9);
- write_word(ADDR_R_DATA0 + 96, 32'h47697076);
- write_word(ADDR_R_DATA0 + 97, 32'h5105d93e);
- write_word(ADDR_R_DATA0 + 98, 32'h4558fe3d);
- write_word(ADDR_R_DATA0 + 99, 32'h4fc6fe05);
- write_word(ADDR_R_DATA0 + 100, 32'h3aab9c6c);
- write_word(ADDR_R_DATA0 + 101, 32'hf032f111);
- write_word(ADDR_R_DATA0 + 102, 32'h6e70c2d6);
- write_word(ADDR_R_DATA0 + 103, 32'h5f7c8cde);
- write_word(ADDR_R_DATA0 + 104, 32'hb6ad63ac);
- write_word(ADDR_R_DATA0 + 105, 32'h4291f93d);
- write_word(ADDR_R_DATA0 + 106, 32'h467ebbb2);
- write_word(ADDR_R_DATA0 + 107, 32'h9ead265c);
- write_word(ADDR_R_DATA0 + 108, 32'h05ac684d);
- write_word(ADDR_R_DATA0 + 109, 32'h20a6bef0);
- write_word(ADDR_R_DATA0 + 110, 32'h9b71830f);
- write_word(ADDR_R_DATA0 + 111, 32'h717e08bc);
- write_word(ADDR_R_DATA0 + 112, 32'hb4f9d377);
- write_word(ADDR_R_DATA0 + 113, 32'h3bec928f);
- write_word(ADDR_R_DATA0 + 114, 32'h66eeb64d);
- write_word(ADDR_R_DATA0 + 115, 32'hc451e958);
- write_word(ADDR_R_DATA0 + 116, 32'he357ebbf);
- write_word(ADDR_R_DATA0 + 117, 32'hef5a342d);
- write_word(ADDR_R_DATA0 + 118, 32'hf28707ac);
- write_word(ADDR_R_DATA0 + 119, 32'h4b8e3e8c);
- write_word(ADDR_R_DATA0 + 120, 32'h854e8d69);
- write_word(ADDR_R_DATA0 + 121, 32'h1cb92e87);
- write_word(ADDR_R_DATA0 + 122, 32'hc0d57558);
- write_word(ADDR_R_DATA0 + 123, 32'he44cd754);
- write_word(ADDR_R_DATA0 + 124, 32'h424865c2);
- write_word(ADDR_R_DATA0 + 125, 32'h29c9e1ab);
- write_word(ADDR_R_DATA0 + 126, 32'hb28e003b);
- write_word(ADDR_R_DATA0 + 127, 32'h6819400b);
+
+ write_word(MEM_BASE + 0, 32'h4501c1ec);
+ write_word(MEM_BASE + 1, 32'hadc6b5e3);
+ write_word(MEM_BASE + 2, 32'hf1c23c29);
+ write_word(MEM_BASE + 3, 32'heca60890);
+ write_word(MEM_BASE + 4, 32'h5f9cabdd);
+ write_word(MEM_BASE + 5, 32'h46e34a55);
+ write_word(MEM_BASE + 6, 32'he1f7ac83);
+ write_word(MEM_BASE + 7, 32'h08e75c90);
+ write_word(MEM_BASE + 8, 32'h3675982b);
+ write_word(MEM_BASE + 9, 32'hda99173a);
+ write_word(MEM_BASE + 10, 32'h2ba57d2c);
+ write_word(MEM_BASE + 11, 32'hcf2e01a0);
+ write_word(MEM_BASE + 12, 32'h2589f89d);
+ write_word(MEM_BASE + 13, 32'hfd4b3c7f);
+ write_word(MEM_BASE + 14, 32'hd229ec91);
+ write_word(MEM_BASE + 15, 32'hc9d0c46e);
+ write_word(MEM_BASE + 16, 32'ha5dee3c0);
+ write_word(MEM_BASE + 17, 32'h48cd4611);
+ write_word(MEM_BASE + 18, 32'hbfeadc9b);
+ write_word(MEM_BASE + 19, 32'hf26daa1e);
+ write_word(MEM_BASE + 20, 32'h02cb72e2);
+ write_word(MEM_BASE + 21, 32'h22cf3dab);
+ write_word(MEM_BASE + 22, 32'h120dd1e8);
+ write_word(MEM_BASE + 23, 32'hc2dd9bd5);
+ write_word(MEM_BASE + 24, 32'h8bbefa5d);
+ write_word(MEM_BASE + 25, 32'h14526abd);
+ write_word(MEM_BASE + 26, 32'h1e8d2170);
+ write_word(MEM_BASE + 27, 32'ha6ba8283);
+ write_word(MEM_BASE + 28, 32'hc243ec2f);
+ write_word(MEM_BASE + 29, 32'hd5ef0703);
+ write_word(MEM_BASE + 30, 32'h0b1ef5f6);
+ write_word(MEM_BASE + 31, 32'h9f9620e4);
+ write_word(MEM_BASE + 32, 32'hb17a3639);
+ write_word(MEM_BASE + 33, 32'h34100588);
+ write_word(MEM_BASE + 34, 32'h7b9ffc79);
+ write_word(MEM_BASE + 35, 32'h35335947);
+ write_word(MEM_BASE + 36, 32'h03e5dcae);
+ write_word(MEM_BASE + 37, 32'h67bd0ce7);
+ write_word(MEM_BASE + 38, 32'ha3c98ca6);
+ write_word(MEM_BASE + 39, 32'h5815a4d0);
+ write_word(MEM_BASE + 40, 32'h67f27e6e);
+ write_word(MEM_BASE + 41, 32'h66d6636c);
+ write_word(MEM_BASE + 42, 32'hebb78973);
+ write_word(MEM_BASE + 43, 32'h2566a52a);
+ write_word(MEM_BASE + 44, 32'hc3970e14);
+ write_word(MEM_BASE + 45, 32'hc37310dc);
+ write_word(MEM_BASE + 46, 32'h2fcee0e7);
+ write_word(MEM_BASE + 47, 32'h39a16291);
+ write_word(MEM_BASE + 48, 32'h029fd2b4);
+ write_word(MEM_BASE + 49, 32'hd534e304);
+ write_word(MEM_BASE + 50, 32'h45474b26);
+ write_word(MEM_BASE + 51, 32'h711a8b3e);
+ write_word(MEM_BASE + 52, 32'h1ee3cc88);
+ write_word(MEM_BASE + 53, 32'hb09e8b17);
+ write_word(MEM_BASE + 54, 32'h45b6cc0f);
+ write_word(MEM_BASE + 55, 32'h067624ec);
+ write_word(MEM_BASE + 56, 32'hb232db75);
+ write_word(MEM_BASE + 57, 32'h0b01fe54);
+ write_word(MEM_BASE + 58, 32'h57fdea77);
+ write_word(MEM_BASE + 59, 32'hb251b10f);
+ write_word(MEM_BASE + 60, 32'he95d3eee);
+ write_word(MEM_BASE + 61, 32'hdb083bdf);
+ write_word(MEM_BASE + 62, 32'h109c41db);
+ write_word(MEM_BASE + 63, 32'ha26cc965);
+ write_word(MEM_BASE + 64, 32'h4f787bf9);
+ write_word(MEM_BASE + 65, 32'h5735ff07);
+ write_word(MEM_BASE + 66, 32'h070b175c);
+ write_word(MEM_BASE + 67, 32'hea8b6230);
+ write_word(MEM_BASE + 68, 32'h2e6087b9);
+ write_word(MEM_BASE + 69, 32'h1a041547);
+ write_word(MEM_BASE + 70, 32'h46056910);
+ write_word(MEM_BASE + 71, 32'h99f1a9e2);
+ write_word(MEM_BASE + 72, 32'hb626c4b3);
+ write_word(MEM_BASE + 73, 32'hbb7aeb8e);
+ write_word(MEM_BASE + 74, 32'had9922bc);
+ write_word(MEM_BASE + 75, 32'h3617cb42);
+ write_word(MEM_BASE + 76, 32'h7c669b88);
+ write_word(MEM_BASE + 77, 32'hbe5f98ae);
+ write_word(MEM_BASE + 78, 32'ha7edb8b0);
+ write_word(MEM_BASE + 79, 32'h063bec80);
+ write_word(MEM_BASE + 80, 32'haf4c081f);
+ write_word(MEM_BASE + 81, 32'h89778d7c);
+ write_word(MEM_BASE + 82, 32'h7242ddae);
+ write_word(MEM_BASE + 83, 32'h88e8d3af);
+ write_word(MEM_BASE + 84, 32'hf1f80e57);
+ write_word(MEM_BASE + 85, 32'h5e1aab4a);
+ write_word(MEM_BASE + 86, 32'h5d115bc2);
+ write_word(MEM_BASE + 87, 32'h7636fd14);
+ write_word(MEM_BASE + 88, 32'hd19bc594);
+ write_word(MEM_BASE + 89, 32'h33f69763);
+ write_word(MEM_BASE + 90, 32'h5ecd870d);
+ write_word(MEM_BASE + 91, 32'h17e7f5b0);
+ write_word(MEM_BASE + 92, 32'h04dee400);
+ write_word(MEM_BASE + 93, 32'h1cddc34a);
+ write_word(MEM_BASE + 94, 32'hb6e377ee);
+ write_word(MEM_BASE + 95, 32'hb3fb08e9);
+ write_word(MEM_BASE + 96, 32'h47697076);
+ write_word(MEM_BASE + 97, 32'h5105d93e);
+ write_word(MEM_BASE + 98, 32'h4558fe3d);
+ write_word(MEM_BASE + 99, 32'h4fc6fe05);
+ write_word(MEM_BASE + 100, 32'h3aab9c6c);
+ write_word(MEM_BASE + 101, 32'hf032f111);
+ write_word(MEM_BASE + 102, 32'h6e70c2d6);
+ write_word(MEM_BASE + 103, 32'h5f7c8cde);
+ write_word(MEM_BASE + 104, 32'hb6ad63ac);
+ write_word(MEM_BASE + 105, 32'h4291f93d);
+ write_word(MEM_BASE + 106, 32'h467ebbb2);
+ write_word(MEM_BASE + 107, 32'h9ead265c);
+ write_word(MEM_BASE + 108, 32'h05ac684d);
+ write_word(MEM_BASE + 109, 32'h20a6bef0);
+ write_word(MEM_BASE + 110, 32'h9b71830f);
+ write_word(MEM_BASE + 111, 32'h717e08bc);
+ write_word(MEM_BASE + 112, 32'hb4f9d377);
+ write_word(MEM_BASE + 113, 32'h3bec928f);
+ write_word(MEM_BASE + 114, 32'h66eeb64d);
+ write_word(MEM_BASE + 115, 32'hc451e958);
+ write_word(MEM_BASE + 116, 32'he357ebbf);
+ write_word(MEM_BASE + 117, 32'hef5a342d);
+ write_word(MEM_BASE + 118, 32'hf28707ac);
+ write_word(MEM_BASE + 119, 32'h4b8e3e8c);
+ write_word(MEM_BASE + 120, 32'h854e8d69);
+ write_word(MEM_BASE + 121, 32'h1cb92e87);
+ write_word(MEM_BASE + 122, 32'hc0d57558);
+ write_word(MEM_BASE + 123, 32'he44cd754);
+ write_word(MEM_BASE + 124, 32'h424865c2);
+ write_word(MEM_BASE + 125, 32'h29c9e1ab);
+ write_word(MEM_BASE + 126, 32'hb28e003b);
+ write_word(MEM_BASE + 127, 32'h6819400b);
// Write magic words to A.
write_word(ADDR_A0, 32'haea19443);