Added test for personalization string
This commit is contained in:
parent
149074bde6
commit
9d7cdac233
|
@ -57,7 +57,7 @@ logic [NUM_PIPE-1:0][MSG_LEN*8-1:0] msg;
|
||||||
logic [MSG_LEN*8-1:0] msg_fixed;
|
logic [MSG_LEN*8-1:0] msg_fixed;
|
||||||
logic [7:0] byte_len;
|
logic [7:0] byte_len;
|
||||||
logic [NUM_PIPE-1:0][CTL_BITS-1:0] ctl;
|
logic [NUM_PIPE-1:0][CTL_BITS-1:0] ctl;
|
||||||
logic [NUM_PIPE-1:0] eop_l, sop_l, valid;
|
logic [NUM_PIPE-1:0] valid;
|
||||||
|
|
||||||
generate
|
generate
|
||||||
genvar g0, g1, g2, g3;
|
genvar g0, g1, g2, g3;
|
||||||
|
|
|
@ -147,6 +147,31 @@ begin
|
||||||
end
|
end
|
||||||
endtask
|
endtask
|
||||||
|
|
||||||
|
// This is a test for hashing 144 bytes plus using personal string and encoding digest length
|
||||||
|
task test_144_encode_len_person_bytes();
|
||||||
|
begin
|
||||||
|
integer signed get_len;
|
||||||
|
// 50 bytes needed for Equihash (n=200, k=9)
|
||||||
|
logic [7:0] digest_len = 'd50;
|
||||||
|
logic [127:0] POW_TAG = {32'd9, 32'd200, "WoPhsacZ"}; // ZcashPoW is reversed here
|
||||||
|
logic [common_pkg::MAX_SIM_BYTS*8-1:0] get_dat, in_dat;
|
||||||
|
$display("Running test_144_encode_len_person_bytes...");
|
||||||
|
expected = 'ha6e2f3b234b93dab4c9a246731f31b6215dda0a3cc548c5443b3dbaa0b452265f5d0eb8ca4d7a31747967f8ecc1f0f8b021a;
|
||||||
|
in_dat = 'h000009df030000000000000000000000000000000000000000000000000001a450b5b21b1e03c3bf5813853f0000000000000000000000000000000000000000000000000000000000000000508093fb69a9d9cdf502cc6432d3c2b8bcf81d239e6b3bd59d34122355311630000000488f10fdd62f4d7868c6c21c628bc3d5dfa0f32ff719425110a4d1d61300000004;
|
||||||
|
|
||||||
|
i_byte_len = 144;
|
||||||
|
parameters = {32'd0, 8'd1, 8'd1, 8'd0, digest_len};
|
||||||
|
parameters[48*8 +: 16*8] = POW_TAG;
|
||||||
|
|
||||||
|
i_block.put_stream(in_dat, i_byte_len);
|
||||||
|
out_hash.get_stream(get_dat, get_len);
|
||||||
|
// Zero out bytes above digest length
|
||||||
|
for (int i = digest_len; i < common_pkg::MAX_SIM_BYTS; i++) get_dat[i*8 +: 8] = 0;
|
||||||
|
common_pkg::compare_and_print(get_dat, expected);
|
||||||
|
$display("test_144_encode_len_person_bytes PASSED");
|
||||||
|
end
|
||||||
|
endtask
|
||||||
|
|
||||||
// Main testbench calls
|
// Main testbench calls
|
||||||
initial begin
|
initial begin
|
||||||
i_block.reset_source();
|
i_block.reset_source();
|
||||||
|
@ -159,6 +184,7 @@ initial begin
|
||||||
test_128_bytes();
|
test_128_bytes();
|
||||||
test_129_bytes();
|
test_129_bytes();
|
||||||
test_140_bytes();
|
test_140_bytes();
|
||||||
|
test_144_encode_len_person_bytes();
|
||||||
|
|
||||||
#10us $finish();
|
#10us $finish();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue