verilator/test_regress/t/t_tri_gate.v

39 lines
972 B
Coq
Raw Normal View History

2009-01-06 16:03:57 +00:00
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2008 by Lane Brooks
module top (input SEL, input[1:0] A, output Z, output Y, output X, output W);
assign Z = ( SEL) ? A[1] : 1'bz;
tbuf tbuf(.A(A[0]), .OE(!SEL), .Z(Z));
tbuf mux0[1:0](.A(A), .OE({SEL,!SEL}), .Z(Y));
pass mux1(.A(A), .SEL(SEL), .Z(X));
mux mux2(.A(A), .SEL(SEL), .Z(W));
endmodule
module pass (input[1:0] A, input SEL, output Z);
tbuf tbuf1(.A(A[1]), .OE(SEL), .Z(Z));
tbuf tbuf0(.A(A[0]), .OE(!SEL),.Z(Z));
endmodule
module tbuf (input A, input OE, output Z);
2009-01-06 16:57:25 +00:00
`ifdef T_BUFIF0
bufif0 (Z, A, !OE);
`elsif T_BUFIF1
bufif1 (Z, A, OE);
`elsif T_NOTIF0
notif0 (Z, !A, !OE);
`elsif T_NOTIF1
notif1 (Z, !A, OE);
`elsif T_COND
2009-01-06 16:03:57 +00:00
assign Z = (OE) ? A : 1'bz;
2009-01-06 16:57:25 +00:00
`else
`error "Unknown test name"
`endif
2009-01-06 16:03:57 +00:00
endmodule
module mux (input[1:0] A, input SEL, output Z);
assign Z = (SEL) ? A[1] : 1'bz;
assign Z = (!SEL)? A[0] : 1'bz;
endmodule