Skip to content

Commit

Permalink
[MemPool-Spatz][Bug Fix]
Browse files Browse the repository at this point in the history
1. Fix a bug in decoding `VFMV_F_S` command.
2. Remove the performance tracer for Spatz in `spatz_mempool_cc.sv` because of the inaccuarcy in current version.
  • Loading branch information
msc23h24 Diyou Shen (dishen) authored and Mattia Sinigaglia committed Jan 31, 2024
1 parent c10e5a7 commit 9d3de99
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 41 deletions.
2 changes: 2 additions & 0 deletions hw/ip/spatz/src/spatz_decoder.sv
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,8 @@ module spatz_decoder
spatz_req.vs2 = arith_s2;
spatz_req.use_vs2 = 1'b1;
spatz_req.op_arith.is_scalar = 1'b1;
// Keep default value (EW_8) if max element length is not 32 bit
spatz_req.vtype.vsew = (ELEN == 32) ? EW_32 : EW_8;
end
end

Expand Down
43 changes: 2 additions & 41 deletions hw/ip/spatz_cc/src/spatz_mempool_cc.sv
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,8 @@ module spatz_mempool_cc
// pragma translate_off
int f;
string fn;
logic [63:0] cycle, spatz_running;
logic [63:0] cycle;
int unsigned stall, stall_ins, stall_raw, stall_lsu, stall_acc;
// spatz stall signals
int unsigned stall_totacc, stall_vfu, stall_vlsu, stall_vsldu;

always_ff @(posedge rst_i) begin
if(rst_i) begin
Expand All @@ -407,8 +405,7 @@ module spatz_mempool_cc
// Tracing enabled by CSR register
// we are not stalled <==> we have issued and processed an instruction (including offloads)
// OR we are retiring (issuing a writeback from) a load or accelerator instruction
if ((i_snitch.csr_trace_q || SnitchTrace) && (!i_snitch.stall || i_snitch.retire_load || i_snitch.retire_acc ||
!i_spatz.i_controller.stall)) begin
if ((i_snitch.csr_trace_q || SnitchTrace) && (!i_snitch.stall || i_snitch.retire_load || i_snitch.retire_acc)) begin
// Manual loop unrolling for Verilator
// Data type keys for arrays are currently not supported in Verilator
extras_str = "{";

Check warning on line 411 in hw/ip/spatz_cc/src/spatz_mempool_cc.sv

View workflow job for this annotation

GitHub Actions / verible-verilog-lint

[verible-verilog-lint] hw/ip/spatz_cc/src/spatz_mempool_cc.sv#L411

Use blocking assignments, at most, for locals inside 'always_ff' sequential blocks. [Style: sequential-logic] [always-ff-non-blocking]
Raw output
message:"Use blocking assignments, at most, for locals inside 'always_ff' sequential blocks. [Style: sequential-logic] [always-ff-non-blocking]" location:{path:"hw/ip/spatz_cc/src/spatz_mempool_cc.sv" range:{start:{line:411 column:11}}} severity:WARNING source:{name:"verible-verilog-lint" url:"https://github.com/chipsalliance/verible"}
Expand Down Expand Up @@ -440,7 +437,6 @@ module spatz_mempool_cc
extras_str = $sformatf("%s'%s': 0x%8x, ", extras_str, "writeback", i_snitch.alu_writeback);

Check warning on line 437 in hw/ip/spatz_cc/src/spatz_mempool_cc.sv

View workflow job for this annotation

GitHub Actions / verible-verilog-lint

[verible-verilog-lint] hw/ip/spatz_cc/src/spatz_mempool_cc.sv#L437

Use blocking assignments, at most, for locals inside 'always_ff' sequential blocks. [Style: sequential-logic] [always-ff-non-blocking]
Raw output
message:"Use blocking assignments, at most, for locals inside 'always_ff' sequential blocks. [Style: sequential-logic] [always-ff-non-blocking]" location:{path:"hw/ip/spatz_cc/src/spatz_mempool_cc.sv" range:{start:{line:437 column:11}}} severity:WARNING source:{name:"verible-verilog-lint" url:"https://github.com/chipsalliance/verible"}
// Load/Store
extras_str = $sformatf("%s'%s': 0x%8x, ", extras_str, "gpr_rdata_1", i_snitch.gpr_rdata[1]);

Check warning on line 439 in hw/ip/spatz_cc/src/spatz_mempool_cc.sv

View workflow job for this annotation

GitHub Actions / verible-verilog-lint

[verible-verilog-lint] hw/ip/spatz_cc/src/spatz_mempool_cc.sv#L439

Use blocking assignments, at most, for locals inside 'always_ff' sequential blocks. [Style: sequential-logic] [always-ff-non-blocking]
Raw output
message:"Use blocking assignments, at most, for locals inside 'always_ff' sequential blocks. [Style: sequential-logic] [always-ff-non-blocking]" location:{path:"hw/ip/spatz_cc/src/spatz_mempool_cc.sv" range:{start:{line:439 column:11}}} severity:WARNING source:{name:"verible-verilog-lint" url:"https://github.com/chipsalliance/verible"}
// extras_str = $sformatf("%s'%s': 0x%8x, ", extras_str, "gpr_rdata_2", i_snitch.gpr_rdata[2]);
extras_str = $sformatf("%s'%s': 0x%1x, ", extras_str, "ls_size", i_snitch.ls_size);

Check warning on line 440 in hw/ip/spatz_cc/src/spatz_mempool_cc.sv

View workflow job for this annotation

GitHub Actions / verible-verilog-lint

[verible-verilog-lint] hw/ip/spatz_cc/src/spatz_mempool_cc.sv#L440

Use blocking assignments, at most, for locals inside 'always_ff' sequential blocks. [Style: sequential-logic] [always-ff-non-blocking]
Raw output
message:"Use blocking assignments, at most, for locals inside 'always_ff' sequential blocks. [Style: sequential-logic] [always-ff-non-blocking]" location:{path:"hw/ip/spatz_cc/src/spatz_mempool_cc.sv" range:{start:{line:440 column:11}}} severity:WARNING source:{name:"verible-verilog-lint" url:"https://github.com/chipsalliance/verible"}
extras_str = $sformatf("%s'%s': 0x%8x, ", extras_str, "ld_result_32",i_snitch.ld_result[31:0]);

Check warning on line 441 in hw/ip/spatz_cc/src/spatz_mempool_cc.sv

View workflow job for this annotation

GitHub Actions / verible-verilog-lint

[verible-verilog-lint] hw/ip/spatz_cc/src/spatz_mempool_cc.sv#L441

Use blocking assignments, at most, for locals inside 'always_ff' sequential blocks. [Style: sequential-logic] [always-ff-non-blocking]
Raw output
message:"Use blocking assignments, at most, for locals inside 'always_ff' sequential blocks. [Style: sequential-logic] [always-ff-non-blocking]" location:{path:"hw/ip/spatz_cc/src/spatz_mempool_cc.sv" range:{start:{line:441 column:11}}} severity:WARNING source:{name:"verible-verilog-lint" url:"https://github.com/chipsalliance/verible"}
extras_str = $sformatf("%s'%s': 0x%2x, ", extras_str, "lsu_rd", i_snitch.lsu_rd);

Check warning on line 442 in hw/ip/spatz_cc/src/spatz_mempool_cc.sv

View workflow job for this annotation

GitHub Actions / verible-verilog-lint

[verible-verilog-lint] hw/ip/spatz_cc/src/spatz_mempool_cc.sv#L442

Use blocking assignments, at most, for locals inside 'always_ff' sequential blocks. [Style: sequential-logic] [always-ff-non-blocking]
Raw output
message:"Use blocking assignments, at most, for locals inside 'always_ff' sequential blocks. [Style: sequential-logic] [always-ff-non-blocking]" location:{path:"hw/ip/spatz_cc/src/spatz_mempool_cc.sv" range:{start:{line:442 column:11}}} severity:WARNING source:{name:"verible-verilog-lint" url:"https://github.com/chipsalliance/verible"}
Expand All @@ -452,13 +448,6 @@ module spatz_mempool_cc
extras_str = $sformatf("%s'%s': 0x%1x, ", extras_str, "retire_acc", i_snitch.retire_acc);

Check warning on line 448 in hw/ip/spatz_cc/src/spatz_mempool_cc.sv

View workflow job for this annotation

GitHub Actions / verible-verilog-lint

[verible-verilog-lint] hw/ip/spatz_cc/src/spatz_mempool_cc.sv#L448

Use blocking assignments, at most, for locals inside 'always_ff' sequential blocks. [Style: sequential-logic] [always-ff-non-blocking]
Raw output
message:"Use blocking assignments, at most, for locals inside 'always_ff' sequential blocks. [Style: sequential-logic] [always-ff-non-blocking]" location:{path:"hw/ip/spatz_cc/src/spatz_mempool_cc.sv" range:{start:{line:448 column:11}}} severity:WARNING source:{name:"verible-verilog-lint" url:"https://github.com/chipsalliance/verible"}
extras_str = $sformatf("%s'%s': 0x%2x, ", extras_str, "acc_pid", i_snitch.acc_pid_i);

Check warning on line 449 in hw/ip/spatz_cc/src/spatz_mempool_cc.sv

View workflow job for this annotation

GitHub Actions / verible-verilog-lint

[verible-verilog-lint] hw/ip/spatz_cc/src/spatz_mempool_cc.sv#L449

Use blocking assignments, at most, for locals inside 'always_ff' sequential blocks. [Style: sequential-logic] [always-ff-non-blocking]
Raw output
message:"Use blocking assignments, at most, for locals inside 'always_ff' sequential blocks. [Style: sequential-logic] [always-ff-non-blocking]" location:{path:"hw/ip/spatz_cc/src/spatz_mempool_cc.sv" range:{start:{line:449 column:11}}} severity:WARNING source:{name:"verible-verilog-lint" url:"https://github.com/chipsalliance/verible"}
extras_str = $sformatf("%s'%s': 0x%8x, ", extras_str, "acc_pdata_32",i_snitch.acc_pdata_i[31:0]);

Check warning on line 450 in hw/ip/spatz_cc/src/spatz_mempool_cc.sv

View workflow job for this annotation

GitHub Actions / verible-verilog-lint

[verible-verilog-lint] hw/ip/spatz_cc/src/spatz_mempool_cc.sv#L450

Use blocking assignments, at most, for locals inside 'always_ff' sequential blocks. [Style: sequential-logic] [always-ff-non-blocking]
Raw output
message:"Use blocking assignments, at most, for locals inside 'always_ff' sequential blocks. [Style: sequential-logic] [always-ff-non-blocking]" location:{path:"hw/ip/spatz_cc/src/spatz_mempool_cc.sv" range:{start:{line:450 column:11}}} severity:WARNING source:{name:"verible-verilog-lint" url:"https://github.com/chipsalliance/verible"}
// Spatz Stall
extras_str = $sformatf("%s'%s': 0x%1x, ", extras_str, "stall_spatz", i_spatz.i_controller.stall);
extras_str = $sformatf("%s'%s': 0x%8x, ", extras_str, "stall_totacc",stall_totacc);
extras_str = $sformatf("%s'%s': 0x%8x, ", extras_str, "stall_vfu", stall_vfu);
extras_str = $sformatf("%s'%s': 0x%8x, ", extras_str, "stall_vlsu", stall_vlsu);
extras_str = $sformatf("%s'%s': 0x%8x, ", extras_str, "stall_vsldu", stall_vsldu);
extras_str = $sformatf("%s'%s': 0x%8x ", extras_str, "spatz_active",spatz_running);
extras_str = $sformatf("%s}", extras_str);

Check warning on line 451 in hw/ip/spatz_cc/src/spatz_mempool_cc.sv

View workflow job for this annotation

GitHub Actions / verible-verilog-lint

[verible-verilog-lint] hw/ip/spatz_cc/src/spatz_mempool_cc.sv#L451

Use blocking assignments, at most, for locals inside 'always_ff' sequential blocks. [Style: sequential-logic] [always-ff-non-blocking]
Raw output
message:"Use blocking assignments, at most, for locals inside 'always_ff' sequential blocks. [Style: sequential-logic] [always-ff-non-blocking]" location:{path:"hw/ip/spatz_cc/src/spatz_mempool_cc.sv" range:{start:{line:451 column:11}}} severity:WARNING source:{name:"verible-verilog-lint" url:"https://github.com/chipsalliance/verible"}

$timeformat(-9, 0, "", 10);
Expand Down Expand Up @@ -492,41 +481,13 @@ module spatz_mempool_cc
stall_acc <= stall_acc + 1;
end
end

if (!i_spatz.i_controller.stall) begin
stall_totacc <= 0;
stall_vfu <= 0;
stall_vlsu <= 0;
stall_vsldu <= 0;
end else begin
if (i_spatz.i_controller.stall) begin
stall_totacc <= stall_totacc + 1;
end
if (i_spatz.i_controller.vfu_stall) begin
stall_vfu <= stall_vfu + 1;
end
if (i_spatz.i_controller.vlsu_stall) begin
stall_vlsu <= stall_vlsu + 1;
end
if (i_spatz.i_controller.vsldu_stall) begin
stall_vsldu <= stall_vsldu + 1;
end
end
if (acc_req_rsp.isfloat) begin
spatz_running <= spatz_running + 1;
end
end else begin
cycle <= '0;
spatz_running <= '0;
stall <= 0;
stall_ins <= 0;
stall_raw <= 0;
stall_lsu <= 0;
stall_acc <= 0;
stall_totacc <= 0;
stall_vfu <= 0;
stall_vlsu <= 0;
stall_vsldu <= 0;
end
end

Expand Down

0 comments on commit 9d3de99

Please sign in to comment.