Usuage Of Inout Port
The key code :
reg [31:0] data_t;
reg control;
assign data = uten==1'b1? data_t : 32'bz;
assign uten = control;
Analy:
if uten==1 output port ,data should be save in data_t pre
else it is an input port.
if read: set control = 0;
if write: set control = 1, data_t = data_to_be_written;