Mistake in the Broadway Manual regarding frsqrte - Printable Version +- Mario Kart Wii Gecko Codes, Cheats, & Hacks (https://mariokartwii.com) +-- Forum: Hacks/Modding (https://mariokartwii.com/forumdisplay.php?fid=14) +--- Forum: Coding & Hacking General Discussion (https://mariokartwii.com/forumdisplay.php?fid=23) +--- Thread: Mistake in the Broadway Manual regarding frsqrte (/showthread.php?tid=2172) |
Mistake in the Broadway Manual regarding frsqrte - Vega - 04-14-2024 Most coders here are familiar with the Broadway Manual. If anybody has also read through it, you will find it littered with diagram mistakes and typoes. Considering it's a preliminary file that was never meant for the public, this is sort of expected. However, I came across a decent mistake (or information left missing) regarding the description of the frsqrte instruction. I've been working on a Broadway PPC Instruction Simulator recently and have to make sure it's as accurate as possible. So I've been combing thru the manual at times. According to the Broadway Manual (page 426), the frsqrte instruction does this~ 1. frB used as input (64-bit input) 2. Reciprocal of Square Root Estimate is performed (within 1/4096 accuracy) 3. frD gets result as 64-bit What's odd is that there is no mention about how the instruction operates in regards to the HID2 PSE bit. I've tried reading other Chapters, and there's nothing explicit. As an fyi, for every single-float instruction (except for fabs, fneg, and fnabs), the operation of said instruction varies depending on whether PSE bit is low or high. For example, the fmr instruction. When HID2 PSE is low 1. Entire Value of frB is copied to frD When HID2 PSE is high 2. ps0 of frB copied to ps0 of frD. ps1 of frD is left UNCHANGED. Another example (fdivs) When HID2 PSE is low 1. Entire value of frA is divided by entire value of frB 2. Result placed in frB as 64-bit form but with single precision ofc When HID2 PSE is high 1. ps0 of frA is divided by ps0 of frB 2. result placed into BOTH ps0 and ps1 of frD Basically in all the single-float math-type instructions, when HID2 PSE is high, ps0 is input and ps0 + ps1 is output. As you can see above, the fmr instruction is an old ball with frD ps1 being unchanged. The frsp instruction is another odd ball to where the frD's ps1 is left undefined (junk). The Broadway Manual has zero information about what occurs for frsqrte in regards to HID2 PSE. Nothing. So anyway I did some tests on Real Hardware and this is what occurs~ When HID2 PSE is low 1. Entire 64-bit frB used for input 2. frD gets result as 64-bits When HID2 PSE is high 1. ps0 of frB is used for input 2. ps0 of frD gets result. ps1 of frD is left UNCHANGED If anyone cares this is the following code I used for confirmation. f1 gets loaded as 4.0, 0.0. f2 gets loaded as 1.25, 1.25. I then perform a frsqrte (with HID2 PSE high) where f1 is frB and f2 is frD. f2 resulted as 0x3EFFF400 3FA00000 (~0.499, 1.25). ps0 of f2 didn't result exactly as 0.5, this is expected due to the 1/4096 accuracy effect. In conclusion this information is missing from the 1.0 version of the Broadway Manual which is the latest version afaik. Code: #C2 Address 807BA164 |