module tropical_alu #(
    parameter WIDTH = 32
)(
    input wire clk,
    input wire rst_n,
    input wire [WIDTH-1:0] a,
    input wire [WIDTH-1:0] b,
    input wire [1:0] opcode, // 00: NOP, 01: ADD (Max), 10: MUL (Add)
    output reg [WIDTH-1:0] result
);

    // Tropical Algebra:
    // "Addition" is Max(a, b)
    // "Multiplication" is a + b

    always @(posedge clk or negedge rst_n) begin
        if (!rst_n) begin
            result <= 0;
        end else begin
            case (opcode)
                2'b01: begin // Tropical ADD -> Max
                    if (a > b)
                        result <= a;
                    else
                        result <= b;
                end
                2'b10: begin // Tropical MUL -> Standard Add
                    result <= a + b;
                end
                default: result <= result;
            endcase
        end
    end

endmodule
