Page 1 of 1

RISC DIV & MMULT Instructions

Posted: Mon Feb 24, 2014 7:44 pm
by a31chris
SubQMod wrote:Can someone break down and explain the RISC DIV (16.16 part of it) and the MMULT (Matrix Multiply) command for me please, maybe with an example input and output to it (nothing too in depth, just the concept).

Would be most grateful


When you divide 16.16 you need to make sure a bit is set in the GPU
G_DIVCTRL register. What will happen is you execute the

the divider circuit in the JAgur is in parallel with the alu
so you have the GPU executing other instructions

div r0,r1(or what ever registers you want)
do something for 18 cycles

Then you may read the result or divide again. Otherwise if you try to read
it too early, your result may be incorrect as the divide may not have been
completed yet. however you can do a few other instrctions with the GPU
while waitng fo the devide to complete.This is the beauty of the parallel
math units in the Jaguar

Either mode of division leaves a remainder in the G_REMAIN register of the GPU.
both are also unsigned results....positive numbers only.

MMULT another time my friend.
Ahh, many thanks Frog for your assistance - I look forward to MMULT another time.

One of the things I have been doing is optimising my GPU/DSP emulation cores with Intel asm ( ). This has given me a great speed increase for the emulation but it reminds me so much of how much I hate x86 assembler - much prefer MIPS or other RISC based systems.

Re: RISC DIV & MMULT Instructions

Posted: Mon Feb 24, 2014 7:46 pm
by a31chris
JagMod wrote: The problem with MMULT is that you can't use it if you have interrupts enabled.
Not too useful.
Basically don't bother to learn how MMULT works, just use IMULTN, IMACN, and RESMAC instead.