// nandgame arithmetic unit `timescale 1us/1us `include "nandgame_types.v" `ifndef NANDGAME_ARU `define NANDGAME_ARU module arith_unit #( parameter DATA_WIDTH = 16 ) ( // first operand input [(DATA_WIDTH-1):0] X_in, // second operand input [(DATA_WIDTH-1):0] Y_in, // opcode, see ArithCode input ArithCode arith_operation_in, // result of operation output logic [(DATA_WIDTH-1):0] result_out ); always_comb begin case (arith_operation_in) ARITH_PLUS: result_out = X_in + Y_in; ARITH_MINUS: result_out = X_in - Y_in; ARITH_INC: result_out = X_in + 1; ARITH_DEC: result_out = X_in - 1; default: result_out = 0; endcase end endmodule `endif