Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor coverage collection #424

Merged
merged 40 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
6c3a706
Refactor coverage collection
jordancarlin Feb 6, 2025
76bd59b
changed line 45, shared ecall and changed the name from sstatus to ms…
Marina-Bellido Feb 8, 2025
cc77230
Update immediates
jordancarlin Feb 9, 2025
2b7b0c6
More progress
jordancarlin Feb 8, 2025
4a642cf
Working on immediates and add more crypto
jordancarlin Feb 9, 2025
707fdd0
Finish adding crypto
jordancarlin Feb 9, 2025
4cfafd1
Typo fixes
jordancarlin Feb 9, 2025
d2ef7ca
Cleanup
jordancarlin Feb 9, 2025
d0f1174
Fix uimm
jordancarlin Feb 9, 2025
62f759e
More immediate fixes
jordancarlin Feb 9, 2025
938cb76
Refactor dissassembler
jordancarlin Feb 9, 2025
0dc6281
Use defines for each extension
jordancarlin Feb 9, 2025
23ed191
Make disassemble a function instead of a module
jordancarlin Feb 9, 2025
f7cf656
Merge branch 'main' of https://github.com/openhwgroup/cvw-arch-verif …
jordancarlin Feb 9, 2025
c5f3c14
Merge branch 'main' of https://github.com/openhwgroup/cvw-arch-verif …
jordancarlin Feb 10, 2025
61d0e17
Fix typo
jordancarlin Feb 10, 2025
7462d7f
Move coverage tracer
jordancarlin Feb 10, 2025
a4e5b19
Use manifest file
jordancarlin Feb 10, 2025
67bfaba
Relocate some files
jordancarlin Feb 10, 2025
cbbade4
Add support for floating point rounding modes to disassemble function
jordancarlin Feb 10, 2025
316355b
Merge branch 'main' of https://github.com/openhwgroup/cvw-arch-verif …
jordancarlin Feb 10, 2025
dbd1a65
Rename main coverage module
jordancarlin Feb 10, 2025
cc7469b
Refactor disassembly registers
jordancarlin Feb 10, 2025
0c82bcf
Add new get_csr_address function
jordancarlin Feb 10, 2025
bbe82c6
Complete CSR decoding
jordancarlin Feb 10, 2025
6ab4fae
Update coverpoints for compatibility with new coverage collection fun…
jordancarlin Feb 10, 2025
3f71969
More cleanup
jordancarlin Feb 10, 2025
91d36de
Full compressed support in decoder
jordancarlin Feb 10, 2025
04d1745
Update Zca instructions that do not allow x0 register
jordancarlin Feb 11, 2025
adfd6a9
Merge branch 'main' of https://github.com/openhwgroup/cvw-arch-verif …
jordancarlin Feb 11, 2025
a584bd0
Fix some coverpoints to work with new functional coverage system
jordancarlin Feb 12, 2025
653d310
Don't exit on invalid rounding mode
jordancarlin Feb 12, 2025
b4be86c
Fix c.jal for new disassembly
jordancarlin Feb 12, 2025
dd57d35
Merge branch 'main' of https://github.com/openhwgroup/cvw-arch-verif …
jordancarlin Feb 12, 2025
2888c6b
Fix c.addi16sp
jordancarlin Feb 12, 2025
2a46f6c
For compressed instructions only use bottom 16 bits
jordancarlin Feb 12, 2025
a6a41de
Fix csr immediate instruction decoding
jordancarlin Feb 13, 2025
96ca3fa
Cleanup - remove unused functions
jordancarlin Feb 13, 2025
8f5a40a
Cleanup display statements
jordancarlin Feb 13, 2025
7838edf
Simplification
jordancarlin Feb 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

44 changes: 44 additions & 0 deletions fcov/RISCV_coverage.svh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// Copyright (c) 2023 Imperas Software Ltd., www.imperas.com
// Modified February 2024, [email protected]
//
// SPDX-License-Identifier: Apache-2.0 WITH SHL-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
//

`include "coverage/RISCV_coverage_pkg.svh"

import RISCV_coverage_pkg::*;

class coverage #(
parameter int ILEN = 32, // Instruction length in bits
parameter int XLEN = 32, // GPR length in bits
parameter int FLEN = 32, // FPR length in bits
parameter int VLEN = 256, // Vector register size in bits
parameter int NHART = 1, // Number of harts reported
parameter int RETIRE = 1 // Number of instructions that can retire during valid event
) extends RISCV_coverage #(ILEN, XLEN, FLEN, VLEN, NHART, RETIRE);

function new(virtual rvviTrace #(ILEN, XLEN, FLEN, VLEN, NHART, RETIRE) rvvi);
super.new(rvvi);
endfunction

function void sample(bit trap, int hart, int issue, string disass);
save_rvvi_data(trap, hart, issue, disass);
sample_extensions(hart, issue);
endfunction
endclass
155 changes: 64 additions & 91 deletions fcov/coverage/RISCV_coverage_base.svh
Original file line number Diff line number Diff line change
@@ -1,100 +1,73 @@
//
// Copyright (c) 2023 Imperas Software Ltd., www.imperas.com
//
// Copyright (c) 2023 Imperas Software Ltd., www.imperas.com
// Modified 3 Sept 2024 [email protected]
// support more EXTENSIONS
// change capitalization of sample function
//
// SPDX-License-Identifier: Apache-2.0 WITH SHL-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
//





// Modified February 2024, [email protected]
//
// SPDX-License-Identifier: Apache-2.0 WITH SHL-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
//

class RISCV_coverage
#(
parameter int ILEN = 32, // Instruction length in bits
parameter int XLEN = 32, // GPR length in bits
parameter int FLEN = 32, // FPR length in bits
parameter int VLEN = 256, // Vector register size in bits
parameter int NHART = 1, // Number of harts reported
parameter int RETIRE = 1 // Number of instructions that can retire during valid event
parameter int ILEN = 32, // Instruction length in bits
parameter int XLEN = 32, // GPR length in bits
parameter int FLEN = 32, // FPR length in bits
parameter int VLEN = 256, // Vector register size in bits
parameter int NHART = 1, // Number of harts reported
parameter int RETIRE = 1 // Number of instructions that can retire during valid event
);

`include "coverage/RISCV_coverage_rvvi.svh"
`include "coverage/RISCV_coverage_csr.svh"
`include "coverage/RISCV_coverage_exceptions.svh"
`include "coverage/RISCV_coverage_hazards.svh"

// Load which extensions are supported in this configuration (from $WALLY/config/<config>/coverage.svh)
`include "coverage.svh"

virtual rvviTrace #(ILEN, XLEN, FLEN, VLEN, NHART, RETIRE) rvvi;


function new(virtual rvviTrace #(ILEN, XLEN, FLEN, VLEN, NHART, RETIRE) rvvi);

this.rvvi = rvvi;
`cover_info("// cvw_arch_verif ");
`cover_info("// adapted from riscvISACOV Version 20231026.0");
`cover_info("// SPDX-License-Identifier: Apache-2.0 WITH SHL-2.0");
`cover_info("// Configuration:");

`ifdef COVER_BASE_RV32I
`cover_info("// BASE: RV32I");
`endif
`ifdef COVER_BASE_RV32E
`cover_info("// BASE: RV32E");
`endif
`ifdef COVER_BASE_RV64I
`cover_info("// BASE: RV64I");
`endif
`ifdef COVER_BASE_RV64E
`cover_info("// BASE: RV64E");
`endif

`cover_info("// EXTENSIONS:");
`include "RISCV_coverage_base_init.svh"

endfunction

function string get_inst_name(bit trap, int hart, int issue, string disass); // break and move this first bit out
string insbin, ins_str, ops;
int num = $sscanf (disass, "%s %s %s", insbin, ins_str, ops);
return ins_str;
endfunction


function void sample_extensions(int hart, int issue);

// Additional functions for coverage collection
`include "coverage/RISCV_coverage_rvvi.svh"
`include "coverage/RISCV_coverage_csr.svh"
`include "coverage/RISCV_coverage_exceptions.svh"
`include "coverage/RISCV_coverage_hazards.svh"
`include "coverage/RISCV_coverage_config.svh"

virtual rvviTrace #(ILEN, XLEN, FLEN, VLEN, NHART, RETIRE) rvvi;

function new(virtual rvviTrace #(ILEN, XLEN, FLEN, VLEN, NHART, RETIRE) rvvi);
this.rvvi = rvvi;

// Print header information
`cover_info("\n// cvw_arch_verif ");
`cover_info("// adapted from riscvISACOV Version 20231026.0");
`cover_info("// SPDX-License-Identifier: Apache-2.0 WITH SHL-2.0\n//");
`cover_info("// Configuration:");
`ifdef XLEN32
`cover_info("// XLEN: 32");
`endif
`ifdef XLEN64
`cover_info("// XLEN: 64");
`endif
`cover_info("// EXTENSIONS:");
`include "RISCV_coverage_base_init.svh"
endfunction

// Returns just the instruction name from the disassembly
function string get_inst_name(bit trap, int hart, int issue, string disass);
string insbin, ins_str, ops;
int num = $sscanf (disass, "%s %s %s", insbin, ins_str, ops);
return ins_str;
endfunction

// Runs all of the sample functions created per extension from templates
function void sample_extensions(int hart, int issue);
`include "RISCV_coverage_base_sample.svh"

endfunction

function void sample_csrs(int hart, int issue);
endfunction

function void sample_idv_metrics();
endfunction

endfunction
endclass




Loading