File tree 1 file changed +22
-0
lines changed
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -806,4 +806,26 @@ mod tests {
806
806
interpret_itype ( & mut dummy_env, ITypeInstruction :: BranchEqZeroJump ) ;
807
807
assert_eq ! ( dummy_env. instruction_pointer, ip + ( 10 + 1 ) * 4 ) ;
808
808
}
809
+
810
+ #[ test]
811
+ fn test_unit_jal_instruction ( ) {
812
+ let mut dummy_env = dummy_env ( ) ;
813
+ let ip = dummy_env. instruction_pointer ;
814
+ // 0b00001100000000011110101111001001
815
+ // jal 0x7af24
816
+ dummy_env. instruction_parts = InstructionParts {
817
+ op_code : 0b000011 ,
818
+ rs : 0b00000 ,
819
+ rt : 0b00001 ,
820
+ rd : 0b11101 ,
821
+ shamt : 0b01111 ,
822
+ funct : 0b001001 ,
823
+ } ;
824
+ interpret_jtype ( & mut dummy_env, JTypeInstruction :: JumpAndLink ) ;
825
+ assert_eq ! ( dummy_env. instruction_pointer, 0x7af24 ) ;
826
+ assert_eq ! (
827
+ dummy_env. registers. general_purpose[ REGISTER_RA as usize ] ,
828
+ ip + 4
829
+ ) ;
830
+ }
809
831
}
You can’t perform that action at this time.
0 commit comments