/////////////////////////////////////////////////////////////////////// // // switch module // // /////////////////////////////////////////////////////////////////////// `ifdef switch_access_time // already defined - do nothing `else `define switch_access_time 500ns `endif module io_switches ( switches, Data, nOE, nCE, nWait ); output nWait; input [15:0] switches; inout [15:0] Data; input nOE, nCE; specify specparam tViolate=250; $width(negedge nCE, tViolate); $width(posedge nCE, tViolate); $setuphold(edge[10, 01] nCE, nOE, tViolate, tViolate); endspecify reg delay; initial delay = 0; always @(negedge nCE) begin delay = 1; #`switch_access_time delay = 0; end assign nWait = (delay && !nCE && !nOE) ? 0 : 1'bz; assign Data = ((nOE == 0) && (nCE == 0) && (delay == 0)) ? switches : 16'bz; endmodule