RISC DIV & MMULT Instructions

Let's get coding!

Moderator: a31chris

Post Reply
User avatar
a31chris
Jaguar MOD
Posts: 845
Joined: Mon Apr 01, 2013 7:09 am

RISC DIV & MMULT Instructions

Post by a31chris » Mon Feb 24, 2014 7:44 pm

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

DIV Rn,Rm

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.
What came after the Jaguar was the PS1 which for all it's greatness, ushered in corporate development and with it the bleached, repetitive, bland titles which for the most part we're still playing today. - David Wightman

User avatar
a31chris
Jaguar MOD
Posts: 845
Joined: Mon Apr 01, 2013 7:09 am

Re: RISC DIV & MMULT Instructions

Post by a31chris » Mon Feb 24, 2014 7:46 pm

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.
What came after the Jaguar was the PS1 which for all it's greatness, ushered in corporate development and with it the bleached, repetitive, bland titles which for the most part we're still playing today. - David Wightman

Post Reply