+ wire [3:0] alu_opc = insn[24:21];
+
+ function alu_is_logical;
+ input [3:0] op;
+
+ case (op)
+ `ALU_AND,`ALU_EOR,`ALU_TST,`ALU_TEQ,`ALU_ORR,`ALU_MOV,`ALU_BIC,`ALU_MVN: alu_is_logical = 1;
+ default: alu_is_logical = 0;
+ endcase
+ endfunction
+
+ function alu_flags_only;
+ input [3:0] op;
+
+ case (op)
+ `ALU_TST,`ALU_TEQ,`ALU_CMP,`ALU_CMN: alu_flags_only = 1;
+ default: alu_flags_only = 0;
+ endcase
+ endfunction
+
+ function shift_requires_carry;
+ input [7:0] shift;
+
+ case(shift[1:0])
+ `SHIFT_LSL: shift_requires_carry = (shift[7:2] == 0);
+ `SHIFT_LSR: shift_requires_carry = 0;
+ `SHIFT_ASR: shift_requires_carry = 0;
+ `SHIFT_ROR: shift_requires_carry = (shift[7:2] == 0);
+ endcase
+ endfunction
+