Verilog – Missing Connection for Port Issue

modelsimmodulesimulationverilog

I was creating a circuit using two dual input AND gates into a dual input NOR using three modules and module instantiation.

enter image description here

The first module is for the AND inputs and the second module is for the NOR. Both of these modules work correctly and this was verified using waveform simulation and checking the truth tables.

When I try to simulate the third module aoi22.v I get an error on this line
" orInv2 _orInv2_2 ( ._and1(_and1), ._and2(_and2),.f(f) ); " Missing conneciton for port _and1, _and2. When I take out the .f(f) I get an error Missing connection for port f? Any suggestions on how to fix this?

module and22 (input i1,i2,i3,i4, output _and1,_and2); 
    assign _and1 = i1 & i2;
    assign _and2 = i3 & i4;
endmodule
module orInv2 (input _and1, _and2, output f); 
    assign f = !(_and1 | _and2);
endmodule
module aoi22 ( input i1, i2, i3, i4, output _and1, _and2, f);

    and22 _and22_1 ( .i1(i1), .i2(i2), .i3(i3), .i4(i4) );
    orInv2 _orInv2_2 ( ._and1(_and1), ._and2(_and2),.f(f) ); 

endmodule

Best Answer

module and22 (input i1,i2,i3,i4, output _and1,_and2); 
    assign _and1 = i1 & i2;
    assign _and2 = i3 & i4;
endmodule
module orInv2 (input _and1, _and2, output f); 
    assign f = !(_and1 | _and2);
endmodule
module aoi22 ( input i1, i2, i3, i4, output f);
    logic o_and1;
    logic o_and2;

    and22 _and22_1 ( .i1(i1), .i2(i2), .i3(i3), .i4(i4), ._and1(o_and1), ._and1(o_and2) );
    orInv2 _orInv2_2 ( ._and1(o_and1), ._and2(o_and2),.f(f) ); 
endmodule