Absolutely. I only wanted you to know the code does exist, and runs with the timings I said in my post, using WinMIPS64. (As you probably know, I prefer to explain or show the basis of my claims,...
Type: Posts; User: Nominal Animal
Absolutely. I only wanted you to know the code does exist, and runs with the timings I said in my post, using WinMIPS64. (As you probably know, I prefer to explain or show the basis of my claims,...
There is a formula for it, but I didn't bother rediscovering it or looking it up: I just checked it in a loop (comparing data/1000 to the value obtained using the multiply by reciprocal method) and...
I just wrote and checked the code I described above in #12. It runs with just one "branch taken stall" per iteration, no other stalls (in particular, zero RAW stalls), and runs in about 17 × values +...
It's the reciprocal of 1000 using 31-bit integers:
231 / 1000 = 2147483648 / 1000 = 2147483.648 ≃ 2147484
The value is rounded up, because that gives the correct integer result in a larger...
Well, instead of multiplying by the reciprocal, you can use slt or slti to evaluate
counter_offset = ( 5 - (value < 5000) ? 1 : 0) - (value < 4000) ? 1 : 0) - (value < 3000) ? 1 : 0) - (value <...
Oh! It's the Windows 64-bit MIPS simulator! I kind-of assumed you used a real-world 32-bit microcontroller. First, let me explain what my example code does, and why:
When a value is negative, the...
I'm on roughly the same path with Salem's first suggestion, but I'd go a lot further.
Because the divisor is a constant, you don't need real division; you can multiply by the reciprocal instead.
...