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

Icarus verilog makes no progress #1028

Closed
rowanG077 opened this issue Nov 14, 2023 · 5 comments
Closed

Icarus verilog makes no progress #1028

rowanG077 opened this issue Nov 14, 2023 · 5 comments

Comments

@rowanG077
Copy link

I have this tb.v:

`timescale 1ns / 1ps

module tb;

  initial begin
    #100;
    $finish;
  end

  colorlite inst ();

endmodule

And this colorlite.v:

`timescale 1ns / 1ps
module colorlite ( );


reg           packetizer_is_ongoing2 = 1'd0;
reg           packetizer_sink_ready = 1'd0;
wire          packetizer_sink_valid = 1'd0;
reg           packetizer_source_last_a = 1'd0;
reg           packetizer_source_last_b = 1'd0;


always @(*) begin
    packetizer_is_ongoing2 <= 1'd0;
    if (packetizer_sink_valid) begin
        packetizer_source_last_a <= 1'd0;
    end
    packetizer_is_ongoing2 <= 1'd1;

    if (packetizer_is_ongoing2) begin
        packetizer_source_last_b <= 1'b0;
    end
end

endmodule

Which is a severely cut down version of the verilog generated by litex from https://github.com/rowanG077/liteeth-16-byte-bug/tree/testing

I run the following commands:

iverilog -o sim.vvp -s tb -Wall -pfileline=1 colorlite.v tb.sv
vvp sim.vvp

(Apparently -pfileline=1 should add lot's of debug output but It doesn't show anything).

I'm running icarus verilog 12.0 on NixOS aarch64

@larsclausen
Copy link
Collaborator

I think this is effectively a duplicate of #872. packetizer_is_ongoing2 is part of the sensitivity list of the always* block, but it is also modified within that block. So the block is always going to reschedule with no progress in time.

@rowanG077
Copy link
Author

rowanG077 commented Nov 14, 2023

Well that sucks. That means litex/nmigen is generating code which can't be simulated sometimes. Thanks for your quick response!

@martinwhitaker
Copy link
Collaborator

For future reference, after compiling with -pfileline=1, you need to enable tracing with the trace on command at the vvp interactive prompt.

@caryr
Copy link
Collaborator

caryr commented Nov 14, 2023

What seems odd to me is the non-blocking assignments to packetizer_is_ongoing2 should those be blocking assignments? That looks like the basis for the infinite looping.

@rowanG077
Copy link
Author

Considering it is generated by litex they should be correct. It's also weird that removing the first if makes it work as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants