rvfi_tracer.sv: Terminate tests on write-into-tohost iso. ECALL instruction. (#1075)

* Enable Spike-style test termination on write-to-TOHOST.

Get the address of TOHOST from the cmdline plus-arg 'tohost_addr'.  If the
arg was not supplied, try to extract it from the preloaded ELF file if
given.

Retain termination on ECALL as a safeguard.

Signed-off-by: Zbigniew Chamski <zbigniew.chamski@thalesgroup.com>

* [test termination] Supply tohost addr only as plusarg.  Clean up code.

* corev_apu/tb/dpi/SimDTM.cc: Remove DPI changes.
* corev_apu/tb/dpi/elfload.cc: Ditto.
* corev_apu/tb/rvfi_tracer.sv: Remove DPI dependencies.  Remove termination
  on ECALL.  Do not guess the address of 'tohost' from the ELF file.
  Uniformize message formats.  Remove excess comments.

Signed-off-by: Zbigniew Chamski <zbigniew.chamski@thalesgroup.com>

* rvfi_tracer.sv: Reduce changes in whitespace wrt. master branch.

Signed-off-by: Zbigniew Chamski <zbigniew.chamski@thalesgroup.com>

* [test termination] When checking for 'tohost', compare only phy address.

* rvfi_tracer.sv: Remove info messages relative to tohost termination.

---------

Signed-off-by: Zbigniew Chamski <zbigniew.chamski@thalesgroup.com>
This commit is contained in:
Zbigniew Chamski 2023-03-03 16:31:30 +01:00 committed by GitHub
parent 692125cd62
commit e5ae205fc9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,11 +18,17 @@ module rvfi_tracer #(
input rvfi_pkg::rvfi_instr_t[NR_COMMIT_PORTS-1:0] rvfi_i
);
logic[riscv::XLEN-1:0] TOHOST_ADDR;
int f;
int unsigned SIM_FINISH;
initial begin
f = $fopen($sformatf("trace_rvfi_hart_%h.dasm", HART_ID), "w");
if (!$value$plusargs("time_out=%d", SIM_FINISH)) SIM_FINISH = 2000000;
if (!$value$plusargs("tohost_addr=%h", TOHOST_ADDR)) TOHOST_ADDR = '0;
if (TOHOST_ADDR == '0) begin
$display("*** [rvf_tracer] WARNING: No valid address of 'tohost' (tohost == 0x%h), termination possible only by timeout or Ctrl-C!\n", TOHOST_ADDR);
$fwrite(f, "*** [rvfi_tracer] WARNING No valid address of 'tohost' (tohost == 0x%h), termination possible only by timeout or Ctrl-C!\n", TOHOST_ADDR);
end
end
final $fclose(f);
@ -68,13 +74,15 @@ module rvfi_tracer #(
end else begin
if (rvfi_i[i].mem_wmask != 0) begin
$fwrite(f, " mem 0x%h 0x%h", rvfi_i[i].mem_addr, rvfi_i[i].mem_wdata);
if (TOHOST_ADDR != '0 &&
rvfi_i[i].mem_paddr == TOHOST_ADDR &&
rvfi_i[i].mem_wdata[0] == 1'b1) begin
$finish(1);
$finish(1);
end
end
end
$fwrite(f, "\n");
if (rvfi_i[i].insn == 32'h00000073) begin
$finish(1);
$finish(1);
end
end else begin
if (rvfi_i[i].trap) begin
case (rvfi_i[i].cause)