In this tutorial, we'll decribe T flip flip withour reset, with synchronous reset and asynchronous reset.
Clock Edge |
T |
Q |
Description |
$$\downarrow$$ |
X |
Q |
No Change (Store previous input) |
$$\uparrow$$ |
0 |
Q |
Previous State |
$$\uparrow$$ |
1 |
$$\overline Q$$ |
Toogle |
module tff(clk,t,q);
input clk,t;
output reg q;
always @ (posedge clk)begin
if(t == 0)
q <= q;
else
q = ~q;
end
endmodule
module tff(clk,reset,d,q);
input clk,reset,d;
output reg q;
always @ (posedge clk)begin
if(reset)
q <= 0;
else begin
if(t == 0)
q <= q;
else
q = ~q;
end
end
endmodule
module tff(clk,reset,d,q);
input clk,reset,d;
output reg q;
always @ (posedge clk or negedge reset)begin
if(~reset)
q <= 0;
else begin
if(t == 0)
q <= q;
else
q = ~q;
end
end
endmodule
Click like if you found this useful
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you are declaring that you agree with these rules:
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
Comments