[sv-bc] Nested module and instance name is same

From: Rakesh Gulati <rakesh_at_.....>
Date: Thu Jun 30 2005 - 21:44:04 PDT
Hi,
In the following testcase, a nested module and the instance name is
same. Is it a valid case?

In my opinion, nested module and an instance are seperate items. As per
scope rules same name items can not exist in same scope. So a variable
also can not be declared using same name as nested module or instance.

I did not find any explicit rule though in SV 3.1a LRM which will tell
us that
nested module can have or not have same name with variables or
instances.

Please let me know your comments.

The test case is:
module nested9 (in1,in2,condition,clk,out1,out2);
parameter p1 = 0;
input  [7:0] in1,  in2;
input        clk;
output [7:0] out1, out2;
reg    [7:0] out1, out2;
input condition;

module nest2(input [7:0] in1, input [7:0] in2, input clk, input
condition, output reg [7:0] out1);
    always @ (posedge clk)
    begin
        if(condition)
            out1 = in1;
        else
            out1 = in2;
    end
endmodule

nest2 nest2 (in1, in2, out1);

module nest3(input [7:0] in1, input [7:0] in2, input clk, input
condition, output reg [7:0] out1);
    always @ (posedge clk)
    begin
        if(condition)
            out1 = in2;
        else
            out1 = in1;
    end
endmodule

nest3 nest3 (in1, in2, out1);

endmodule

Regards
Rakesh
Received on Thu Jun 30 21:42:16 2005

This archive was generated by hypermail 2.1.8 : Thu Jun 30 2005 - 21:42:33 PDT