Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


Share this Page URL
Help

4.4 Several Useful Instructions in the Cortex-M3 > 4.4.5 Reverse Bit - Pg. 73

4.4 Several Useful Instructions in the Cortex-M3 73 YoucansetuptheDIVBYZERObitintheNVICConfigurationControlRegistersothatwhena dividebyzerooccurs,afaultexception(usagefault)takesplace.Otherwise,<Rd>willbecome0ifa dividebyzerotakesplace. 4.4.4 REV, REVH, and REVSH REVreversesthebyteorderinadataword,andREVHreversesthebyteorderinsideahalfword.For example,ifR0is0x12345678,inexecutingthefollowing: REV R1, R0 REVH R2, R0 R1willbecome0x78563412,andR2willbe0x34127856.REVandREVHareparticularlyusefulfor convertingdatabetweenbigendianandlittleendian. REVSH is similar to REVH except that it only processes the lower half word, and then it sign extendstheresult.Forexample,ifR0is0x33448899,running: REVSH R1, R0 R1willbecome0xFFFF9988.