fpu: detect RV64 FCVT.WU.D overflow on a round-up to 2^32

Đang mở
#500 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Lĩnh vực
embedded-iot

Hướng nghiên cứu

Start in hw/rtl/fpu/VX_fcvt_unit.sv around lines 632-634, at round_carry_out_s5 and f2i_u32_pos_ovf. Trace how input_sign_s5, unpacked_exp_s5, dst_l_s5, and rounded_abs_s5 are formed for RV64 FCVT.WU.D; the pre-round exponent is 31 while rounding carries the magnitude to 2^32. Reproduce with input 0x41effffffff00000 and frm=RNE, then extend the unsigned overflow condition to cover a rounded value of 2^32, expecting 0xffffffffffffffff and NV set. Done means that case and the (2^32-1,2^32) interval are covered by the FPU tests.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

On RV64 at commit 1061088aa, FCVT.WU.D of 4294967295.5 (0x41effffffff00000) with frm=RNE returns 0 and raises only NX. RNE rounds this value to 2^32, which is outside the unsigned 32-bit range. The result should be 0xffffffffffffffff and NV should be set.

The overflow check misses this case. On RV64, S_MAN_WIDTH is at least 64, so rounding to 2^32 does not wrap rounded_abs_s5 to zero; meanwhile, the pre-round exponent is 31. The conversion therefore takes the in-range path and writes the low 32 bits of 2^32, which are zero. The same issue affects values in (2^32-1, 2^32) that round to 2^32.

This is distinct from #430, which concerns FCVT.S.D overflow rounding and was fixed by #432. It is also distinct from the f2i_u32_pos_ovf zero-extension issue: that branch is reached only when overflow is detected, while this input does not trigger it.

In hw/rtl/fpu/VX_fcvt_unit.sv, round-up carry is counted as overflow only when the rounded magnitude wraps to zero:

wire round_carry_out_s5 = (rounded_abs_s5 == '0) && (|pre_round_abs_s5);
wire f2i_u32_pos_ovf = !is_signed_s5 && !dst_l_s5 && !input_sign_s5
                    && ((unpacked_exp_s5 >= S_EXP_WIDTH'(32)) || round_carry_out_s5);
Ngôn ngữ chính
Verilog
Star
2.4k
Fork
563
Merge trung bình
2 ngày 12 giờ
Pull request đã merge (30 ngày)
33

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của vortexgpgpu/vortex

Tất cả issue của vortexgpgpu/vortex

Issue tương tự

Thêm issue về Embedded & IoT

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.