From 0e18642fd653a75cbeeef16a79b52da1e3207f4c Mon Sep 17 00:00:00 2001 From: Auringzaib Sabir Date: Fri, 26 Nov 2021 15:49:03 +0500 Subject: [PATCH 1/4] Added covergroup for capturing coverage of alu operations --- hw/vendor/lowrisc_ibex/rtl/ibex_decoder.sv | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/hw/vendor/lowrisc_ibex/rtl/ibex_decoder.sv b/hw/vendor/lowrisc_ibex/rtl/ibex_decoder.sv index 8ae55828..a2793c26 100644 --- a/hw/vendor/lowrisc_ibex/rtl/ibex_decoder.sv +++ b/hw/vendor/lowrisc_ibex/rtl/ibex_decoder.sv @@ -1787,4 +1787,22 @@ module ibex_decoder #( // Selectors must be known/valid. `ASSERT(IbexRegImmAluOpKnown, (opcode == OPCODE_OP_IMM) |-> !$isunknown(instr[14:12])) + + //////////////////////// + //Functional coverages// + //////////////////////// + + // Covergroup to capture ALU operations + covergroup alu_cg ()@(alu_operator_o); + ALU_OPERATIONS: coverpoint alu_operator_o; + endgroup : alu_cg + + alu_cg alu_cg_h; + + initial begin + alu_cg_h = new(); // Creating an instance of a covergroup + //alu_cg_h.set_inst_name("ALU OPERATIONS COVERAGES"); + end + endmodule // controller + From 5133d8aa5e2f7010b57c05e53a5ec31e1fa62ba2 Mon Sep 17 00:00:00 2001 From: Auringzaib Sabir Date: Fri, 26 Nov 2021 16:10:28 +0500 Subject: [PATCH 2/4] Incorporated covergroup for gathering covergage of mul/div operations --- hw/vendor/lowrisc_ibex/rtl/ibex_decoder.sv | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/hw/vendor/lowrisc_ibex/rtl/ibex_decoder.sv b/hw/vendor/lowrisc_ibex/rtl/ibex_decoder.sv index a2793c26..3e856676 100644 --- a/hw/vendor/lowrisc_ibex/rtl/ibex_decoder.sv +++ b/hw/vendor/lowrisc_ibex/rtl/ibex_decoder.sv @@ -1797,11 +1797,20 @@ module ibex_decoder #( ALU_OPERATIONS: coverpoint alu_operator_o; endgroup : alu_cg - alu_cg alu_cg_h; + // Covergroup to capture Multiplier/divider operations + covergroup mul_div_cg ()@(multdiv_operator_o); + MUL_DIV_OPERATIONS: coverpoint multdiv_operator_o; + endgroup : mul_div_cg + + alu_cg alu_cg_h ; + mul_div_cg mul_div_cg_h; initial begin - alu_cg_h = new(); // Creating an instance of a covergroup + alu_cg_h = new(); // Instance of a alu covergroup + mul_div_cg_h = new(); // Instance of a mul/div covergroup + //alu_cg_h.set_inst_name("ALU OPERATIONS COVERAGES"); + //mul_div_cg_h.set_inst_name("MUL/DIV OPERATIONS COVERAGES"); end endmodule // controller From 39b8ac06ef738c2da473018f5ac56288b5fd6254 Mon Sep 17 00:00:00 2001 From: Auringzaib Sabir Date: Fri, 26 Nov 2021 17:20:27 +0500 Subject: [PATCH 3/4] Added covergroup for capturing functional coverage of floating point operations --- hw/vendor/lowrisc_ibex/rtl/ibex_decoder.sv | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/vendor/lowrisc_ibex/rtl/ibex_decoder.sv b/hw/vendor/lowrisc_ibex/rtl/ibex_decoder.sv index 3e856676..b739c899 100644 --- a/hw/vendor/lowrisc_ibex/rtl/ibex_decoder.sv +++ b/hw/vendor/lowrisc_ibex/rtl/ibex_decoder.sv @@ -1802,12 +1802,19 @@ module ibex_decoder #( MUL_DIV_OPERATIONS: coverpoint multdiv_operator_o; endgroup : mul_div_cg + // Covergroup to capture floating point operations + covergroup fpu_cg ()@(fp_alu_operator_o); + FPU_OPERATIONS: coverpoint fp_alu_operator_o; + endgroup : fpu_cg + alu_cg alu_cg_h ; mul_div_cg mul_div_cg_h; + fpu_cg fpu_cg_h ; initial begin alu_cg_h = new(); // Instance of a alu covergroup mul_div_cg_h = new(); // Instance of a mul/div covergroup + fpu_cg_h = new(); // Instance of a fpu covergroup //alu_cg_h.set_inst_name("ALU OPERATIONS COVERAGES"); //mul_div_cg_h.set_inst_name("MUL/DIV OPERATIONS COVERAGES"); From 780c764643e7fd45dad53633d73d0c817ed1be22 Mon Sep 17 00:00:00 2001 From: Auringzaib Sabir Date: Wed, 1 Dec 2021 15:22:07 +0500 Subject: [PATCH 4/4] Added ifdef for functional coverage in decoder --- hw/vendor/lowrisc_ibex/rtl/ibex_decoder.sv | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/vendor/lowrisc_ibex/rtl/ibex_decoder.sv b/hw/vendor/lowrisc_ibex/rtl/ibex_decoder.sv index b739c899..8808e5a2 100644 --- a/hw/vendor/lowrisc_ibex/rtl/ibex_decoder.sv +++ b/hw/vendor/lowrisc_ibex/rtl/ibex_decoder.sv @@ -1791,7 +1791,8 @@ module ibex_decoder #( //////////////////////// //Functional coverages// //////////////////////// - + + `ifdef AZADI_FC // Covergroup to capture ALU operations covergroup alu_cg ()@(alu_operator_o); ALU_OPERATIONS: coverpoint alu_operator_o; @@ -1814,11 +1815,12 @@ module ibex_decoder #( initial begin alu_cg_h = new(); // Instance of a alu covergroup mul_div_cg_h = new(); // Instance of a mul/div covergroup - fpu_cg_h = new(); // Instance of a fpu covergroup - + fpu_cg_h = new(); // Instance of a fpu covergroup //alu_cg_h.set_inst_name("ALU OPERATIONS COVERAGES"); //mul_div_cg_h.set_inst_name("MUL/DIV OPERATIONS COVERAGES"); end + + `endif // AZADI_FC endmodule // controller