Verilog HDL: Instantiating a DFFE
This example describes how to generate a D flipflop with enable (DFFE) behaviorally with asynchronous preset and reset signals. Both the preset and reset signals are active low, controlling the output of the DFFE whenever either signal goes low.
For more information on using this example in your project, go to:
dffeveri.v
module dffeveri (q, d, clk, ena, rsn, prn);
// port declaration
input d, clk, ena, rsn, prn;
output q;
reg q;
always @ (posedge clk or negedge rsn or negedge prn) begin
//asynchronous active-low preset
if (~prn)
begin
if (rsn)
q = 1'b1;
else
q = 1'bx;
end
//asynchronous active-low reset
else if (~rsn)
q = 1'b0;
//enable
else if (ena)
q = d;
end
endmodule
Feedback
Did this information help you?
If not, please log onto mySupport to file a technical request or enhancement.
Altera does not warrant that this solution will work for the customer's intended purpose and disclaims all liability for use of or reliance on the solution.
|