@@ -193,14 +193,14 @@ void state_t::reset(processor_t* const proc, reg_t max_isa)
193
193
csrmap[CSR_MINSTRET] = minstret;
194
194
csrmap[CSR_MCYCLE] = mcycle;
195
195
}
196
- for (reg_t i = 3 ; i < N_HPMCOUNTERS + 3 ; ++i) {
197
- const reg_t which_mevent = CSR_MHPMEVENT3 + i - 3 ;
198
- const reg_t which_meventh = CSR_MHPMEVENT3H + i - 3 ;
199
- const reg_t which_mcounter = CSR_MHPMCOUNTER3 + i - 3 ;
200
- const reg_t which_mcounterh = CSR_MHPMCOUNTER3H + i - 3 ;
201
- const reg_t which_counter = CSR_HPMCOUNTER3 + i - 3 ;
202
- const reg_t which_counterh = CSR_HPMCOUNTER3H + i - 3 ;
203
- mevent[i - 3 ] = std::make_shared<mevent_csr_t >(proc, which_mevent);
196
+ for (reg_t i = 0 ; i < N_HPMCOUNTERS; ++i) {
197
+ const reg_t which_mevent = CSR_MHPMEVENT3 + i;
198
+ const reg_t which_meventh = CSR_MHPMEVENT3H + i;
199
+ const reg_t which_mcounter = CSR_MHPMCOUNTER3 + i;
200
+ const reg_t which_mcounterh = CSR_MHPMCOUNTER3H + i;
201
+ const reg_t which_counter = CSR_HPMCOUNTER3 + i;
202
+ const reg_t which_counterh = CSR_HPMCOUNTER3H + i;
203
+ mevent[i] = std::make_shared<mevent_csr_t >(proc, which_mevent);
204
204
auto mcounter = std::make_shared<const_csr_t >(proc, which_mcounter, 0 );
205
205
csrmap[which_mcounter] = mcounter;
206
206
@@ -209,19 +209,19 @@ void state_t::reset(processor_t* const proc, reg_t max_isa)
209
209
csrmap[which_counter] = counter;
210
210
}
211
211
if (xlen == 32 ) {
212
- csrmap[which_mevent] = std::make_shared<rv32_low_csr_t >(proc, which_mevent, mevent[i - 3 ]);;
212
+ csrmap[which_mevent] = std::make_shared<rv32_low_csr_t >(proc, which_mevent, mevent[i]);;
213
213
auto mcounterh = std::make_shared<const_csr_t >(proc, which_mcounterh, 0 );
214
214
csrmap[which_mcounterh] = mcounterh;
215
215
if (proc->extension_enabled_const (EXT_ZIHPM)) {
216
216
auto counterh = std::make_shared<counter_proxy_csr_t >(proc, which_counterh, mcounterh);
217
217
csrmap[which_counterh] = counterh;
218
218
}
219
219
if (proc->extension_enabled_const (EXT_SSCOFPMF)) {
220
- auto meventh = std::make_shared<rv32_high_csr_t >(proc, which_meventh, mevent[i - 3 ]);
220
+ auto meventh = std::make_shared<rv32_high_csr_t >(proc, which_meventh, mevent[i]);
221
221
csrmap[which_meventh] = meventh;
222
222
}
223
223
} else {
224
- csrmap[which_mevent] = mevent[i - 3 ];
224
+ csrmap[which_mevent] = mevent[i];
225
225
}
226
226
}
227
227
csrmap[CSR_MCOUNTINHIBIT] = std::make_shared<const_csr_t >(proc, CSR_MCOUNTINHIBIT, 0 );
0 commit comments