Open shuffle2 opened 3 months ago
I can try to take a look at it. It looks like the default implementation of FLIX is 32/64-bit (I've found some documentation that assumes that), but they extended it to anything up to 128-bits. It's possible to extend it - you'd want to look at the format_decoder text in the binutils code you linked. I haven't delved deep enough into xtensa to understand what the different formats mean, but that's where I would start.
Hi, I recently found https://github.com/flto/ghidra-xtensa-flix after getting a firmware targeting "HiFi4" DSP (https://www.cadence.com/en_US/home/resources/product-briefs/tensilica-hifi-dsp-family-pb.html) and noticing that ghidra does not handle the FLIX-encoded instructions.
To summarize, one of xtensa's main features is that it allows adding custom instructions. FLIX builds on this by providing a standard way to encode VLIW instructions. Some FLIX-encoded instructions are "standard" in the sense that they're predefined and provided along with a given xtensa core, depending on the feature set. A licensee can still replace any FLIX instruction with their own design, but normally this doesn't happen. Generally, FLIX instruction is sized by the number of slots it has (which can execute in parallel). The actual instructions are encoded into the specific slots, with certain slots having limitations.
After trying to port the above repo to current ghidra, I was disappointed to find it didn't Just Work. I think this is because the existing code gives
flixinsn
a size of 64 bits, whereas my firmware happens to be using 6 and 11 byte instructions. For the record, I'm usingxt-objdump.exe --xtensa-core=hifi4_ss_spfpu_7 -m xtensa ...
, and it gives an output something like:So..to make this a question, do you have recommendations about how to go about "properly" adding support for FLIX? Is it worthwhile fixing up the linked plugin, or should I just start over?
note: original extension author points out FLIX encodings can be found in binutils: https://github.com/flto/ghidra-xtensa-flix/issues/1#issuecomment-1833784508