Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong instruction fetch caused by multicycle F instructions | Forwarding issue #722

Closed
salaheddinhetalani opened this issue Sep 27, 2022 · 1 comment
Labels
Component:RTL For issues in the RTL (e.g. for files in the rtl directory) PARAM:FPU Issue depends on the FPU parameter Status:Resolved Issue has been resolved, but closure is pending on git merge and/or issuer confirmation Type:Bug For bugs in the RTL, Documentation, Verification environment or Tool and Build system

Comments

@salaheddinhetalani
Copy link

Issue Description

Jump instructions set the wrong PC in case they are preceded by a multicycle F instruction and their source register is the same destination register of the floating point one.

Component

Component:RTL

RISC-V Specification

The Zfinx extension adds all of the instructions that the F extension adds, except for the transfer instructions FLW, FSW, FMV.W.X, FMV.X.W, C.FLW[SP], and C.FSW[SP].

The Zfinx variants of these F-extension instructions have the same semantics, except that whenever such an instruction would have accessed an f register, it instead accesses the x register with the same number.

Steps to Reproduce

As shown below, the following sequence of instructions happens:

fdiv.s x8, x0, x0, RDN -> fle.s x10, x7, x19 -> jalr x13, x8, -115

The first instruction updates x8 register (Zfinx is set) with the value 32'h7fc00000 (NaN result of division by 0). When jalr instruction is executed, it sets the PC wrongly to 32'hffffffc2, which is the value of adding the immediate 32'hffffff8d to the old content 32'h36 of x8. The correct PC should be 32'h7fbfff8c, resulting from adding the immediate 32'hffffff8d to the new content 32'h7fc00000 of x8.

Bug_1

Top Level Parameters

cv32e40p_wrapper #(
    .PULP_XPULP       (0),
    .PULP_CLUSTER     (0),
    .FPU              (1),
    .PULP_ZFINX       (1),
    .NUM_MHPMCOUNTERS (1)
)

Git Hash: d0d1c25
Flist: cv32e40p_fpu_manifest.flist
VCD: bug_1.vcd


Product: OneSpin 360 DV-Verify
App: Processor Verification App
Tool's version: 2022.3_1

@pascalgouedo pascalgouedo added Component:RTL For issues in the RTL (e.g. for files in the rtl directory) PARAM:FPU Issue depends on the FPU parameter labels Nov 9, 2022
pascalgouedo pushed a commit to pascalgouedo/cv32e40p that referenced this issue Aug 16, 2023
Signed-off-by: Pascal Gouedo <[email protected]>
pascalgouedo pushed a commit to pascalgouedo/cv32e40p that referenced this issue Aug 16, 2023
Signed-off-by: Pascal Gouedo <[email protected]>
pascalgouedo pushed a commit to pascalgouedo/cv32e40p that referenced this issue Aug 21, 2023
Signed-off-by: Pascal Gouedo <[email protected]>
pascalgouedo pushed a commit to pascalgouedo/cv32e40p that referenced this issue Aug 22, 2023
Signed-off-by: Pascal Gouedo <[email protected]>
pascalgouedo pushed a commit to pascalgouedo/cv32e40p that referenced this issue Aug 29, 2023
Signed-off-by: Pascal Gouedo <[email protected]>
@pascalgouedo pascalgouedo added the Type:Bug For bugs in the RTL, Documentation, Verification environment or Tool and Build system label Oct 10, 2023
@pascalgouedo
Copy link

Resolved with PR #860

@pascalgouedo pascalgouedo added the Status:Resolved Issue has been resolved, but closure is pending on git merge and/or issuer confirmation label Oct 26, 2023
pascalgouedo pushed a commit to pascalgouedo/cv32e40p that referenced this issue Nov 9, 2023
Signed-off-by: Pascal Gouedo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component:RTL For issues in the RTL (e.g. for files in the rtl directory) PARAM:FPU Issue depends on the FPU parameter Status:Resolved Issue has been resolved, but closure is pending on git merge and/or issuer confirmation Type:Bug For bugs in the RTL, Documentation, Verification environment or Tool and Build system
Projects
None yet
Development

No branches or pull requests

2 participants