forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

VFPU instruction set

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
holger



Joined: 18 Aug 2005
Posts: 204

PostPosted: Fri Sep 23, 2005 2:36 am    Post subject: VFPU instruction set Reply with quote

hi,

where are informations about the VFPU instruction set collected and documented? What is already supported by the toolchain, what is tested, what's known to work and what not?
Back to top
View user's profile Send private message
Warren



Joined: 24 Jan 2004
Posts: 173
Location: San Diego, CA

PostPosted: Fri Sep 23, 2005 5:34 am    Post subject: Reply with quote

No VFPU instructions are currently supported by the compiler. There is however, support for them in the disassembler.

I have been trying to get ahold of Stefan- for the past week without success to get an idea of his progress with VFPU instrs.
Back to top
View user's profile Send private message
AudioMonster



Joined: 07 Sep 2005
Posts: 37

PostPosted: Fri Sep 23, 2005 6:28 am    Post subject: Reply with quote

I would also be extremely interested in those instructions :)
Back to top
View user's profile Send private message Visit poster's website
holger



Joined: 18 Aug 2005
Posts: 204

PostPosted: Fri Sep 23, 2005 7:37 am    Post subject: Reply with quote

Warren wrote:
No VFPU instructions are currently supported by the compiler. There is however, support for them in the disassembler.


are you talking about objdump in the toolchain? Doesn't this mean symmetric support in the assembler and disassembler? What exactly would need to get done, what's the current status? Would it be possible to use the macro assembler to emit the required instructions? (for a start I'd like to implement swizzling and color component reversal/swap, here we only need load/store/shift/and/or).
Back to top
View user's profile Send private message
AudioMonster



Joined: 07 Sep 2005
Posts: 37

PostPosted: Fri Sep 23, 2005 8:37 am    Post subject: Reply with quote

I am more interested in floating point matrixes multiplication and vector multiplications and additions. Is it already possible to use the VFPU to do that , at this point ?
Back to top
View user's profile Send private message Visit poster's website
Warren



Joined: 24 Jan 2004
Posts: 173
Location: San Diego, CA

PostPosted: Fri Sep 23, 2005 10:03 am    Post subject: Reply with quote

Did you not see "No VFPU instructions are currently supported by the compiler"?

And by compiler I should have said assembler
Back to top
View user's profile Send private message
AudioMonster



Joined: 07 Sep 2005
Posts: 37

PostPosted: Fri Sep 23, 2005 10:06 am    Post subject: Reply with quote

Yeah i don't care if the compiler does not support it ... as long as i can directly use it via assembly. Too bad :(
Back to top
View user's profile Send private message Visit poster's website
stefan



Joined: 14 Nov 2004
Posts: 10

PostPosted: Fri Sep 23, 2005 2:09 pm    Post subject: Reply with quote

The disassembler should support all VFPU opcodes. The assembler is missing support for register operands, rotate operands, and macro instructions. The VFPU register syntax is extremely difficult to support, because there are many different variants that can be used depending on the instruction or context.

Without support for register operands the VFPU assembler is useless. I do not have a ETA on when assembler support will be finished.
Back to top
View user's profile Send private message
AudioMonster



Joined: 07 Sep 2005
Posts: 37

PostPosted: Sat Sep 24, 2005 1:30 am    Post subject: Reply with quote

Stefan could you point me on any kind documentation regarding the VFPU ? Like the instruction set and so on ?

The VFPU and Virtual Mobile Engine are my 2 main items of interest on the PSP ! ( and i guess it's not tomorrow that we'll learn how to program the VME ).
Back to top
View user's profile Send private message Visit poster's website
holger



Joined: 18 Aug 2005
Posts: 204

PostPosted: Sat Sep 24, 2005 3:14 am    Post subject: Reply with quote

:) and I guess there is no public documentation -- we'll need to start to write it on our own...
Back to top
View user's profile Send private message
AudioMonster



Joined: 07 Sep 2005
Posts: 37

PostPosted: Sun Sep 25, 2005 5:26 pm    Post subject: Reply with quote

Looking at mips-opc.c :
http://svn.pspdev.org/filedetails.php?repname=psp&path=%2Ftrunk%2Fbinutils-psp%2Fopcodes%2Fmips-opc.c&rev=0&sc=0

i see all the VFPU opcodes that Stefan is talking about.

I have a few questions about them.
I am sorry if they sound moronic, but i am not familiar at all with FPU dedicated to 3D operations, and at this point, i have no fu..... manual to read :(
Feel free to point me out on some other kind of VFPU that may give me some clue about the PSP VFPU.

* How were the opcodes names determined ? Especially the non-obvious ones like vidt, vhtfm2, vbfy1, vhdp and so on ? Did you actually test the instruction, check what it did and gave it a name by yourself ?
* What do the .p .q .s .t which often follow the opcodes names mean ? Is it a way to select what group(s) of registers are used during the operation ? ( I've read there are 128 32bits registers ... )
* How to read the "args" part of each opcode entry in the file, like "?v7z,?s7y,?t7x" for vmmul.q ?

I am aware that i cannot use those instructions yet, but i could get a clue on what are the capabilities of the VFPU if someone can answer those questions. If you could even say more that wouldn't hurt :)
Back to top
View user's profile Send private message Visit poster's website
AudioMonster



Joined: 07 Sep 2005
Posts: 37

PostPosted: Sun Sep 25, 2005 5:35 pm    Post subject: Reply with quote

Oh, and ... looking at the vadd instruction in particular, there are :

"vadd.q", "?d3d,?s3s,?t3t",
"vadd.t", "?d2d,?s2s,?t2t",
"vadd.p", "?d1d,?s1s,?t1t",
"vadd.s", "?d0d,?s0s,?t0t",

same for vmul, vsub, vdot and other basic operations.

So, are those .p .q .s .t actually refering to some independant units of the VFPU so it is possible to achieve 4 instructions in parallel ( one per unit ) ?

Would be great.
Back to top
View user's profile Send private message Visit poster's website
ector



Joined: 12 May 2005
Posts: 195

PostPosted: Sun Sep 25, 2005 6:19 pm    Post subject: Reply with quote

i believe the s p t q mean single, pair, triplet, quad.
_________________
http://www.dtek.chalmers.se/~tronic/PSPTexTool.zip Free texture converter for PSP with source. More to come.
Back to top
View user's profile Send private message
holger



Joined: 18 Aug 2005
Posts: 204

PostPosted: Sun Sep 25, 2005 10:18 pm    Post subject: Reply with quote

On a first glance a lot of the stuff looks a bit similiar like the SSE/SEE2 and Altivec instruction set, there seem to be some similiarities. The SSE spec is available for download on the Intel website, the Altivec one on the Motorola website (or was it IBM?). There is also a MIPS-3D SIMD instructions set spec available on mips.com, but I don't know this one.

Registers are usually 128 bit wide and can get accessed as 2 double words (64bit), 4 words (32bits), 8 short words (16bit), or 16 bytes, specified by the instruction suffix. Some instructions work on floats only, some on integer words.

Most instructions work in parallel on all words in the register (although there are exceptions, like masked and swizzle instructions). Usually SIMD instructions don't throw FPU exceptions, but the SIMD registers have seperate exception flags that either need to get checked manually or can get used by some of the conditional instructions (e.g. conditional moves).
Back to top
View user's profile Send private message
stefan



Joined: 14 Nov 2004
Posts: 10

PostPosted: Mon Sep 26, 2005 2:20 am    Post subject: Reply with quote

The VFPU opcodes come from pspgcc_131.tgz that has been floating around for quite sometime. I didn't add them, mrbrown did. I just started working on the assembler after he dropped out of PSP homebrew. Information for the VFPU assembler comes from the same place, that's why it's so difficult to implement register operand support from reversed psp-gas code.

It's true the suffixes work on different size chunks of data - single, paired, triple, quad. The VFPU can only work with vectors (and matrices) of floats. It knows nothing about the classic SIMD types (16 bytes, 8 halfwords, 4 words, etc.). It cannot issue multiple instructions per operand size AFAIK. The registers are accessed in a specific configuration to give you vectors and matrices depending on the type of instruction or operand you use. You can use special prefix instructions to modify the data for an subsequent instruction, for example, you can "swizzle" the x, y, z, w from a source register before it's operated on.

Unless Sony releases VFPU documentation to the world (not likely) it will be up to the community to document this beast. Throw the SSE/SSE2 and Altivec manual out the window, it's next to useless.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group