Skip to content

Commit

Permalink
Adding custom 0 and 1 instr to tracer pkg for rvfi and coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoann Pruvost committed Oct 4, 2023
1 parent a8e87a6 commit 4a238ce
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 21 deletions.
59 changes: 59 additions & 0 deletions bhv/include/cv32e40p_tracer_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,66 @@ package cv32e40p_tracer_pkg;
parameter INSTR_BEQIMM = {17'b?, 3'b110, 5'b?, OPCODE_CUSTOM_0};
parameter INSTR_BNEIMM = {17'b?, 3'b111, 5'b?, OPCODE_CUSTOM_0};

// Post-Increment Register-Immediate Load
parameter INSTR_CVLBI = {17'b?, 3'b000, 5'b?, OPCODE_CUSTOM_0};
parameter INSTR_CVLBUI = {17'b?, 3'b100, 5'b?, OPCODE_CUSTOM_0};
parameter INSTR_CVLHI = {17'b?, 3'b001, 5'b?, OPCODE_CUSTOM_0};
parameter INSTR_CVLHUI = {17'b?, 3'b101, 5'b?, OPCODE_CUSTOM_0};
parameter INSTR_CVLWI = {17'b?, 3'b010, 5'b?, OPCODE_CUSTOM_0};

// Event Load
parameter INSTR_CVELW = {17'b?, 3'b011, 5'b?, OPCODE_CUSTOM_0};

// CUSTOM_1
// Post-Increment Register-Register Load
parameter INSTR_CVLBR = {7'b0000000, 5'b?, 5'b?, 3'b011, 5'b?, OPCODE_CUSTOM_1};
parameter INSTR_CVLBUR = {7'b0001000, 5'b?, 5'b?, 3'b011, 5'b?, OPCODE_CUSTOM_1};
parameter INSTR_CVLHR = {7'b0000001, 5'b?, 5'b?, 3'b011, 5'b?, OPCODE_CUSTOM_1};
parameter INSTR_CVLHUR = {7'b0001001, 5'b?, 5'b?, 3'b011, 5'b?, OPCODE_CUSTOM_1};
parameter INSTR_CVLWR = {7'b0000010, 5'b?, 5'b?, 3'b011, 5'b?, OPCODE_CUSTOM_1};

// Register-Register Load
parameter INSTR_CVLBRR = {7'b0000100, 5'b?, 5'b?, 3'b011, 5'b?, OPCODE_CUSTOM_1};
parameter INSTR_CVLBURR = {7'b0001100, 5'b?, 5'b?, 3'b011, 5'b?, OPCODE_CUSTOM_1};
parameter INSTR_CVLHRR = {7'b0000101, 5'b?, 5'b?, 3'b011, 5'b?, OPCODE_CUSTOM_1};
parameter INSTR_CVLHURR = {7'b0001101, 5'b?, 5'b?, 3'b011, 5'b?, OPCODE_CUSTOM_1};
parameter INSTR_CVLWRR = {7'b0000110, 5'b?, 5'b?, 3'b011, 5'b?, OPCODE_CUSTOM_1};

// Post-Increment Register-Immediate Store
parameter INSTR_CVSBI = {17'b?, 3'b000, 5'b?, OPCODE_CUSTOM_1};
parameter INSTR_CVSHI = {17'b?, 3'b001, 5'b?, OPCODE_CUSTOM_1};
parameter INSTR_CVSWI = {17'b?, 3'b010, 5'b?, OPCODE_CUSTOM_1};

// Post-Increment Register-Register Store operations encoding
parameter INSTR_CVSBR = {7'b0010000, 5'b?, 5'b?, 3'b011, 5'b?, OPCODE_CUSTOM_1};
parameter INSTR_CVSHR = {7'b0010001, 5'b?, 5'b?, 3'b011, 5'b?, OPCODE_CUSTOM_1};
parameter INSTR_CVSWR = {7'b0010010, 5'b?, 5'b?, 3'b011, 5'b?, OPCODE_CUSTOM_1};

// Register-Register Store operations
parameter INSTR_CVSBRR = {7'b0010100, 5'b?, 5'b?, 3'b011, 5'b?, OPCODE_CUSTOM_1};
parameter INSTR_CVSHRR = {7'b0010101, 5'b?, 5'b?, 3'b011, 5'b?, OPCODE_CUSTOM_1};
parameter INSTR_CVSWRR = {7'b0010110, 5'b?, 5'b?, 3'b011, 5'b?, OPCODE_CUSTOM_1};

// Hardware Loops
parameter INSTR_CVSTARTI0 = {12'b?, 5'b00000, 3'b100, 4'b0000, 1'b0, OPCODE_CUSTOM_1};
parameter INSTR_CVSTART0 = {12'b000000000000, 5'b?, 3'b100, 4'b0001, 1'b0, OPCODE_CUSTOM_1};
parameter INSTR_CVSENDI0 = {12'b?, 5'b00000, 3'b100, 4'b0010, 1'b0, OPCODE_CUSTOM_1};
parameter INSTR_CVEND0 = {12'b000000000000, 5'b?, 3'b100, 4'b0011, 1'b0, OPCODE_CUSTOM_1};
parameter INSTR_CVCOUNTI0 = {12'b?, 5'b00000, 3'b100, 4'b0100, 1'b0, OPCODE_CUSTOM_1};
parameter INSTR_CVCOUNT0 = {12'b000000000000, 5'b?, 3'b100, 4'b0101, 1'b0, OPCODE_CUSTOM_1};
parameter INSTR_CVSETUPI0 = {12'b?, 5'b00000, 3'b100, 4'b0110, 1'b0, OPCODE_CUSTOM_1};
parameter INSTR_CVSETUP0 = {12'b?, 5'b00000, 3'b100, 4'b0111, 1'b0, OPCODE_CUSTOM_1};

parameter INSTR_CVSTARTI1 = {12'b?, 5'b00000, 3'b100, 4'b0000, 1'b1, OPCODE_CUSTOM_1};
parameter INSTR_CVSTART1 = {12'b000000000000, 5'b?, 3'b100, 4'b0001, 1'b1, OPCODE_CUSTOM_1};
parameter INSTR_CVSENDI1 = {12'b?, 5'b00000, 3'b100, 4'b0010, 1'b1, OPCODE_CUSTOM_1};
parameter INSTR_CVEND1 = {12'b000000000000, 5'b?, 3'b100, 4'b0011, 1'b1, OPCODE_CUSTOM_1};
parameter INSTR_CVCOUNTI1 = {12'b?, 5'b00000, 3'b100, 4'b0100, 1'b1, OPCODE_CUSTOM_1};
parameter INSTR_CVCOUNT1 = {12'b000000000000, 5'b?, 3'b100, 4'b0101, 1'b1, OPCODE_CUSTOM_1};
parameter INSTR_CVSETUPI1 = {12'b?, 5'b00000, 3'b100, 4'b0110, 1'b1, OPCODE_CUSTOM_1};
parameter INSTR_CVSETUP1 = {12'b?, 5'b00000, 3'b100, 4'b0111, 1'b1, OPCODE_CUSTOM_1};


parameter INSTR_FF1 = {7'b0100001, 5'b0, 5'b?, 3'b011, 5'b?, OPCODE_CUSTOM_1};
parameter INSTR_FL1 = {7'b0100010, 5'b0, 5'b?, 3'b011, 5'b?, OPCODE_CUSTOM_1};
parameter INSTR_CLB = {7'b0100011, 5'b0, 5'b?, 3'b011, 5'b?, OPCODE_CUSTOM_1};
Expand Down
96 changes: 75 additions & 21 deletions bhv/insn_trace.sv
Original file line number Diff line number Diff line change
Expand Up @@ -304,22 +304,22 @@
// PULP MULTIPLIER
INSTR_PMAC: this.m_mnemonic = "cv.mac";
INSTR_PMSU: this.m_mnemonic = "cv.msu";
// INSTR_PMULSN: this.m_mnemonic = ;
// INSTR_PMULHHSN: this.m_mnemonic = ;
// INSTR_PMULSRN: this.m_mnemonic = ;
// INSTR_PMULHHSRN: this.m_mnemonic = ;
// INSTR_PMULUN: this.m_mnemonic = ;
// INSTR_PMULHHUN: this.m_mnemonic = ;
// INSTR_PMULURN: this.m_mnemonic = ;
// INSTR_PMULHHURN: this.m_mnemonic = ;
// INSTR_PMACSN: this.m_mnemonic = ;
// INSTR_PMACHHSN: this.m_mnemonic = ;
// INSTR_PMACSRN: this.m_mnemonic = ;
// INSTR_PMACHHSRN: this.m_mnemonic = ;
// INSTR_PMACUN: this.m_mnemonic = ;
// INSTR_PMACHHUN: this.m_mnemonic = ;
// INSTR_PMACURN: this.m_mnemonic = ;
// INSTR_PMACHHURN: this.m_mnemonic = ;
INSTR_PMULSN: this.m_mnemonic = "cv.mulsN";
INSTR_PMULHHSN: this.m_mnemonic = "cv.mulhhsN";
INSTR_PMULSRN: this.m_mnemonic = "cv.mulsRN";
INSTR_PMULHHSRN: this.m_mnemonic = "cv.mulhhsRN";
INSTR_PMULUN: this.m_mnemonic = "cv.muluN";
INSTR_PMULHHUN: this.m_mnemonic = "cv.mulhhuN";
INSTR_PMULURN: this.m_mnemonic = "cv.muluRN";
INSTR_PMULHHURN: this.m_mnemonic = "cv.mulhhuRN";
INSTR_PMACSN: this.m_mnemonic = "cv.macsN";
INSTR_PMACHHSN: this.m_mnemonic = "cv.machhsN";
INSTR_PMACSRN: this.m_mnemonic = "cv.macsRN";
INSTR_PMACHHSRN: this.m_mnemonic = "cv.machhsRN";
INSTR_PMACUN: this.m_mnemonic = "cv.macuN";
INSTR_PMACHHUN: this.m_mnemonic = "cv.machhuN";
INSTR_PMACURN: this.m_mnemonic = "cv.macuRN";
INSTR_PMACHHURN: this.m_mnemonic = "cv.machhuRN";

// FP-OP
INSTR_FMADD: this.m_mnemonic = "fmadd.s";
Expand Down Expand Up @@ -360,6 +360,65 @@
INSTR_AMOMINU: this.m_mnemonic = "amominu.w";
INSTR_AMOMAXU: this.m_mnemonic = "amomaxu.w";

// CUSTOM 0
// Post-Increment Register-Immediate Load
INSTR_CVLBI : this.m_mnemonic = "cv.lb";
INSTR_CVLBUI : this.m_mnemonic = "cv.lbu";
INSTR_CVLHI : this.m_mnemonic = "cv.lh";
INSTR_CVLHUI : this.m_mnemonic = "cv.lhu";
INSTR_CVLWI : this.m_mnemonic = "cv.lw";

// Event Load
INSTR_CVELW : this.m_mnemonic = "cv.elw";

// CUSTOM_1
// Post-Increment Register-Register Load
INSTR_CVLBR : this.m_mnemonic = "cv.lb";
INSTR_CVLBUR : this.m_mnemonic = "cv.lbu";
INSTR_CVLHR : this.m_mnemonic = "cv.lh";
INSTR_CVLHUR : this.m_mnemonic = "cv.lhu";
INSTR_CVLWR : this.m_mnemonic = "cv.lw";

// Register-Register Load
INSTR_CVLBRR : this.m_mnemonic = "cv.lb";
INSTR_CVLBURR : this.m_mnemonic = "cv.lbu";
INSTR_CVLHRR : this.m_mnemonic = "cv.lh";
INSTR_CVLHURR : this.m_mnemonic = "cv.lhu";
INSTR_CVLWRR : this.m_mnemonic = "cv.lw";

// Post-Increment Register-Immediate Store
INSTR_CVSBI : this.m_mnemonic = "cv.sb";
INSTR_CVSHI : this.m_mnemonic = "cv.sh";
INSTR_CVSWI : this.m_mnemonic = "cv.sw";

// Post-Increment Register-Register Store operations encoding
INSTR_CVSBR : this.m_mnemonic = "cv.sb";
INSTR_CVSHR : this.m_mnemonic = "cv.sh";
INSTR_CVSWR : this.m_mnemonic = "cv.sw";

// Register-Register Store operations
INSTR_CVSBRR : this.m_mnemonic = "cv.sb";
INSTR_CVSHRR : this.m_mnemonic = "cv.sh";
INSTR_CVSWRR : this.m_mnemonic = "cv.sw";

// Hardware Loops
INSTR_CVSTARTI0 : this.m_mnemonic = "cv.starti 0";
INSTR_CVSTART0 : this.m_mnemonic = "cv.start 0";
INSTR_CVSENDI0 : this.m_mnemonic = "cv.endi 0";
INSTR_CVEND0 : this.m_mnemonic = "cv.end 0";
INSTR_CVCOUNTI0 : this.m_mnemonic = "cv.counti 0";
INSTR_CVCOUNT0 : this.m_mnemonic = "cv.count 0";
INSTR_CVSETUPI0 : this.m_mnemonic = "cv.setupi 0";
INSTR_CVSETUP0 : this.m_mnemonic = "cv.setup 0";
INSTR_CVSTARTI1 : this.m_mnemonic = "cv..starti 1";
INSTR_CVSTART1 : this.m_mnemonic = "cv..start 1";
INSTR_CVSENDI1 : this.m_mnemonic = "cv..endi 1";
INSTR_CVEND1 : this.m_mnemonic = "cv..end 1";
INSTR_CVCOUNTI1 : this.m_mnemonic = "cv..counti 1";
INSTR_CVCOUNT1 : this.m_mnemonic = "cv..count 1";
INSTR_CVSETUPI1 : this.m_mnemonic = "cv..setupi 1";
INSTR_CVSETUP1 : this.m_mnemonic = "cv..setup 1";

// CUSTOM 3
// SIMD ALU
INSTR_CVADDH : this.m_mnemonic = "cv.add.h";
Expand Down Expand Up @@ -591,13 +650,8 @@
// opcodes with custom decoding
// {25'b?, OPCODE_LOAD} : begin this.printLoadInstr(""); this.is_load = 1; end
// {25'b?, OPCODE_LOAD_FP} : begin this.printLoadInstr("f"); this.is_load = 1; end
// {25'b?, OPCODE_CUSTOM_0} : begin this.printLoadInstr(""); this.is_load = 1; end
// {7'b000????, 10'b?, 3'b011, 5'b?, OPCODE_CUSTOM_1} : begin this.printLoadInstr(""); this.is_load = 1; end
// {7'b001????, 10'b?, 3'b011, 5'b?, OPCODE_CUSTOM_1} : this.printStoreInstr("");
// {17'b?, 3'b100, 5'b?, OPCODE_CUSTOM_1} : this.printHwloopInstr();
// {25'b?, OPCODE_STORE} : this.printStoreInstr("");
// {25'b?, OPCODE_STORE_FP} : this.printStoreInstr("f");
// {17'b?, 3'b0??, 5'b?, OPCODE_CUSTOM_1} : this.printStoreInstr("");
default: this.m_mnemonic = "INVALID";
endcase // unique case (instr)
end else begin //Compressed instruction
Expand Down

0 comments on commit 4a238ce

Please sign in to comment.