diff options
author | Scott Johnson <scott.johnson@arilinc.com> | 2021-09-20 14:53:47 -0700 |
---|---|---|
committer | Scott Johnson <scott.johnson@arilinc.com> | 2021-09-25 23:50:54 -0700 |
commit | 3c37b848bd3f4515df8a6291c656d46a7b30f9c6 (patch) | |
tree | 3a2ad26fb9b4167559114c67e294d49a1bb0d8a8 /riscv | |
parent | 3b3fbe6db65b2e7404b05cddd3b795cdf530398e (diff) | |
download | spike-3c37b848bd3f4515df8a6291c656d46a7b30f9c6.zip spike-3c37b848bd3f4515df8a6291c656d46a7b30f9c6.tar.gz spike-3c37b848bd3f4515df8a6291c656d46a7b30f9c6.tar.bz2 |
Convert counteren CSRs to use new masked_csr_t
So I can remove the special counteren_csr_t next.
Diffstat (limited to 'riscv')
-rw-r--r-- | riscv/processor.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/riscv/processor.cc b/riscv/processor.cc index 39935f6..53c9e57 100644 --- a/riscv/processor.cc +++ b/riscv/processor.cc @@ -440,9 +440,10 @@ void state_t::reset(processor_t* const proc, reg_t max_isa) csrmap[CSR_MEDELEG] = medeleg = std::make_shared<medeleg_csr_t>(proc, CSR_MEDELEG); csrmap[CSR_MIDELEG] = mideleg = std::make_shared<mideleg_csr_t>(proc, CSR_MIDELEG); - mcounteren = std::make_shared<counteren_csr_t>(proc, CSR_MCOUNTEREN); + const reg_t counteren_mask = 0xffffffffULL; + mcounteren = std::make_shared<masked_csr_t>(proc, CSR_MCOUNTEREN, counteren_mask, 0); if (proc->extension_enabled_const('U')) csrmap[CSR_MCOUNTEREN] = mcounteren; - csrmap[CSR_SCOUNTEREN] = scounteren = std::make_shared<counteren_csr_t>(proc, CSR_SCOUNTEREN); + csrmap[CSR_SCOUNTEREN] = scounteren = std::make_shared<masked_csr_t>(proc, CSR_SCOUNTEREN, counteren_mask, 0); auto nonvirtual_sepc = std::make_shared<epc_csr_t>(proc, CSR_SEPC); csrmap[CSR_VSEPC] = vsepc = std::make_shared<epc_csr_t>(proc, CSR_VSEPC); csrmap[CSR_SEPC] = sepc = std::make_shared<virtualized_csr_t>(proc, nonvirtual_sepc, vsepc); @@ -487,7 +488,7 @@ void state_t::reset(processor_t* const proc, reg_t max_isa) (1 << CAUSE_LOAD_PAGE_FAULT) | (1 << CAUSE_STORE_PAGE_FAULT); csrmap[CSR_HEDELEG] = hedeleg = std::make_shared<masked_csr_t>(proc, CSR_HEDELEG, hedeleg_mask, 0); - csrmap[CSR_HCOUNTEREN] = hcounteren = std::make_shared<counteren_csr_t>(proc, CSR_HCOUNTEREN); + csrmap[CSR_HCOUNTEREN] = hcounteren = std::make_shared<masked_csr_t>(proc, CSR_HCOUNTEREN, counteren_mask, 0); csrmap[CSR_HTVAL] = htval = std::make_shared<basic_csr_t>(proc, CSR_HTVAL, 0); csrmap[CSR_HTINST] = htinst = std::make_shared<basic_csr_t>(proc, CSR_HTINST, 0); csrmap[CSR_HGATP] = hgatp = std::make_shared<hgatp_csr_t>(proc, CSR_HGATP); |