Skip to content

Commit

Permalink
update with amoadd (#543)
Browse files Browse the repository at this point in the history
* update with amoadd

* fix
  • Loading branch information
tommydcjung authored Jul 1, 2021
1 parent e41e0b9 commit 499d31e
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 6 deletions.
1 change: 0 additions & 1 deletion machines/arch_filelist.mk
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,3 @@ VSOURCES += $(BSG_MANYCORE_DIR)/v/bsg_manycore_dram_hash_function.v
VSOURCES += $(BSG_MANYCORE_DIR)/v/bsg_manycore_link_sif_tieoff.v
VSOURCES += $(BSG_MANYCORE_DIR)/v/bsg_manycore_ruche_x_link_sif_tieoff.v
VSOURCES += $(BSG_MANYCORE_DIR)/v/bsg_ruche_buffer.v
VSOURCES += $(BSG_MANYCORE_DIR)/v/bsg_ruche_anti_buffer.v
1 change: 1 addition & 0 deletions software/py/vanilla_parser/blood_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class BloodGraph:
"lr_aq",
"amoswap",
"amoor",
"amoadd",
"beq",
"bne",
"blt",
Expand Down
1 change: 1 addition & 0 deletions software/py/vanilla_parser/stats_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ def __prettify(self, df):
doc += "\t RISC-V Atomic Operations:\n"
doc += "\t\t-instr_amoswap: Atomic Swap\n"
doc += "\t\t-instr_amoor: Atomic OR\n"
doc += "\t\t-instr_amoadd: Atomic ADD\n"
doc += "\t Cache Stall Operations:\n"
doc += "\t\t-stall_miss: Miss Operation (Stall)\n"
doc += "\t\t-stall_idle: Idle Operation (Stall)\n"
Expand Down
3 changes: 3 additions & 0 deletions software/py/vanilla_parser/vcache_stall_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class VcacheStallGraph:
"atomic",
"amoswap",
"amoor",
"amoadd",
"miss_ld",
"miss_st",
"dma_read_req",
Expand Down Expand Up @@ -114,6 +115,7 @@ class VcacheStallGraph:
"atomic" : (0x00, 0x00, 0x00) , ## white
"amoswap" : (0x00, 0x00, 0x00) , ## white
"amoor" : (0x00, 0x00, 0x00) , ## white
"amoadd" : (0x00, 0x00, 0x00) , ## white
"miss_ld" : (0x00, 0xff, 0x00) , ## green
"miss_st" : (0x00, 0x00, 0xff) , ## blue
"dma_read_req" : (0xff, 0xff, 0xff) , ## white
Expand Down Expand Up @@ -152,6 +154,7 @@ class VcacheStallGraph:
"atomic" : (0x00, 0x00, 0x00) , ## white
"amoswap" : (0x00, 0x00, 0x00) , ## white
"amoor" : (0x00, 0x00, 0x00) , ## white
"amoadd" : (0x00, 0x00, 0x00) , ## white
"miss_ld" : (0x00, 0xff, 0x00) , ## green
"miss_st" : (0x00, 0x00, 0xff) , ## blue
"dma_read_req" : (0xff, 0xff, 0xff) , ## white
Expand Down
4 changes: 2 additions & 2 deletions software/spmd/bsg_print_stat/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int main()
{
int sum = 0;

bsg_print_stat(0);
bsg_cuda_print_stat_start(0);

for (int i = 0; i < N; i++)
{
Expand All @@ -36,7 +36,7 @@ int main()
product = product * idata[i];
}

bsg_print_stat(1);
bsg_cuda_print_stat_end(0);

if (sum == 30 && dp == 51.0f && product == 12096)
bsg_finish();
Expand Down
8 changes: 7 additions & 1 deletion testbenches/common/v/vanilla_core_profiler.v
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ module vanilla_core_profiler
wire lr_aq_inc = exe_r.decode.is_lr_aq_op;
wire amoswap_inc = exe_r.decode.is_amo_op & (exe_r.decode.amo_type == e_vanilla_amoswap);
wire amoor_inc = exe_r.decode.is_amo_op & (exe_r.decode.amo_type == e_vanilla_amoor);
wire amoadd_inc = exe_r.decode.is_amo_op & (exe_r.decode.amo_type == e_vanilla_amoadd);

// branch & jump
wire beq_inc = exe_r.decode.is_branch_op & (exe_r.instruction ==? `RV32_BEQ);
Expand Down Expand Up @@ -636,6 +637,7 @@ module vanilla_core_profiler
integer lr_aq;
integer amoswap;
integer amoor;
integer amoadd;

integer beq;
integer bne;
Expand Down Expand Up @@ -786,6 +788,7 @@ module vanilla_core_profiler
else if (lr_aq_inc) stat_r.lr_aq++;
else if (amoswap_inc) stat_r.amoswap++;
else if (amoor_inc) stat_r.amoor++;
else if (amoadd_inc) stat_r.amoadd++;

else if (beq_inc) begin
stat_r.beq++;
Expand Down Expand Up @@ -962,6 +965,7 @@ module vanilla_core_profiler
$fwrite(fd, "instr_lr_aq,");
$fwrite(fd, "instr_amoswap,");
$fwrite(fd, "instr_amoor,");
$fwrite(fd, "instr_amoadd,");

$fwrite(fd, "instr_beq,");
$fwrite(fd, "instr_bne,");
Expand Down Expand Up @@ -1057,7 +1061,7 @@ module vanilla_core_profiler

always @(negedge clk_i) begin
// stat printing
if (~reset_i & print_stat_v_i & print_stat_tag.y_cord == global_y_i & print_stat_tag.x_cord == global_x_i) begin
if (~reset_i & print_stat_v_i & print_stat_tag.y_cord == (global_y_i-origin_y_cord_p) & print_stat_tag.x_cord == (global_x_i-origin_x_cord_p)) begin
$display("[BSG_INFO][VCORE_PROFILER] t=%0t x,y=%02d,%02d printing stats.", $time, global_x_i, global_y_i);

fd = $fopen(logfile_lp, "a");
Expand Down Expand Up @@ -1121,6 +1125,7 @@ module vanilla_core_profiler
$fwrite(fd, "%0d,", stat_r.lr_aq);
$fwrite(fd, "%0d,", stat_r.amoswap);
$fwrite(fd, "%0d,", stat_r.amoor);
$fwrite(fd, "%0d,", stat_r.amoadd);

$fwrite(fd, "%0d,", stat_r.beq);
$fwrite(fd, "%0d,", stat_r.bne);
Expand Down Expand Up @@ -1262,6 +1267,7 @@ module vanilla_core_profiler
else if (lr_aq_inc) print_operation_trace(fd2, "lr_aq", exe_pc);
else if (amoswap_inc) print_operation_trace(fd2, "amoswap", exe_pc);
else if (amoor_inc) print_operation_trace(fd2, "amoor", exe_pc);
else if (amoadd_inc) print_operation_trace(fd2, "amoadd", exe_pc);

else if (beq_inc) print_operation_trace(fd2, "beq", exe_pc);
else if (bne_inc) print_operation_trace(fd2, "bne", exe_pc);
Expand Down
10 changes: 8 additions & 2 deletions testbenches/common/v/vcache_profiler.v
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ module vcache_profiler
wire inc_atomic = v_o & yumi_i & decode_v_r.atomic_op; // atomic
wire inc_amoswap = inc_atomic & (decode_v_r.amo_subop == e_cache_amo_swap); // atomic swap
wire inc_amoor = inc_atomic & (decode_v_r.amo_subop == e_cache_amo_or); // atomic or
wire inc_amoadd = inc_atomic & (decode_v_r.amo_subop == e_cache_amo_add); // atomic add

wire inc_miss_ld = v_o & yumi_i & decode_v_r.ld_op & miss_v; // miss on load
wire inc_miss_st = v_o & yumi_i & decode_v_r.st_op & miss_v; // miss on store
Expand Down Expand Up @@ -149,6 +150,7 @@ module vcache_profiler
integer atomic_count;
integer amoswap_count;
integer amoor_count;
integer amoadd_count;

integer miss_ld_count;
integer miss_st_count;
Expand Down Expand Up @@ -202,6 +204,7 @@ module vcache_profiler
if (inc_atomic) stat_r.atomic_count++;
if (inc_amoswap) stat_r.amoswap_count++;
if (inc_amoor) stat_r.amoor_count++;
if (inc_amoadd) stat_r.amoadd_count++;

if (inc_miss_ld) stat_r.miss_ld_count++;
if (inc_miss_st) stat_r.miss_st_count++;
Expand Down Expand Up @@ -240,7 +243,7 @@ module vcache_profiler
$fwrite(log_fd, "instr_st,instr_sm_sd,instr_sm_sw,instr_sm_sh,instr_sm_sb,");
$fwrite(log_fd, "instr_tagst,instr_tagfl,instr_taglv,instr_tagla,");
$fwrite(log_fd, "instr_afl,instr_aflinv,instr_ainv,instr_alock,instr_aunlock,");
$fwrite(log_fd, "instr_atomic,instr_amoswap,instr_amoor,");
$fwrite(log_fd, "instr_atomic,instr_amoswap,instr_amoor,amoadd,");
$fwrite(log_fd, "miss_ld,miss_st,miss_amo,stall_miss,stall_idle,stall_rsp,dma_read_req,dma_write_req,");
$fwrite(log_fd, "replace_invalid,replace_valid,replace_dirty\n");
$fclose(log_fd);
Expand Down Expand Up @@ -301,10 +304,11 @@ module vcache_profiler
stat_r.aunlock_count,
);

$fwrite(log_fd, "%0d,%0d,%0d,",
$fwrite(log_fd, "%0d,%0d,%0d,%0d,",
stat_r.atomic_count,
stat_r.amoswap_count,
stat_r.amoor_count,
stat_r.amoadd_count,
);

$fwrite(log_fd, "%0d,%0d,%0d,%0d,%0d,%0d,%0d,%0d,",
Expand Down Expand Up @@ -409,6 +413,8 @@ module vcache_profiler
print_operation_trace(trace_fd, my_name, "amoswap");
else if (inc_amoor)
print_operation_trace(trace_fd, my_name, "amoor");
else if (inc_amoadd)
print_operation_trace(trace_fd, my_name, "amoadd");
else
print_operation_trace(trace_fd, my_name, "idle");
end
Expand Down

0 comments on commit 499d31e

Please sign in to comment.