Skip to content

Made the verilog module consistent with the Circuit simulation logic #619

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/simulator/src/sequential/DflipFlop.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,18 @@ export default class DflipFlop extends CircuitElement {
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;
input clk, a_rst, en;
input [WIDTH-1:0] d, pre;

always @ (posedge clk or posedge a_rst)
if (a_rst) begin
q <= 'b0;
q_inv <= 'b1;
if (^pre === 1'bx) begin
q <= {WIDTH{1'b0}};
q_inv <= {WIDTH{1'b1}};
end else begin
q <= pre;
q_inv <= ~pre;
end
end else if (en == 0) ;
else begin
q <= d;
Expand Down
Loading