Adding a new ATTILA instruction Public

From AttilaWiki

Jump to:navigation, search

How to add a new instruction in the ATTILA shader

1) Add the new opcode to the ShOpcode enum type in ShaderInstruction.h

2) Add the new opcode to the translateShOpcodeTable table in ShaderInstruction.cpp

3) Add the new opcode disassembled name to the shOpcode2Str table in ShaderInstruction.cpp

4) If the new instruction requires specific decoding add the required code in the ShaderInstruction(u8bit *code) function in ShaderInstruction.cpp

5) If the new instruction requires specific encoding add the required code in the ShaderInstruction(<instr params>) function in ShaderInstruction.cpp

6) If the new instruction requires specific assembling add the required code in the assemble(char *line, string &errorString) function in ShaderInstruction.cpp

7) If the new instruction requires specific disassembling add the required code in the disassemble(char *dis) function in ShaderInstruction.cpp

8) Add the new instruction opcode to the setNumOperands function in ShaderInstruction.cpp

9) Add the new instruction opcode to the setIsScalar function in ShaderInstruction.cpp

10) Add the new instruction opcode to the setIsSOACompatible function in ShaderInstruction.cpp

11) Add the new instruction opcode to the setHasResult function in ShaderInstruction.cpp if required

12) Define the emulation function for the new instruction in ShaderEmulator.h

13) Implement the emulation function for the new instruction in ShaderEmulator.cpp

14) Add the emulation function for the new instruction in the shInstrEmulationTable table in ShaderEmulator.cpp

15) Add the throughput and latency of the new instruction to the *RepeatRateTable *ExecLatencyTable tables defined in ShaderArchitectureParameters.cpp

16) If the new instruction requires specific simulator behavior add the required code in ShaderDecodeExecute.cpp or VectorShaderDecodeExecute.cpp

17) Modify ShaderOptimization.cpp as required

ATTILA
Toolbox