sld-columbia / esp

Embedded Scalable Platforms: Heterogeneous SoC architecture and IP integration made easy
Other
326 stars 105 forks source link

xcelium ariane patch failed #111

Closed wohlbier closed 3 years ago

wohlbier commented 3 years ago

Hi, Applying the xcelium ariane patch fails for me. See below.

-bash-4.2$ ls
ariane.core   CONTRIBUTING.md  LICENSE.Berkeley  src
Bender.yml    docs             LICENSE.SiFive    src_files.yml
bootrom       Flist.ariane     Makefile          tb
CHANGELOG.md  fpga             openpiton         xcelium_ariane.patch
ci            include          README.md
CODEOWNERS    LICENSE          scripts
-bash-4.2$ ls src/ariane.sv
src/ariane.sv
-bash-4.2$ patch -p1 < xcelium_ariane.patch 
patching file src/ariane.sv
Hunk #1 FAILED at 749.
1 out of 1 hunk FAILED -- saving rejects to file src/ariane.sv.rej
-bash-4.2$ cat src/ariane.sv.rej 
--- src/ariane.sv
+++ src/ariane.sv
@@ -749,48 +749,48 @@
 // mock tracer for Verilator, to be used with spike-dasm
  `else

-  int f;
-  logic [63:0] cycles;
-
-  initial begin
-    f = $fopen("trace_hart_00.dasm", "w");
-  end
-
-  always_ff @(posedge clk_i or negedge rst_ni) begin
-    if (~rst_ni) begin
-      cycles <= 0;
-    end else begin
-      string mode = "";
-      if (debug_mode) mode = "D";
-      else begin
-        case (priv_lvl)
-        riscv::PRIV_LVL_M: mode = "M";
-        riscv::PRIV_LVL_S: mode = "S";
-        riscv::PRIV_LVL_U: mode = "U";
-        endcase
-      end
-      for (int i = 0; i < NR_COMMIT_PORTS; i++) begin
-        if (commit_ack[i] && !commit_instr_id_commit[i].ex.valid) begin
-          $fwrite(f, "%d 0x%0h %s (0x%h) DASM(%h)\n", cycles, commit_instr_id_commit[i].pc, mode, commit_instr_id_commit[i].ex.tval[31:0], commit_instr_id_commit[i].ex.tval[31:0]);
-        end else if (commit_ack[i] && commit_instr_id_commit[i].ex.valid) begin
-          if (commit_instr_id_commit[i].ex.cause == 2) begin
-            $fwrite(f, "Exception Cause: Illegal Instructions, DASM(%h) PC=%h\n", commit_instr_id_commit[i].ex.tval[31:0], commit_instr_id_commit[i].pc);
-          end else begin
-            if (debug_mode) begin
-              $fwrite(f, "%d 0x%0h %s (0x%h) DASM(%h)\n", cycles, commit_instr_id_commit[i].pc, mode, commit_instr_id_commit[i].ex.tval[31:0], commit_instr_id_commit[i].ex.tval[31:0]);
-            end else begin
-              $fwrite(f, "Exception Cause: %5d, DASM(%h) PC=%h\n", commit_instr_id_commit[i].ex.cause, commit_instr_id_commit[i].ex.tval[31:0], commit_instr_id_commit[i].pc);
-            end
-          end
-        end
-      end
-        cycles <= cycles + 1;
-    end
-  end
-
-  final begin
-    $fclose(f);
-  end
+  // int f;
+  // logic [63:0] cycles;
+
+  // initial begin
+  //   f = $fopen("trace_hart_00.dasm", "w");
+  // end
+
+  // always_ff @(posedge clk_i or negedge rst_ni) begin
+  //   if (~rst_ni) begin
+  //     cycles <= 0;
+  //   end else begin
+  //      static string mode = "";
+  //     if (debug_mode) mode = "D";
+  //     else begin
+  //       case (priv_lvl)
+  //         riscv::PRIV_LVL_M: mode = "M";
+  //         riscv::PRIV_LVL_S: mode = "S";
+  //         riscv::PRIV_LVL_U: mode = "U";
+  //       endcase
+  //     end
+  //     for (int i = 0; i < NR_COMMIT_PORTS; i++) begin
+  //       if (commit_ack[i] && !commit_instr_id_commit[i].ex.valid) begin
+  //         $fwrite(f, "%d 0x%0h %s (0x%h) DASM(%h)\n", cycles, commit_instr_id_commit[i].pc, mode, commit_instr_id_commit[i].ex.tval[31:0], commit_instr_id_commit[i].ex.tval[31:0]);
+  //       end else if (commit_ack[i] && commit_instr_id_commit[i].ex.valid) begin
+  //         if (commit_instr_id_commit[i].ex.cause == 2) begin
+  //           $fwrite(f, "Exception Cause: Illegal Instructions, DASM(%h) PC=%h\n", commit_instr_id_commit[i].ex.tval[31:0], commit_instr_id_commit[i].pc);
+  //         end else begin
+  //           if (debug_mode) begin
+  //             $fwrite(f, "%d 0x%0h %s (0x%h) DASM(%h)\n", cycles, commit_instr_id_commit[i].pc, mode, commit_instr_id_commit[i].ex.tval[31:0], commit_instr_id_commit[i].ex.tval[31:0]);
+  //           end else begin
+  //             $fwrite(f, "Exception Cause: %5d, DASM(%h) PC=%h\n", commit_instr_id_commit[i].ex.cause, commit_instr_id_commit[i].ex.tval[31:0], commit_instr_id_commit[i].pc);
+  //           end
+  //         end
+  //       end
+  //     end
+  //       cycles <= cycles + 1;
+  //   end
+  // end
+
+  // final begin
+  //   $fclose(f);
+  // end
 `endif // VERILATOR
  //pragma translate_on
paulmnt commented 3 years ago

Hi @wohlbier

thank you for writing. I think that some update in Ariane's submodule resulted in this patch not being directly applicable with git apply. I've just updated the patch on the ESP website here. Please make sure you refresh the page with F5 or equivalent command, or you may get the cached outdated version from the browser.

Also, since you are simulating with Xcelium, make sure you apply the simple fix in this issue as well. This fix will be included in the next release.

Please let us know if this works for you! Thank you.