Skip to content

Remove uses of get_slice_int() in vector code? #1283

@Timmmm

Description

@Timmmm

In the vector code there are some uses of get_slice_int() for multiplies:

        MVV_VMUL     => get_slice_int(SEW, signed(vs2_val[i]) * signed(vs1_val[i]), 0),
        MVV_VMULH    => get_slice_int(SEW, signed(vs2_val[i]) * signed(vs1_val[i]), SEW),
        MVV_VMULHU   => get_slice_int(SEW, unsigned(vs2_val[i]) * unsigned(vs1_val[i]), SEW),
        MVV_VMULHSU  => get_slice_int(SEW, signed(vs2_val[i]) * unsigned(vs1_val[i]), SEW),
...


In the non-vector multiply we do it differently with `to_bits_truncate()`, like this:

let rs1_int = if mul_op.signed_rs1 then signed(rs1_bits) else unsigned(rs1_bits);
let rs2_int = if mul_op.signed_rs2 then signed(rs2_bits) else unsigned(rs2_bits);

let result_wide = to_bits_truncate(2 * xlen, rs1_int * rs2_int);
X(rd) = if mul_op.high
then result_wide[(2 * xlen - 1) .. xlen]
else result_wide[(xlen - 1) .. 0];


We should do it the same in both places, and maybe extract it in a function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorCode clean upvectorIssues related to the Vector extension

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions