bidirectional port
hi,
below code may help you to understand bidirectional pins.
module top
(
input SysClk ,
input Sys_Rst,
inout I2c_Sda,
inout I2c_Scl
);
wire i2c_scl_out;
assign I2c_Scl = (i2c_scl_out == 1'b0) ? 1'b0 : 1'bz;
wire i2c_scl_in = I2c_Scl ;
wire i2c_sda_out;
assign I2c_Sda = (i2c_sda_out == 1'b0) ? 1'b0 : 1'bz;
wire i2c_sda_in = I2c_Sda ;
Instance Componant
(//==============================
// Globle Signals
.NSYSRESET ( sys_reset_n ), // input
.SYSCLK ( sys_clk ), // input
//-------------------------------------------
//==============================
// I2C Signals
.SDAI ( i2c_sda_in ), // input
.SCLI ( i2c_scl_in ), // input
.SDAO ( i2c_sda_out ), // output
.SCLO ( i2c_scl_out ) // output
//-------------------------------------------
);
endmodule
Hth