//////////////////////////////////////////////////////////// // function : D Type Flip-flop with asynchronous clear // // _______________ // | | // | | // data ------| |----- q // | D | // | Flip-flop | // | with | // | Asynch. | // | clear | // clock ------|> | // | | // |______________| // | // clear ------------- // //////////////////////////////////////////////////////////// module dff_async (data, clock, clear, q); // port list input data, clock, clear; output q; // reg / wire declaration for outputs / inouts reg q; // reg / wire declaration for internal signals // logic begins here always @(negedge clock or posedge clear) if(clear) q <= 1'b0; else q <= data; endmodule