14 Jul 2013

Multiplication in DLX programming


When we multiply or divide unsigned numbers, we must use logical shifts, as we will now see.We can multiply 2 the power values by just shifting bits in left 

Example multiply by 2

 addui r1,r0,25  
 slli r2,r1,1  ;2^1
 ;r2=25X2=50  

Example multiply by 4
 addui r1,r0,25  
 slli r2,r1,2  ;2^2
 ;r2=25X4=100  

Example multiply by 8
 addui r1,r0,25  
 slli r2,r1,3  ;2^3
 ;r2=25X8=200  


Tags:Multiplication on dlx, Multiply registers in DLX, DLX Multiplication

0 comments:

Post a Comment

Popular Posts