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

Unknown node in split color() map on empty if #1604

Closed
veripoolbot opened this issue Nov 15, 2019 · 4 comments
Closed

Unknown node in split color() map on empty if #1604

veripoolbot opened this issue Nov 15, 2019 · 4 comments
Assignees

Comments

@veripoolbot
Copy link

@veripoolbot veripoolbot commented Nov 15, 2019


Author Name: Andrew Holme
Original Redmine Issue: 1604 from https://www.veripool.org

Original Assignee: Wilson Snyder (@wsnyder)


// This code compiles on Verilator 3.9xx; but 4.0xx fails with the error:
// %Error: Internal Error: top.v:32: ../V3Split.cpp:658: Unknown node in split color() map

`define COND (2'b10)

module top (
     input  wire clk,
     input  wire aresetn
);

     reg [9:0] ten;
     reg [1:0] two;

     function [1:0] func(
         input [1:0]  p0_x,
         input [1:0]  p0_y,
         input [1:0]  p1_x,
         input [1:0]  p1_y,
         input [1:0]  sel);

         reg [1:0] rx;
         reg [1:0] ry;

     begin

`ifdef NOT_DEF
         // This way works
         rx = sel == `COND ? p1_x : p0_x;
         ry = sel == `COND ? p1_y : p0_y;
`else
         // This way fails to compile
         if (sel == `COND)
         begin
           rx = p1_x;
           ry = p1_y;
         end else
         begin
           rx = p0_x;
           ry = p0_y;
         end
`endif
         func = 0;
     end
     endfunction

     always @(*) begin
         two = func(
                     ten[8 +: 2],
                     ten[6 +: 2],
                     ten[4 +: 2],
                     ten[2 +: 2],
                     ten[0 +: 2]);
     end

endmodule

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Nov 15, 2019


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-11-15T23:38:44Z


Will require some research. The irony is the point of the broken optimization is to transform it into exactly what you did for the workaround.

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Nov 16, 2019


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-11-16T22:24:04Z


Thanks for the good test case.

This was caused by your outputs (rx & ry) never being used, not sure if you noticed that. Basically as it was optimizing away the if conditions it got confused by a resulting empty (NOP) if.

Fixed in git towards eventual 4.024 release.

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Nov 17, 2019


Original Redmine Comment
Author Name: Andrew Holme
Original Date: 2019-11-17T11:36:34Z


Thanks for fixing it. I had not attached any significance to them being unused; however, there are three instances of the affected module in our original code with differing parameterisation and they are indeed unused as you say in the troublesome instance which produced the error.

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Dec 8, 2019


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-12-08T13:13:04Z


In 4.024.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.