c.ebreak
Breakpoint exception
- Extension
- C
- XLEN
- RV32 and RV64
- Assembly (riscv-unified-db)
c.ebreak- Length
- 16-bit (compressed)
Encoding
| 1513 | 12 | 112 | 10 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 100 | 1 | 0000000000 | 10 | ||||||||||||
Match 0x9002, mask 0xffff. Source: c.ebreak 1..0=2 15..13=4 12=1 11..2=0 in riscv-opcodes/extensions/rv_c.
Description
The C.EBREAK instruction is used by debuggers to cause control to be transferred back to a debugging environment. Unless overridden by an external debug environment, C.EBREAK raises a breakpoint exception and performs no other operation.
Note: As described in the C Standard Extension for Compressed Instructions, the c.ebreak
instruction performs the same operation as the EBREAK instruction.
EBREAK causes the receiving privilege mode's epc register to be set to the address of
the EBREAK instruction itself, not the address of the following instruction.
As EBREAK causes a synchronous exception, it is not considered to retire,
and should not increment the minstret CSR.
Description from riscv-unified-db, reformatted.
Operation
if (implemented?(ExtensionName::C) && MISA_CSR_IMPLEMENTED && (CSR[misa].C == 1'b0)) {
reserved_instruction($encoding);
}
if (TRAP_ON_EBREAK) {
raise_precise(ExceptionCode::Breakpoint, mode(), $pc);
} else {
eei_ebreak();
}Pseudocode in riscv-unified-db’s IDL, quoted unchanged.