Skip to content

Instances named as modules #242

@arquer

Description

@arquer

Hi,
I see a problem where code navigation does not take me to a module definition when the instance name for that module matches the module's name.

To replicate just create a new file with the following contents:

module my_test_module (
    input logic clk,
    input logic rst,
    input logic a,
    output logic b
);

always @(posedge clk) begin
    if (rst) begin
        b <= 0;
    end else begin
        b <= a;
    end
end

endmodule





module my_other_test_module ();

    logi clk, rst, a, b;

    my_test_module my_test_module (
        .clk    (clk),
        .rst    (rst),
        .a      (a),
        .b      (b)
    );

endmodule

Now, the problem I see is that Ctrl + click on the module name "my_test_module" of the instance takes me to the instance itself.
If you modify the instance name and call it something else though, code navigation correctly takes you to the module definition:

module my_test_module (
    input logic clk,
    input logic rst,
    input logic a,
    output logic b
);

always @(posedge clk) begin
    if (rst) begin
        b <= 0;
    end else begin
        b <= a;
    end
end

endmodule





module my_other_test_module ();

    logi clk, rst, a, b;

    my_test_module another_name (
        .clk    (clk),
        .rst    (rst),
        .a      (a),
        .b      (b)
    );

endmodule

This seems like it should be pretty easy to solve?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions