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

🐞 Bug Input pre is not used in the Verilog code for DflipFlop. #321

Open
1 task done
philipabbey opened this issue Jun 17, 2024 · 0 comments
Open
1 task done
Labels
🐞 bug Something isn't working pending triage issue yet to be reviewed by maintainers

Comments

@philipabbey
Copy link

philipabbey commented Jun 17, 2024

Is there an existing issue for this?

  • I have searched the existing issues.

Describe the bug

Input pre is not used in the Verilog code for DflipFlop.

module DflipFlop(q, q_inv, clk, d, a_rst, pre, en);
    parameter WIDTH = 1;
    output reg [WIDTH-1:0] q, q_inv;
    input clk, a_rst, pre, en;
    input [WIDTH-1:0] d;

    always @ (posedge clk or posedge a_rst)
    if (a_rst) begin
        q <= 'b0;
        q_inv <= 'b1;
    end else if (en == 0) ;
    else begin
        q <= d;
        q_inv <= ~d;
    end
endmodule

This can cause the entire design to be optimised away during synthesis in Xilinx's Vivado, and it took some finding (since I only know VHDL ;-)

Steps to Reproduce

Not used the cv-frontend-vue code base at all, just noted the same mistake has been copied across from the original simulator.

Expected Behavior

The pre input should be used to set the value on reset with a_rst.

The following is a guess at the correction since I don't actually code in Verilog.

    if (a_rst) begin
        q <= pre;
        q_inv <= ~pre;

Screenshots

No response

Is the faced issue/bug related to the Vue simulator?

Yes

Used Vue simulator with or without backend?

None

Is the bug present only on the dev server, the build, or both?

Both

Device Information

Is the bug present only on the dev server, the build, or both?

In truth, no idea. I only note you have copied the mistake across from the original simulator and its there in your source code at https://github.com/CircuitVerse/cv-frontend-vue/blob/main/src/simulator/src/sequential/DflipFlop.js#L151-L152, so its there in at least one of the servers.

Additional Context

CircuitVerse/CircuitVerse#4985

Are you working on this issue?

No

@philipabbey philipabbey added pending triage issue yet to be reviewed by maintainers 🐞 bug Something isn't working labels Jun 17, 2024
@philipabbey philipabbey changed the title 🐞 Bug: [Title] 🐞 Bug Input pre is not used in the Verilog code for DflipFlop. Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working pending triage issue yet to be reviewed by maintainers
Projects
None yet
Development

No branches or pull requests

1 participant