70 likes | 196 Views
XC878 Product Presentation. Multiplication/Division Unit (MDU). Operating Phases of the MDU. Phase 1: Load Registers - set SYSCON0.RMAP bit to 1 to access MDU register; - set MD0-MD5 to operands value according to type of operation. Operating Phases of the MDU. Phase 2: Execute calculation
E N D
XC878 Product Presentation Multiplication/Division Unit (MDU)
Operating Phases of the MDU • Phase 1: Load Registers - set SYSCON0.RMAP bit to 1 to access MDU register; - set MD0-MD5 to operands value according to type of operation.
Operating Phases of the MDU • Phase 2: Execute calculation - set the desired MDUCON.OPCODE - set MDUCON.RSEL to 1. - set the MDUCON.START bit to start calculation
Operating Phases of the MDU • Phase 3: Read result from the MRx registers - check the MDUSTAT.BSY is 0 which indicate calculation is finished - set the MDUCON.RSEL to 0 to read out the result from MRx register.
Sample code of MDU_01 example • A subroutine for unsigned 16-bit multiplication in MDU_01 example.
MDU_Example HOT • In the MDU_01 example, the main.c will do unsigned 16bit multiplication, unsigned 32bit division, signed 16bit multiplication and Arithmetic right shift. The result obtained will stored in bb, aa, cc and dd respectively, which could be observed using the debugger.