14 Jul 2013

Division in DLX programming

When we multiply or divide unsigned numbers, we must use logical shifts, as we will now see.

Example 1

  addui r1,r0,200   
  srli r2,r1,1 ;2^1  
  ;r2=200/2=100  
Example 2
  addui r1,r0,200   
  srli r2,r1,2 ;2^2  
  ;r2=200/4=50  
Example 3
  addui r1,r0,200   
  srli r2,r1,3 ;2^3  
  ;r2=200/8=25  
Tags:Division in DLX programming,Divide instruction on DLX,DLX divide function

0 comments:

Post a Comment

Popular Posts