pub trait ExecutableInstruction<Regs, ExtState, Memory, PC, InstructionHandler, CustomError = CustomErrorPlaceholder>where
Self: ExecutableInstructionOperands + ExecutableInstructionCsr<ExtState, CustomError>,{
// Required method
fn execute(
self,
rs1rs2_values: Rs1Rs2OperandValues<<Self::Reg as Register>::Type>,
regs: &mut Regs,
ext_state: &mut ExtState,
memory: &mut Memory,
program_counter: &mut PC,
system_instruction_handler: &mut InstructionHandler,
) -> Result<ControlFlow<(), (Self::Reg, <Self::Reg as Register>::Type)>, ExecutionError<<<Self as Instruction>::Reg as Register>::Type, CustomError>>;
}Expand description
Trait for executable instructions
Required Methods§
Sourcefn execute(
self,
rs1rs2_values: Rs1Rs2OperandValues<<Self::Reg as Register>::Type>,
regs: &mut Regs,
ext_state: &mut ExtState,
memory: &mut Memory,
program_counter: &mut PC,
system_instruction_handler: &mut InstructionHandler,
) -> Result<ControlFlow<(), (Self::Reg, <Self::Reg as Register>::Type)>, ExecutionError<<<Self as Instruction>::Reg as Register>::Type, CustomError>>
fn execute( self, rs1rs2_values: Rs1Rs2OperandValues<<Self::Reg as Register>::Type>, regs: &mut Regs, ext_state: &mut ExtState, memory: &mut Memory, program_counter: &mut PC, system_instruction_handler: &mut InstructionHandler, ) -> Result<ControlFlow<(), (Self::Reg, <Self::Reg as Register>::Type)>, ExecutionError<<<Self as Instruction>::Reg as Register>::Type, CustomError>>
Execute instruction.
Instructions might place additional constraints on ExtState to require additional
registers or other resources. If no such constraint is used, () can be used as a
placeholder.
On success Ok(ControlFlow::Continue((rd, rd_value))) is returned, which will be written
into the register file. In most cases this is the only register that needs to be written. If
no value needs to be written, Ok(ControlFlow::Continue(Default::default())) should be
returned, which corresponds to Ok(ControlFlow::Continue(Reg::ZERO, 0)) and is no-op.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.