#ifndef morpheo_behavioural_Constants_h #define morpheo_behavioural_Constants_h namespace morpheo { namespace behavioural { //=========================================================[ Type ]===== # define TYPE_ALU 0x0 // 00000 - unit multiple # define TYPE_SHIFT 0x1 // 00000 - unit multiple # define TYPE_MOVE 0x2 // 00000 - unit multiple # define TYPE_TEST 0x3 // 00000 - unit multiple # define TYPE_MUL_DIV 0x4 // 00000 - unit multiple # define TYPE_EXTEND 0x5 // 00000 - unit multiple, type optionnal # define TYPE_FIND 0x6 // 00000 - unit multiple, type optionnal # define TYPE_SPECIAL 0x7 // 00000 - unit uniq # define TYPE_CUSTOM 0x8 // 00000 - unit uniq , type optionnal # define TYPE_BRANCH 0x9 // 00000 - unit multiple # define TYPE_MEMORY 0xa // 00000 - unit uniq # define SIZE_TYPE 5 # define MAX_TYPE (1< incondionnal # define BRANCH_STATE_SPEC_NTAKE 0x2 // 1 0 # define BRANCH_STATE_SPEC_TAKE 0x3 // 1 1 //---------------------------------------------[ branch_condition ]----- # define SIZE_BRANCH_CONDITION 4 # define BRANCH_CONDITION_NONE_WITHOUT_WRITE_STACK 0x0 // None condition (jump) # define BRANCH_CONDITION_NONE_WITH_WRITE_STACK 0x8 // None condition (jump) # define BRANCH_CONDITION_FLAG_UNSET 0x2 // Branch if Flag is clear # define BRANCH_CONDITION_FLAG_SET 0x3 // Branch if Flag is set # define BRANCH_CONDITION_READ_REGISTER_WITHOUT_WRITE_STACK 0x4 // Branch if a register is read # define BRANCH_CONDITION_READ_REGISTER_WITH_WRITE_STACK 0xc // Branch if a register is read # define BRANCH_CONDITION_READ_STACK 0xf // Branch with pop in stack pointer //--------------------------------------------------[ instruction ]----- # define NB_INSTRUCTION 213 // 92 ORBIS, 30 ORFPX (15 simple, 15 double), 91 ORVDX (38 on byte, 41 on half, 12 independant format) enum { // ORBIS INSTRUCTION_L_ADD, INSTRUCTION_L_ADDC, INSTRUCTION_L_ADDI, INSTRUCTION_L_ADDIC, INSTRUCTION_L_AND, INSTRUCTION_L_ANDI, INSTRUCTION_L_BF, INSTRUCTION_L_BNF, INSTRUCTION_L_CMOV, INSTRUCTION_L_CSYNC, INSTRUCTION_L_CUST1, INSTRUCTION_L_CUST2, INSTRUCTION_L_CUST3, INSTRUCTION_L_CUST4, INSTRUCTION_L_CUST5, INSTRUCTION_L_CUST6, INSTRUCTION_L_CUST7, INSTRUCTION_L_CUST8, INSTRUCTION_L_DIV, INSTRUCTION_L_DIVU, INSTRUCTION_L_EXTBS, INSTRUCTION_L_EXTBZ, INSTRUCTION_L_EXTHS, INSTRUCTION_L_EXTHZ, INSTRUCTION_L_EXTWS, INSTRUCTION_L_EXTWZ, INSTRUCTION_L_FF1, INSTRUCTION_L_FL1, INSTRUCTION_L_J, INSTRUCTION_L_JAL, INSTRUCTION_L_JALR, INSTRUCTION_L_JR, INSTRUCTION_L_LBS, INSTRUCTION_L_LBZ, INSTRUCTION_L_LD, INSTRUCTION_L_LHS, INSTRUCTION_L_LHZ, INSTRUCTION_L_LWS, INSTRUCTION_L_LWZ, INSTRUCTION_L_MAC, INSTRUCTION_L_MACI, INSTRUCTION_L_MACRC, INSTRUCTION_L_MFSPR, INSTRUCTION_L_MOVHI, INSTRUCTION_L_MSB, INSTRUCTION_L_MSYNC, INSTRUCTION_L_MTSPR, INSTRUCTION_L_MUL, INSTRUCTION_L_MULI, INSTRUCTION_L_MULU, INSTRUCTION_L_NOP, INSTRUCTION_L_OR, INSTRUCTION_L_ORI, INSTRUCTION_L_PSYNC, INSTRUCTION_L_RFE, INSTRUCTION_L_ROR, INSTRUCTION_L_RORI, INSTRUCTION_L_SB, INSTRUCTION_L_SD, INSTRUCTION_L_SFEQ, INSTRUCTION_L_SFEQI, INSTRUCTION_L_SFGES, INSTRUCTION_L_SFGESI, INSTRUCTION_L_SFGEU, INSTRUCTION_L_SFGEUI, INSTRUCTION_L_SFGTS, INSTRUCTION_L_SFGTSI, INSTRUCTION_L_SFGTU, INSTRUCTION_L_SFGTUI, INSTRUCTION_L_SFLES, INSTRUCTION_L_SFLESI, INSTRUCTION_L_SFLEU, INSTRUCTION_L_SFLEUI, INSTRUCTION_L_SFLTS, INSTRUCTION_L_SFLTSI, INSTRUCTION_L_SFLTU, INSTRUCTION_L_SFLTUI, INSTRUCTION_L_SFNE, INSTRUCTION_L_SFNEI, INSTRUCTION_L_SH, INSTRUCTION_L_SLL, INSTRUCTION_L_SLLI, INSTRUCTION_L_SRA, INSTRUCTION_L_SRAI, INSTRUCTION_L_SRL, INSTRUCTION_L_SRLI, INSTRUCTION_L_SUB, INSTRUCTION_L_SW, INSTRUCTION_L_SYS, INSTRUCTION_L_TRAP, INSTRUCTION_L_XOR, INSTRUCTION_L_XORI, // ORFPX INSTRUCTION_LF_ADD_D, INSTRUCTION_LF_ADD_S, INSTRUCTION_LF_CUST1_D, INSTRUCTION_LF_CUST1_S, INSTRUCTION_LF_DIV_D, INSTRUCTION_LF_DIV_S, INSTRUCTION_LF_FTOI_D, INSTRUCTION_LF_FTOI_S, INSTRUCTION_LF_ITOF_D, INSTRUCTION_LF_ITOF_S, INSTRUCTION_LF_MADD_D, INSTRUCTION_LF_MADD_S, INSTRUCTION_LF_MUL_D, INSTRUCTION_LF_MUL_S, INSTRUCTION_LF_REM_D, INSTRUCTION_LF_REM_S, INSTRUCTION_LF_SFEQ_D, INSTRUCTION_LF_SFEQ_S, INSTRUCTION_LF_SFGE_D, INSTRUCTION_LF_SFGE_S, INSTRUCTION_LF_SFGT_D, INSTRUCTION_LF_SFGT_S, INSTRUCTION_LF_SFLE_D, INSTRUCTION_LF_SFLE_S, INSTRUCTION_LF_SFLT_D, INSTRUCTION_LF_SFLT_S, INSTRUCTION_LF_SFNE_D, INSTRUCTION_LF_SFNE_S, INSTRUCTION_LF_SUB_D, INSTRUCTION_LF_SUB_S, // ORVDX INSTRUCTION_LV_ADD_B, INSTRUCTION_LV_ADD_H, INSTRUCTION_LV_ADDS_B, INSTRUCTION_LV_ADDS_H, INSTRUCTION_LV_ADDU_B, INSTRUCTION_LV_ADDU_H, INSTRUCTION_LV_ADDUS_B, INSTRUCTION_LV_ADDUS_H, INSTRUCTION_LV_ALL_EQ_B, INSTRUCTION_LV_ALL_EQ_H, INSTRUCTION_LV_ALL_GE_B, INSTRUCTION_LV_ALL_GE_H, INSTRUCTION_LV_ALL_GT_B, INSTRUCTION_LV_ALL_GT_H, INSTRUCTION_LV_ALL_LE_B, INSTRUCTION_LV_ALL_LE_H, INSTRUCTION_LV_ALL_LT_B, INSTRUCTION_LV_ALL_LT_H, INSTRUCTION_LV_ALL_NE_B, INSTRUCTION_LV_ALL_NE_H, INSTRUCTION_LV_AND, INSTRUCTION_LV_ANY_EQ_B, INSTRUCTION_LV_ANY_EQ_H, INSTRUCTION_LV_ANY_GE_B, INSTRUCTION_LV_ANY_GE_H, INSTRUCTION_LV_ANY_GT_B, INSTRUCTION_LV_ANY_GT_H, INSTRUCTION_LV_ANY_LE_B, INSTRUCTION_LV_ANY_LE_H, INSTRUCTION_LV_ANY_LT_B, INSTRUCTION_LV_ANY_LT_H, INSTRUCTION_LV_ANY_NE_B, INSTRUCTION_LV_ANY_NE_H, INSTRUCTION_LV_AVG_B, INSTRUCTION_LV_AVG_H, INSTRUCTION_LV_CMP_EQ_B, INSTRUCTION_LV_CMP_EQ_H, INSTRUCTION_LV_CMP_GE_B, INSTRUCTION_LV_CMP_GE_H, INSTRUCTION_LV_CMP_GT_B, INSTRUCTION_LV_CMP_GT_H, INSTRUCTION_LV_CMP_LE_B, INSTRUCTION_LV_CMP_LE_H, INSTRUCTION_LV_CMP_LT_B, INSTRUCTION_LV_CMP_LT_H, INSTRUCTION_LV_CMP_NE_B, INSTRUCTION_LV_CMP_NE_H, INSTRUCTION_LV_CUST1, INSTRUCTION_LV_CUST2, INSTRUCTION_LV_CUST3, INSTRUCTION_LV_CUST4, INSTRUCTION_LV_MADDS_H, INSTRUCTION_LV_MAX_B, INSTRUCTION_LV_MAX_H, INSTRUCTION_LV_MERGE_B, INSTRUCTION_LV_MERGE_H, INSTRUCTION_LV_MIN_B, INSTRUCTION_LV_MIN_H, INSTRUCTION_LV_MSUBS_H, INSTRUCTION_LV_MULS_H, INSTRUCTION_LV_NAND, INSTRUCTION_LV_NOR, INSTRUCTION_LV_OR, INSTRUCTION_LV_PACK_B, INSTRUCTION_LV_PACK_H, INSTRUCTION_LV_PACKS_B, INSTRUCTION_LV_PACKS_H, INSTRUCTION_LV_PACKUS_B, INSTRUCTION_LV_PACKUS_H, INSTRUCTION_LV_PERM_N, INSTRUCTION_LV_RL_B, INSTRUCTION_LV_RL_H, INSTRUCTION_LV_SLL, INSTRUCTION_LV_SLL_B, INSTRUCTION_LV_SLL_H, INSTRUCTION_LV_SRA_B, INSTRUCTION_LV_SRA_H, INSTRUCTION_LV_SRL, INSTRUCTION_LV_SRL_B, INSTRUCTION_LV_SRL_H, INSTRUCTION_LV_SUB_B, INSTRUCTION_LV_SUB_H, INSTRUCTION_LV_SUBS_B, INSTRUCTION_LV_SUBS_H, INSTRUCTION_LV_SUBU_B, INSTRUCTION_LV_SUBU_H, INSTRUCTION_LV_SUBUS_B, INSTRUCTION_LV_SUBUS_H, INSTRUCTION_LV_UNPACK_B, INSTRUCTION_LV_UNPACK_H, INSTRUCTION_LV_XOR }; //-----------------------------------------------[ Code Operation ]----- # define MAX_OPCOD_0 64 // Instructions with immediat # define MAX_OPCOD_1 64 // Instruction ORFPX32/64 # define MAX_OPCOD_2 256 // Instruction ORVDX64 # define MAX_OPCOD_3 256 // Instructions Register-Register # define MAX_OPCOD_4 32 // Instructions "set flag" with register # define MAX_OPCOD_5 32 // Instructions "set flag" with immediat # define MAX_OPCOD_6 4 // Instruction Shift/Rotate with immediat # define MAX_OPCOD_7 16 // Instructions multiply with HI-LO # define MAX_OPCOD_8 2 // Instructions acces at HI-LO # define MAX_OPCOD_9 8 // Instructions special # define MAX_OPCOD_10 4 // Instructions no operation # define MAX_OPCOD_11 4 // Instruction Shift/Rotate with register # define MAX_OPCOD_12 4 // Instructions extend # define MAX_OPCOD_13 4 // Instructions extend (64b) // OPCOD_0 - [31:26] Instructions with immediat # define OPCOD_L_J 0x00 // 000_000 # define OPCOD_L_JAL 0x01 // 000_001 # define OPCOD_L_BNF 0x03 // 000_011 # define OPCOD_L_BF 0x04 // 000_100 # define OPCOD_L_RFE 0x09 // 001_001 # define OPCOD_L_JR 0x11 // 010_001 # define OPCOD_L_JALR 0x12 // 010_010 # define OPCOD_L_MACI 0x13 // 010_011 # define OPCOD_L_CUST1 0x1c // 011_100 # define OPCOD_L_CUST2 0x1d // 011_101 # define OPCOD_L_CUST3 0x1e // 011_110 # define OPCOD_L_CUST4 0x1f // 011_111 # define OPCOD_L_CUST5 0x3c // 111_100 # define OPCOD_L_CUST6 0x3d // 111_101 # define OPCOD_L_CUST7 0x3e // 111_110 # define OPCOD_L_CUST8 0x3f // 111_111 # define OPCOD_L_LD 0x20 // 100_000 # define OPCOD_L_LWZ 0x21 // 100_001 # define OPCOD_L_LWS 0x22 // 100_010 # define OPCOD_L_LBZ 0x23 // 100_011 # define OPCOD_L_LBS 0x24 // 100_100 # define OPCOD_L_LHZ 0x25 // 100_101 # define OPCOD_L_LHS 0x26 // 100_110 # define OPCOD_L_ADDI 0x27 // 100_111 # define OPCOD_L_ADDIC 0x28 // 101_000 # define OPCOD_L_ANDI 0x29 // 101_001 # define OPCOD_L_ORI 0x2a // 101_010 # define OPCOD_L_XORI 0x2b // 101_011 # define OPCOD_L_MULI 0x2c // 101_100 # define OPCOD_L_MFSPR 0x2d // 101_101 # define OPCOD_L_MTSPR 0x30 // 110_000 # define OPCOD_L_SD 0x34 // 110_100 # define OPCOD_L_SW 0x35 // 110_101 # define OPCOD_L_SB 0x36 // 110_110 # define OPCOD_L_SH 0x37 // 110_111 # define OPCOD_1 0x33 // 110_011 // Instruction ORFPX32/64 # define OPCOD_2 0x0a // 001_010 // Instruction ORVDX64 # define OPCOD_3 0x38 // 111_000 // Instructions Register-Register # define OPCOD_4 0x39 // 111_001 // Instructions "set flag" with register # define OPCOD_5 0x2f // 101_111 // Instructions "set flag" with immediat # define OPCOD_6 0x2e // 101_110 // Instruction Shift/Rotate with immediat # define OPCOD_7 0x31 // 110_001 // Instructions multiply with HI-LO # define OPCOD_8 0x06 // 000_110 // Instructions acces at HI-LO # define OPCOD_9 0x08 // 001_000 // Instructions special # define OPCOD_10 0x05 // 000_101 // Instructions no operation // OPCOD_3 instructions - [9:8] [3:0] Instructions Register-Register # define OPCOD_L_ADD 0x00 // 00_0000 # define OPCOD_L_ADDC 0x01 // 00_0001 # define OPCOD_L_SUB 0x02 // 00_0010 # define OPCOD_L_AND 0x03 // 00_0011 # define OPCOD_L_OR 0x04 // 00_0100 # define OPCOD_L_XOR 0x05 // 00_0101 # define OPCOD_L_CMOV 0x0e // 00_1110 # define OPCOD_L_FF1 0x0f // 00_1111 # define OPCOD_L_FL1 0x1f // 01_1111 # define OPCOD_L_MUL 0x36 // 11_0110 # define OPCOD_L_DIV 0x39 // 11_1001 # define OPCOD_L_DIVU 0x3a // 11_1010 # define OPCOD_L_MULU 0x3b // 11_1011 # define OPCOD_11 0x8 // 1000 // Instruction Shift/Rotate with register # define OPCOD_12 0xc // 1100 // Instructions extend # define OPCOD_13 0xd // 1101 // Instructions extend (64b) // OPCOD_4 instructions - [25:21] Instructions "set flag" with register # define OPCOD_L_SFEQ 0x00 // 00000 # define OPCOD_L_SFNE 0x01 // 00001 # define OPCOD_L_SFGTU 0x02 // 00010 # define OPCOD_L_SFGEU 0x03 // 00011 # define OPCOD_L_SFLTU 0x04 // 00100 # define OPCOD_L_SFLEU 0x05 // 00101 # define OPCOD_L_SFGTS 0x0a // 01010 # define OPCOD_L_SFGES 0x0b // 01011 # define OPCOD_L_SFLTS 0x0c // 01100 # define OPCOD_L_SFLES 0x0d // 01101 // OPCOD_5 instructions - [25:21] Instructions "set flag" with immediat # define OPCOD_L_SFEQI 0x00 // 00000 # define OPCOD_L_SFNEI 0x01 // 00001 # define OPCOD_L_SFGTUI 0x02 // 00010 # define OPCOD_L_SFGEUI 0x03 // 00011 # define OPCOD_L_SFLTUI 0x04 // 00100 # define OPCOD_L_SFLEUI 0x05 // 00101 # define OPCOD_L_SFGTSI 0x0a // 01010 # define OPCOD_L_SFGESI 0x0b // 01011 # define OPCOD_L_SFLTSI 0x0c // 01100 # define OPCOD_L_SFLESI 0x0d // 01101 // OPCOD_6 instructions - [7:6] Instruction Shift/Rotate with immediat # define OPCOD_L_SLLI 0x0 // 00 # define OPCOD_L_SRLI 0x1 // 01 # define OPCOD_L_SRAI 0x2 // 10 # define OPCOD_L_RORI 0x3 // 11 // OPCOD_7 instructions - [3:0] Instructions multiply with HI-LO # define OPCOD_L_MAC 0x1 // 0001 # define OPCOD_L_MSB 0x2 // 0010 // OPCOD_8 instructions - [17] Instructions acces at HI-LO # define OPCOD_L_MOVHI 0x0 // 0 # define OPCOD_L_MACRC 0x1 // 1 // OPCOD_9 instructions - [25:23] Instruction special # define OPCOD_L_SYS 0x0 // 000 # define OPCOD_L_TRAP 0x2 // 010 # define OPCOD_L_MSYNC 0x4 // 100 # define OPCOD_L_PSYNC 0x5 // 101 # define OPCOD_L_CSYNC 0x6 // 110 // OPCOD_10 instructions - [25:24] Instruction no operation # define OPCOD_L_NOP 0x1 // 01 // OPCOD_11 instructions - [7:6] Instruction Shift/Rotate with register # define OPCOD_L_SLL 0x0 // 00 # define OPCOD_L_SRL 0x1 // 01 # define OPCOD_L_SRA 0x2 // 10 # define OPCOD_L_ROR 0x3 // 11 // OPCOD_12 instructions - [9:6] Instructions extend # define OPCOD_L_EXTHS 0x0 // 0000 # define OPCOD_L_EXTHZ 0x2 // 0010 # define OPCOD_L_EXTBS 0x1 // 0001 # define OPCOD_L_EXTBZ 0x3 // 0011 // OPCOD_13 instructions - [9:6] Instructions extend (64b) # define OPCOD_L_EXTWS 0x0 // 0000 # define OPCOD_L_EXTWZ 0x1 // 0001 /* //--------------------------------------------------[ destination ]----- #define _size_destination1 4 #define cst_DESTINATION1_NONE 0x0 #define mask_DESTINATION1_GPR 0x1 #define mask_DESTINATION1_MEMORY 0x2 #define mask_DESTINATION1_SPR 0x4 #define mask_DESTINATION1_MAC_UNIT 0x8 #define _size_destination2 3 #define cst_DESTINATION2_NONE 0x0 #define mask_DESTINATION2_COMMIT 0x1 #define mask_DESTINATION2_MEMORY 0x2 #define mask_DESTINATION2_SPR 0x4 //----------------------------------------------------[ exec_flag ]----- #define _size_exec_flag 2 #define mask_EXEC_FLAG_NONE 0x1 #define mask_EXEC_FLAG_CARRY 0x1 #define mask_EXEC_FLAG_FLAG 0x1 #define mask_EXEC_FLAG_OVERFLOW 0x2 //---------------------------------------------------[ exec_excep ]----- #define _size_exec_excep 1 #define mask_EXEC_EXCEP_NONE 0x0 #define mask_EXEC_EXCEP_RANGE 0x1 //----------------------------------------------------[ Condition ]----- #define _size_condition 3 #define cst_CONDITION_UNCONDITIONAL 0x0 // None condition (jump) #define mask_CONDITION_CONDITIONAL 0x2 #define mask_CONDITION_CONDITIONAL_NF 0x0 // Branch if Flag is clear #define mask_CONDITION_CONDITIONAL_F 0x1 // Branch if Flag is set #define mask_CONDITION_REG 0x4 // Branch if a register is read #define mask_CONDITION_STACK 0x8 // Branch with pop in stack pointer */ /* #define M_CPU_SIZE_INST 32 //---------------------------------------------------- // Exception type //---------------------------------------------------- #define M_CPU_LOG2_NB_EXCP 5 #define M_CPU_NB_EXCP 32 #define EXCP_NO 0x00 // none exception #define EXCP_RESET 0x01 // software or hardware reset #define EXCP_BERR 0x02 // Access at a invalid physical adress #define EXCP_D_PAGE 0x03 // No matching or page violation protection in pages tables #define EXCP_I_PAGE 0x04 // No matching or page violation protection in pages tables #define EXCP_TICK_TIMER 0x05 // Tick timer interruption #define EXCP_ALIGNMENT 0x06 // Load/Store access is not aligned #define EXCP_ILL_INST 0x07 // Instruction is illegal (no implemented) #define EXCP_IRQ 0x08 // External interruption #define EXCP_D_TLB 0x09 // DTLB miss #define EXCP_I_TLB 0x0a // ITLB miss #define EXCP_RANGE 0x0b // Overflow or access at a unimplemented register or context #define EXCP_SYSCALL 0x0c // System Call #define EXCP_FP 0x0d // Caused by a floating instruction #define EXCP_TRAP 0x0e // L.trap or debug unit #define EXCP_RES0 0x0f // Reserved for a futur usage #define EXCP_RES1 0x10 // Reserved for a futur usage #define EXCP_RES2 0x11 // Reserved for a futur usage #define EXCP_RES3 0x12 // Reserved for a futur usage #define EXCP_RES4 0x13 // Reserved for a futur usage #define EXCP_RES5 0x14 // Reserved for a futur usage #define EXCP_RES6 0x15 // Reserved for implemented specific exceptions #define EXCP_RES7 0x16 // Reserved for implemented specific exceptions #define EXCP_RES8 0x17 // Reserved for implemented specific exceptions #define EXCP_RES9 0x18 // Reserved for implemented specific exceptions #define EXCP_CUST0 0x19 // Reserved for custom exceptions #define EXCP_CUST1 0x1a // Reserved for custom exceptions #define EXCP_CUST2 0x1b // Reserved for custom exceptions #define EXCP_CUST3 0x1c // Reserved for custom exceptions #define EXCP_CUST4 0x1d // Reserved for custom exceptions #define EXCP_CUST5 0x1e // Reserved for custom exceptions #define EXCP_CUST6 0x1f // Reserved for custom exceptions //---------------------------------------------------- // Flags //---------------------------------------------------- #define M_CPU_NB_FLAG 3 // Integer flags #define FLAG_F 0x1 // Conditionnal branch flag #define FLAG_CY 0x2 // Carry was produced by last arithmétic operation #define FLAG_OV 0x4 // Overflow occured during last arithmetic operation // Floating flags #define FLAG_OVF 0x004 // Overflow occured during last arithmetic operation #define FLAG_UNF 0x008 // Underflow flags #define FLAG_SNF 0x010 // Result SNAN #define FLAG_QNF 0x020 // Result QNAN #define FLAG_ZF 0x040 // Result is nul #define FLAG_IXF 0x080 // Result is inexact #define FLAG_IVF 0x100 // Result is invalid #define FLAG_INF 0x200 // Result is infinite #define FLAG_DZF 0x400 // Division by zero // Position of flag in "rename register SR" (NOT IN "SR") #define FLAG_POS_F 0x0 // Conditionnal branch flag #define FLAG_POS_CY 0x1 // Carry was produced by last arithmétic operation #define FLAG_POS_OV 0x0 // Overflow occured during last arithmetic operation //---------------------------------------------------- // Instruction type //---------------------------------------------------- #define M_CPU_LOG2_NB_TYPE 4 #define TYPE_NOP 0x0 #define TYPE_ALU_F 0x1 // Instruction ALU with flag using (ADD, SUB, ADDC ...) #define TYPE_ALU_NF 0x2 // Instruction ALU without flag using (AND, OR ...) #define TYPE_MAC 0x3 // Instruction ALU with utilisation of register HI/LO #define TYPE_J 0x4 // Branch instruction #define TYPE_SPR_READ 0x5 // Instruction special : l.mfspr #define TYPE_SPR_WRITE 0x6 // Instruction special : l.mtspr #define TYPE_SPECIAL 0x7 // Instruction execute in decode stage #define TYPE_CUSTOM 0x8 // Instruction Custom #define TYPE_LOAD_Z 0x9 // Load access (extended by zero) #define TYPE_LOAD_S 0xa // Load access (sign extended) #define TYPE_STORE 0xc // Store access //---------------------------------------------------- // Condition to branch //---------------------------------------------------- #define M_CPU_LOG2_NB_COND 4 #define COND_NONE 0x0 // None condition (jump) #define COND_F 0x2 // Branch if Flag is set #define COND_NF 0x3 // Branch if Flag is clear #define COND_REG 0x4 // Branch if a register is read #define COND_STACK 0x8 // Branch with pop in stack pointer //---------------------------------------------------- // Event : State and Type //---------------------------------------------------- #define EVENT_STATE_NO_EVENT 0 // no event : current case #define EVENT_STATE_EVENT 1 // Have a event : make necessary to manage the event #define EVENT_STATE_WAITEND 2 // Wait end of manage event (restaure a good context) #define EVENT_STATE_END 3 // CPU can continue #define EVENT_TYPE_MISS 0 // miss of speculation #define EVENT_TYPE_EXCP 1 // exception or interruption occure // SPEC? TAKE? #define BRANCH_STATE_NONE 0 // 0 0 #define BRANCH_STATE_NSPEC_TAKE 1 // 0 1 -> incondionnal #define BRANCH_STATE_SPEC_NTAKE 2 // 1 0 #define BRANCH_STATE_SPEC_TAKE 3 // 1 1 //---------------------------------------------------- // Name to particular register //---------------------------------------------------- //~~~~~~~~~~~~~~~~~~~~~~~~~~ // GENERAL PURPOSE REGISTER //~~~~~~~~~~~~~~~~~~~~~~~~~~ #define M_CPU_LOG2_NB_GPR_LOG 5 #define M_CPU_NB_GPR_LOG (1<