[dv/hmac] support new msg_len

Add check msg length before hash_trigger

Signed-off-by: Cindy Chen <chencindy@google.com>
diff --git a/hw/ip/hmac/dv/env/hmac_scoreboard.sv b/hw/ip/hmac/dv/env/hmac_scoreboard.sv
index c079ce9..af5cca4 100644
--- a/hw/ip/hmac/dv/env/hmac_scoreboard.sv
+++ b/hw/ip/hmac/dv/env/hmac_scoreboard.sv
@@ -65,6 +65,7 @@
             end
           end
           foreach (msg[i]) msg_q.push_back(msg[i]);
+          update_wr_msg_length(msg_q.size());
         end
       end else begin
         case (csr_name)
@@ -74,10 +75,10 @@
               if (hmac_process) begin
                 // check if msg all streamed in, could happen during wr msg or trigger process
                 predict_digest(msg_q);
-                update_wr_msg_length(msg_q.size());
                 msg_q.delete();
               end else if (hmac_start) begin
                 msg_q.delete(); // make sure did not include previous msg
+                update_wr_msg_length(msg_q.size());
               end
             end else if (item.a_data[HashStart] == 1) begin
               void'(ral.intr_state.hmac_err.predict(.value(1), .kind(UVM_PREDICT_DIRECT)));
diff --git a/hw/ip/hmac/dv/env/seq_lib/hmac_base_vseq.sv b/hw/ip/hmac/dv/env/seq_lib/hmac_base_vseq.sv
index 532ebeb..ac54d65 100644
--- a/hw/ip/hmac/dv/env/seq_lib/hmac_base_vseq.sv
+++ b/hw/ip/hmac/dv/env/seq_lib/hmac_base_vseq.sv
@@ -228,6 +228,7 @@
     end
     // ensure all msg fifo are written before trigger hmac_process
     csr_utils_pkg::wait_no_outstanding_access();
+    if ($urandom_range(0, 1)) rd_msg_length();
   endtask
 
   // read fifo_depth reg and burst write a chunk of words
@@ -260,6 +261,7 @@
         break;
       end
     csr_utils_pkg::wait_no_outstanding_access();
+    if ($urandom_range(0, 1)) rd_msg_length();
     end
   endtask
 
diff --git a/hw/ip/hmac/dv/env/seq_lib/hmac_sanity_vseq.sv b/hw/ip/hmac/dv/env/seq_lib/hmac_sanity_vseq.sv
index 5731b6e..e3ceda7 100644
--- a/hw/ip/hmac/dv/env/seq_lib/hmac_sanity_vseq.sv
+++ b/hw/ip/hmac/dv/env/seq_lib/hmac_sanity_vseq.sv
@@ -106,9 +106,10 @@
         end
       end
 
+
       // if disable sha, digest should be cleared
       // read msg fifo length
-      rd_msg_length();
+      if ($urandom_range(0, 1)) rd_msg_length();
 
       // read digest from DUT
       rd_digest();