[otbn] Output bignum registers from verilator sim

Signed-off-by: Greg Chadwick <gac@lowrisc.org>
diff --git a/hw/ip/otbn/dv/verilator/otbn_top_sim.cc b/hw/ip/otbn/dv/verilator/otbn_top_sim.cc
index 2b574d3..75698af 100644
--- a/hw/ip/otbn/dv/verilator/otbn_top_sim.cc
+++ b/hw/ip/otbn/dv/verilator/otbn_top_sim.cc
@@ -13,6 +13,7 @@
 
 extern "C" {
 extern unsigned int otbn_base_reg_get(int index);
+extern unsigned int otbn_bignum_reg_get(int index, int quarter);
 }
 
 int main(int argc, char **argv) {
@@ -50,13 +51,51 @@
   }
 
   svSetScope(svGetScopeFromName("TOP.otbn_top_sim"));
-  std::cout << "Final Register Values:" << std::endl;
+  std::cout << "Final Base Register Values:" << std::endl;
   std::cout << "Reg | Value" << std::endl;
   std::cout << "----------------" << std::endl;
   for (int i = 1; i < 32; ++i) {
-    std::cout << std::dec << std::setw(2) << std::setfill(' ') << i << "  | 0x"
-              << std::hex << std::setw(8) << std::setfill('0')
-              << otbn_base_reg_get(i) << std::endl;
+    std::cout << "x" << std::left << std::dec << std::setw(2)
+              << std::setfill(' ') << i << " | 0x" << std::hex << std::setw(8)
+              << std::setfill('0') << std::right << otbn_base_reg_get(i)
+              << std::endl;
+  }
+
+  std::cout << std::endl;
+
+  std::cout << "Final Bignum Register Values:" << std::endl;
+  std::cout << "Reg | Value" << std::endl;
+  std::cout << "---------------------------------------------------------------"
+               "----------------"
+            << std::endl;
+
+  for (int i = 0; i < 32; ++i) {
+    std::cout << "w" << std::left << std::dec << std::setw(2)
+              << std::setfill(' ') << i << " | 0x" << std::hex;
+
+    std::cout << std::setw(8) << std::setfill('0') << std::right
+              << otbn_bignum_reg_get(i, 7) << "_";
+
+    std::cout << std::setw(8) << std::setfill('0') << otbn_bignum_reg_get(i, 6)
+              << "_";
+
+    std::cout << std::setw(8) << std::setfill('0') << otbn_bignum_reg_get(i, 5)
+              << "_";
+
+    std::cout << std::setw(8) << std::setfill('0') << otbn_bignum_reg_get(i, 4)
+              << "_";
+
+    std::cout << std::setw(8) << std::setfill('0') << otbn_bignum_reg_get(i, 3)
+              << "_";
+
+    std::cout << std::setw(8) << std::setfill('0') << otbn_bignum_reg_get(i, 2)
+              << "_";
+
+    std::cout << std::setw(8) << std::setfill('0') << otbn_bignum_reg_get(i, 1)
+              << "_";
+
+    std::cout << std::setw(8) << std::setfill('0') << otbn_bignum_reg_get(i, 0)
+              << std::endl;
   }
 
   return 0;
diff --git a/hw/ip/otbn/dv/verilator/otbn_top_sim.sv b/hw/ip/otbn/dv/verilator/otbn_top_sim.sv
index 0ef99b9..22ae55e 100644
--- a/hw/ip/otbn/dv/verilator/otbn_top_sim.sv
+++ b/hw/ip/otbn/dv/verilator/otbn_top_sim.sv
@@ -168,6 +168,12 @@
     return u_otbn_core.u_otbn_rf_base.rf_reg[index];
   endfunction
 
+  export "DPI-C" function otbn_bignum_reg_get;
+
+  function automatic int unsigned otbn_bignum_reg_get(int index, int word);
+    return u_otbn_core.u_otbn_rf_bignum.rf[index][word*32+:32];
+  endfunction
+
   // The model
   //
   // This runs in parallel with the real core above. Eventually, we'll have strong consistency
@@ -204,5 +210,4 @@
       end
     end
   end
-
 endmodule