この例では、Verilog HDL にクロック双方向ピンを実装します。OE の値は、bider が inp でフィードする入力なのか、または Tri-State* で値 b を排除するかを決定します。
この例をプロジェクトで使用する際の詳細は、以下をご覧ください。
bidir.v
module bidirec (oe, clk, inp, outp, bidir);
// Port Declaration
input oe;
input clk;
input [7:0] inp;
output [7:0] outp;
inout [7:0] bidir;
reg [7:0] a;
reg [7:0] b;
assign bidir = oe ? a : 8'bZ ;
assign outp = b;
// Always Construct
always @ (posedge clk)
begin
b <= bidir;
a <= inp;
end
endmodule