2019-10-18 05:50:24 -05:00
|
|
|
module latchp ( input d, clk, en, output reg q );
|
2019-09-23 04:12:02 -05:00
|
|
|
always @*
|
|
|
|
if ( en )
|
|
|
|
q <= d;
|
|
|
|
endmodule
|
|
|
|
|
2019-10-18 05:50:24 -05:00
|
|
|
module latchn ( input d, clk, en, output reg q );
|
2019-09-23 04:12:02 -05:00
|
|
|
always @*
|
|
|
|
if ( !en )
|
|
|
|
q <= d;
|
|
|
|
endmodule
|
|
|
|
|
2019-10-18 05:50:24 -05:00
|
|
|
module latchsr ( input d, clk, en, clr, pre, output reg q );
|
2019-09-23 04:12:02 -05:00
|
|
|
always @*
|
|
|
|
if ( clr )
|
|
|
|
q <= 1'b0;
|
|
|
|
else if ( pre )
|
|
|
|
q <= 1'b1;
|
|
|
|
else if ( en )
|
|
|
|
q <= d;
|
|
|
|
endmodule
|