MatMulAdd

sail-arm's definition a64.sail

val MatMulAdd : forall 'N ('op1_unsigned : Bool) ('op2_unsigned : Bool),
  'N == 128.
  (bits('N), bits('N), bits('N), bool('op1_unsigned), bool('op2_unsigned)) -> bits('N)

function MatMulAdd (addend, op1, op2, op1_unsigned, op2_unsigned) = {
    assert('N == 128);
    result : bits('N) = undefined;
    sum : bits(32) = undefined;
    prod : int = undefined;
    foreach (i from 0 to 1 by 1 in inc) {
        foreach (j from 0 to 1 by 1 in inc) {
            sum = Elem_read(addend, 2 * i + j, 32);
            foreach (k from 0 to 7 by 1 in inc) {
                prod = asl_Int(Elem_read(op1, 8 * i + k, 8), op1_unsigned) * asl_Int(Elem_read(op2, 8 * j + k, 8), op2_unsigned);
                sum = sum + prod
            };
            result = Elem_set(result, 2 * i + j, 32, sum)
        }
    };
    return(result)
}

Used by


Made from ScarletNX's Sail at 166ad3910f80. sail-arm's definitions are Arm's ASL in Sail (BSD 3-Clause Clear, license); ScarletNX's fixups are GPL-3.0-or-later.