Skip to content

Commit

Permalink
[update] rename Uncategorized to NoOperand
Browse files Browse the repository at this point in the history
  • Loading branch information
Alignof committed Oct 2, 2024
1 parent 982a9d8 commit fef01ef
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ impl Display for Instruction {
InstFormat::OnlyRs2 => {
write!(f, "{} {}", self.opc, reg2str(self.rs2.unwrap()),)
}
InstFormat::Uncategorized => match self.opc {
InstFormat::NoOperand => match self.opc {
OpcodeKind::BaseI(BaseIOpcode::ECALL | BaseIOpcode::EBREAK)
| OpcodeKind::Zifencei(ZifenceiOpcode::FENCE)
| OpcodeKind::C(COpcode::NOP | COpcode::EBREAK)
Expand Down Expand Up @@ -395,14 +395,14 @@ pub enum InstFormat {
/// ```
ALrFormat,

/// Uncategorized format
/// NoOperand format
/// ```ignore
/// ecall
/// wfi
/// mret
/// c.ebreak
/// ```
Uncategorized,
NoOperand,

/// Only rd name
/// ```ignore
Expand Down
2 changes: 1 addition & 1 deletion src/instruction/base_i.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ impl Opcode for BaseIOpcode {
}
BaseIOpcode::JAL => InstFormat::JFormat,
BaseIOpcode::LUI | BaseIOpcode::AUIPC => InstFormat::UFormat,
BaseIOpcode::ECALL | BaseIOpcode::EBREAK => InstFormat::Uncategorized,
BaseIOpcode::ECALL | BaseIOpcode::EBREAK => InstFormat::NoOperand,
}
}
}
4 changes: 2 additions & 2 deletions src/instruction/c_extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl Opcode for COpcode {
COpcode::LI | COpcode::ADDI | COpcode::ADDIW | COpcode::ADDI16SP | COpcode::LUI => {
InstFormat::CiFormat
}
COpcode::NOP => InstFormat::Uncategorized,
COpcode::NOP => InstFormat::NoOperand,
COpcode::SUB
| COpcode::XOR
| COpcode::OR
Expand All @@ -115,7 +115,7 @@ impl Opcode for COpcode {
COpcode::LDSP | COpcode::SLLI | COpcode::LWSP => InstFormat::CiFormat,
COpcode::SDSP | COpcode::SWSP => InstFormat::CssFormat,
COpcode::JR | COpcode::JALR | COpcode::MV | COpcode::ADD => InstFormat::CrFormat,
COpcode::EBREAK => InstFormat::Uncategorized,
COpcode::EBREAK => InstFormat::NoOperand,
}
}
}
8 changes: 4 additions & 4 deletions src/instruction/opcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ impl OpcodeKind {
}
OpcodeKind::JAL => InstFormat::Jformat,
OpcodeKind::LUI | OpcodeKind::AUIPC => InstFormat::Uformat,
OpcodeKind::ECALL | OpcodeKind::FENCE | OpcodeKind::EBREAK => InstFormat::Uncategorized,
OpcodeKind::ECALL | OpcodeKind::FENCE | OpcodeKind::EBREAK => InstFormat::NoOperand,

// Zicsr
OpcodeKind::CSRRW | OpcodeKind::CSRRS | OpcodeKind::CSRRC => InstFormat::CSRformat,
OpcodeKind::CSRRWI | OpcodeKind::CSRRSI | OpcodeKind::CSRRCI => InstFormat::CSRuiformat,

// Privileged
OpcodeKind::SRET | OpcodeKind::MRET | OpcodeKind::WFI => InstFormat::Uncategorized,
OpcodeKind::SRET | OpcodeKind::MRET | OpcodeKind::WFI => InstFormat::NoOperand,
OpcodeKind::SFENCE_VMA => InstFormat::Rformat,

// Multiplication and Division
Expand Down Expand Up @@ -119,7 +119,7 @@ impl OpcodeKind {
| OpcodeKind::C_ADDIW
| OpcodeKind::C_ADDI16SP
| OpcodeKind::C_LUI => InstFormat::CIformat,
OpcodeKind::C_NOP => InstFormat::Uncategorized,
OpcodeKind::C_NOP => InstFormat::NoOperand,
OpcodeKind::C_SUB
| OpcodeKind::C_XOR
| OpcodeKind::C_OR
Expand All @@ -132,7 +132,7 @@ impl OpcodeKind {
OpcodeKind::C_JR | OpcodeKind::C_JALR | OpcodeKind::C_MV | OpcodeKind::C_ADD => {
InstFormat::CRformat
}
OpcodeKind::C_EBREAK => InstFormat::Uncategorized,
OpcodeKind::C_EBREAK => InstFormat::NoOperand,
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/instruction/priv_extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl Display for PrivOpcode {
impl Opcode for PrivOpcode {
fn get_format(&self) -> InstFormat {
match self {
PrivOpcode::SRET | PrivOpcode::MRET | PrivOpcode::WFI => InstFormat::Uncategorized,
PrivOpcode::SRET | PrivOpcode::MRET | PrivOpcode::WFI => InstFormat::NoOperand,
PrivOpcode::SFENCE_VMA => InstFormat::RFormat,
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/instruction/zicfiss_extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl Opcode for ZicfissOpcode {
ZicfissOpcode::SSPOPCHK => InstFormat::OnlyRs2,
ZicfissOpcode::SSRDP => InstFormat::OnlyRd,
ZicfissOpcode::SSAMOSWAP_W | ZicfissOpcode::SSAMOSWAP_D => InstFormat::AFormat,
ZicfissOpcode::C_SSPUSH | ZicfissOpcode::C_SSPOPCHK => InstFormat::Uncategorized,
ZicfissOpcode::C_SSPUSH | ZicfissOpcode::C_SSPOPCHK => InstFormat::NoOperand,
}
}
}
2 changes: 1 addition & 1 deletion src/instruction/zifencei_extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl Display for ZifenceiOpcode {
impl Opcode for ZifenceiOpcode {
fn get_format(&self) -> InstFormat {
match self {
ZifenceiOpcode::FENCE => InstFormat::Uncategorized,
ZifenceiOpcode::FENCE => InstFormat::NoOperand,
}
}
}

0 comments on commit fef01ef

Please sign in to comment.