When implementing the "C" extension set, I didn't implement instruction encoding like I did for the other instruction formats.
Be sure to add all the appropriate test cases, using encoding_test to ensure that decoding some bytes then re-encoding them again produces the original bytes. Here's an example test:
|
encoding_test( |
|
&[183, 2, 1, 0], |
|
Instruction::U { |
|
opcode: Opcode::Lui, |
|
imm: 0x10000, |
|
rd: Register::T0, |
|
}, |
|
); |
Instruction formats
These instruction formats are documented in Chapter 12 ("C” Standard Extension for Compressed Instructions, Version 2.0) of the RISC-V specification:
When implementing the "C" extension set, I didn't implement instruction encoding like I did for the other instruction formats.
Be sure to add all the appropriate test cases, using
encoding_testto ensure that decoding some bytes then re-encoding them again produces the original bytes. Here's an example test:riscy/isa/src/lib.rs
Lines 155 to 162 in 2cee748
Instruction formats
These instruction formats are documented in Chapter 12 ("C” Standard Extension for Compressed Instructions, Version 2.0) of the RISC-V specification: