2018-07-26 12:28:21 -05:00
|
|
|
//------ Module: iopad -----//
|
|
|
|
//------ Verilog file: io.v -----//
|
|
|
|
//------ Author: Xifan TANG -----//
|
|
|
|
module iopad(
|
2019-05-10 15:07:32 -05:00
|
|
|
//input zin, // Set output to be Z
|
2018-07-26 12:28:21 -05:00
|
|
|
input dout, // Data output
|
|
|
|
output din, // Data input
|
|
|
|
inout pad, // bi-directional pad
|
2019-04-26 13:23:47 -05:00
|
|
|
input direction // enable signal to control direction of iopad
|
|
|
|
//input direction_inv // enable signal to control direction of iopad
|
2018-07-26 12:28:21 -05:00
|
|
|
);
|
|
|
|
//----- when direction enabled, the signal is propagated from pad to din
|
|
|
|
assign din = direction ? pad : 1'bz;
|
|
|
|
//----- when direction is disabled, the signal is propagated from dout to pad
|
|
|
|
assign pad = direction ? 1'bz : dout;
|
|
|
|
endmodule
|