26 May 2013

Adding two Integer values in DLX



Adding two Integers from two Registers Example code:
1:  Add r1,r2,r3 ;r1=r2+r3  
Explanation of code:
1:  #r1 register=0  
2:  #r2 register=1  
3:  #r3 register=2  
4:  //before execution  
5:  Add r1,r2,r3 ;r1=r2+r3  
6:  //after execution  
7:  #r1 register=3  
8:  #r2 register=1  
9:  #r3 register=2  


Adding a register with immediate value Example code
1:  addi r1,r2,100  
Explanation of code
1:  #r1 register=0  
2:  #r2 register=1  
3:  //before execution  
4:  addi r1,r2,100  
5:  //after execution  
6:  #r1 register=101  
7:  #r2 register=1  



Addition Commands on DLX
1:  add r1,r2,r3   ;Adding Signed integers  
2:  addi r1,r2,100 ;Adding Signed integers Immediate  
3:  addu r1,r2,r3   ;Adding Unsigned integers  
4:  addui r1,r2,100 ;Adding Unsigned integers Immediate  

0 comments:

Post a Comment

Popular Posts