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

[Bug Report] Out of bound array access #884

Open
chenc6 opened this issue May 24, 2022 · 4 comments
Open

[Bug Report] Out of bound array access #884

chenc6 opened this issue May 24, 2022 · 4 comments
Assignees
Labels
Component:RTL For issues in the RTL (e.g. for files in the rtl directory) Status:New Newly created issue, nobody has looked at it yet. Type:Bug For bugs in the RTL, Documentation, Verification environment or Tool and Build system

Comments

@chenc6
Copy link

chenc6 commented May 24, 2022

Hi,

CVA6 RTL is returning unknown value ("xxxxxxxx") when reading the value of MHPMCOUNTER30. This is happening because the csr reg data (csr_rdata) is being read from perf_counter_d array in the perf_counters.sv module with an array index outside its range. The range of perf_counter_d is [riscv::CSR_MIF_EMPTY : riscv::CSR_ML1_ICACHE_MISS] (line:46 from perf_counter.sv file), but in line: 282 of csv_regfile.sv we are using the array to access array index riscv::CSR_MHPM_COUNTER_30, which is greater than the range of [riscv::CSR_MIF_EMPTY : riscv::CSR_ML1_ICACHE_MISS].

Please find attached the triggering input mem file, spike_trace_log, and cva6_trace_log. We can see from the line:83 of cva6 trace log that the read data is xxxxxxxx
image

outofrange.zip

@MikeOpenHWGroup MikeOpenHWGroup added Type:Bug For bugs in the RTL, Documentation, Verification environment or Tool and Build system Status:New Newly created issue, nobody has looked at it yet. Component:RTL For issues in the RTL (e.g. for files in the rtl directory) labels Feb 11, 2023
@MikeOpenHWGroup
Copy link
Member

Hi @JeanRochCoulon and @yanicasa , this issue is more than 7 months old and has not received any updates. It looks like an important issue to me. It could be that this issue has been already resolved with the latest updates to the Tracer.

@JeanRochCoulon
Copy link
Contributor

Hello @TulikaSi This GitHub issue is related to perf counters. As you are modifying the perf counters, maybe the bug will be naturally removed. If it is not the case, can you fix it.

@JeanRochCoulon
Copy link
Contributor

@MikeOpenHWGroup I (re)assigned you this GitHub Issue because Tulika does not appear in the assignee list. Do we need to add her to the project list ?

@TulikaSi
Copy link
Contributor

TulikaSi commented Mar 16, 2023

Hello @TulikaSi This GitHub issue is related to perf counters. As you are modifying the perf counters, maybe the bug will be naturally removed. If it is not the case, can you fix it.

Hi @JeanRochCoulon the hardware performance monitor includes 29 number of 64-bit event counters, mhpmcounter3–
mhpmcounter31 but in accordance to the requirement specification https://github.com/openhwgroup/cva6/blob/master/docs/02_cva6_requirements/cva6_requirements_specification.rst#performance-counters the implementation shall take into account only six generic 64-bit performance counters mhpmcounter3 to mhpmcounter8 including their upper 32 bits counterparts mhpmcounter3h to mhpmcounter8h. So I believe after the modification of the performance counter, the RTL can be made to return read-only 0 for unimplemented counters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component:RTL For issues in the RTL (e.g. for files in the rtl directory) Status:New Newly created issue, nobody has looked at it yet. Type:Bug For bugs in the RTL, Documentation, Verification environment or Tool and Build system
Projects
None yet
Development

No branches or pull requests

5 participants