Skip to content

Add instruction encoding for "C" extension #3

Description

@michaelmelanson

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:

riscy/isa/src/lib.rs

Lines 155 to 162 in 2cee748

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:

  • CIW
  • CS
  • CL
  • CI
  • CNOP / CB
  • CA
  • CJ
  • CR
  • CSS

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions