Consider a design with two IP cores ip1.v
and ip2.v
that each declare a (different) module with the same name.
For example, the contents of ip1.v
:
module ip1 (input A, B, C, output X);
wire T;
mygate gate_0 (.I0(A), .I1(B), .O(T));
mygate gate_1 (.I0(T), .I1(C), .O(X));
endmodule
module mygate (input I0, I1, output O);
assign O = I0 & I1;
endmodule
And the contents of ip2.v
:
module ip2 (input A, B, C, output X);
wire T;
mygate gate_0 (.I0(A), .I1(B), .O(T));
mygate gate_1 (.I0(T), .I1(C), .O(X));
endmodule
module mygate (input I0, I1, output O);
assign O = I0 | I1;
endmodule
And then a top module that uses both IP cores (top.v
):
module top (input A, B, C, output X, Y);
ip1 ip1_inst (.A(A), .B(B), .C(C), .X(X));
ip2 ip2_inst (.A(A), .B(B), .C(C), .X(Y));
endmodule
How can I process a design like that so that each IP cores sees it's own version of mygate
?