Refer to LICENSE in some newer source files
[riscv-isa-sim.git] / riscv / extension.cc
1 // See LICENSE for license details.
2
3 #include "extension.h"
4 #include "trap.h"
5
6 extension_t::~extension_t()
7 {
8 }
9
10 void extension_t::illegal_instruction()
11 {
12 throw trap_illegal_instruction();
13 }
14
15 void extension_t::raise_interrupt()
16 {
17 int priv = get_field(p->get_state()->mstatus, MSTATUS_PRV);
18 int ie = get_field(p->get_state()->mstatus, MSTATUS_IE);
19
20 if (priv < PRV_M || (priv == PRV_M && ie)) {
21 p->raise_interrupt(IRQ_COP);
22 }
23
24 throw std::logic_error("a COP exception was posted, but interrupts are disabled!");
25 }
26
27 void extension_t::clear_interrupt()
28 {
29 }