Skip to content

Commit 5493794

Browse files
authored
hw: Add VFCVT(U).D.S instructions (#170)
1 parent 9a024dc commit 5493794

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

hw/snitch/src/riscv_instr.sv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,8 @@ package riscv_instr;
703703
localparam logic [31:0] VFCPKB_B_D = 32'b1011010??????????111?????0110011;
704704
localparam logic [31:0] VFCPKC_B_D = 32'b1011011??????????011?????0110011;
705705
localparam logic [31:0] VFCPKD_B_D = 32'b1011011??????????111?????0110011;
706+
localparam logic [31:0] VFCVT_D_S = 32'b100110000100?????001?????0110011;
707+
localparam logic [31:0] VFCVTU_D_S = 32'b100110000100?????101?????0110011;
706708
localparam logic [31:0] VFCVT_S_B = 32'b100110000111?????000?????0110011;
707709
localparam logic [31:0] VFCVTU_S_B = 32'b100110000111?????100?????0110011;
708710
localparam logic [31:0] VFCVT_B_S = 32'b100110000100?????011?????0110011;

hw/snitch/src/snitch.sv

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,6 +1349,19 @@ module snitch import snitch_pkg::*; import riscv_instr::*; #(
13491349
illegal_inst = 1'b1;
13501350
end
13511351
end
1352+
VFCVT_D_S,
1353+
VFCVTU_D_S: begin
1354+
if (FP_EN && XFVEC && RVF && FLEN >= 32) begin
1355+
if (RVF && RVD) begin
1356+
write_rd = 1'b0;
1357+
acc_qvalid_o = valid_instr;
1358+
end else begin
1359+
illegal_inst = 1'b1;
1360+
end
1361+
end else begin
1362+
illegal_inst = 1'b1;
1363+
end
1364+
end
13521365
VFCPKA_H_S,
13531366
VFCPKB_H_S,
13541367
VFCVT_H_S,

hw/snitch_cluster/src/snitch_fp_ss.sv

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,16 @@ module snitch_fp_ss import snitch_pkg::*; #(
561561
vectorial_op = 1'b1;
562562
set_dyn_rm = 1'b1;
563563
end
564+
riscv_instr::VFCVT_D_S,
565+
riscv_instr::VFCVTU_D_S: begin
566+
fpu_op = fpnew_pkg::F2F;
567+
op_select[0] = RegA;
568+
src_fmt = fpnew_pkg::FP32;
569+
dst_fmt = fpnew_pkg::FP64;
570+
vectorial_op = 1'b1;
571+
set_dyn_rm = 1'b1;
572+
if (acc_req_q.data_op inside {riscv_instr::VFCVTU_D_S}) op_mode = 1'b1;
573+
end
564574
// Double Precision
565575
riscv_instr::FADD_D: begin
566576
fpu_op = fpnew_pkg::ADD;

0 commit comments

Comments
 (0)