`define load_inst 4'd0 `define store_inst 4'd1 `define alu_inst 4'd2 `define control_transfer_inst 4'd3 `define ACCn 2'd0 `define Xn 2'd1 `define Sn 2'd2 `define PCn 2'd3 `define Never 4'd0 `define Always 4'd1 `define Zequal0 4'd2 `define Zequal1 4'd3 `define FnReg 4'd0 `define FnNOT 4'd1 `define FnLSL 4'd2 `define FnLSR 4'd3 `define FnADD 4'd4 `define FnSUB 4'd5 `define FnAND 4'd6 `define FnOR 4'd7 `define FnMem 4'd8 `define NOP {`load_inst,`ACCn,`ACCn,`FnReg} `define LDA {`load_inst,`ACCn,`ACCn,`FnMem} `define LDX {`load_inst,`ACCn,`Xn,`FnMem} `define LDS {`load_inst,`ACCn,`Sn,`FnMem} `define STA {`store_inst,`ACCn,`ACCn,`FnReg} `define STX {`store_inst,`Xn,`Xn,`FnReg} `define STS {`store_inst,`Sn,`Sn,`FnReg} `define ADD {`alu_inst,`ACCn,`ACCn,`FnADD} `define SUB {`alu_inst,`ACCn,`ACCn,`FnSUB} `define AND {`alu_inst,`ACCn,`ACCn,`FnAND} `define OR {`alu_inst,`ACCn,`ACCn,`FnOR} `define COM {`alu_inst,`ACCn,`ACCn,`FnNOT} `define LSL {`alu_inst,`ACCn,`ACCn,`FnLSL} `define LSR {`alu_inst,`ACCn,`ACCn,`FnLSR} `define BA {`control_transfer_inst,`PCn,`PCn,`Always} `define BEQ {`control_transfer_inst,`PCn,`PCn,`Zequal1} `define BNE {`control_transfer_inst,`PCn,`PCn,`Zequal0} `define INHERENT 4'd0 `define PC_RELATIVE 4'd1 `define IMMEDIATE 4'd2 `define DIRECT 4'd3 `define INDEXED 4'd4