1
0
mirror of https://github.com/myhdl/myhdl.git synced 2025-01-24 21:52:56 +08:00
2005-12-14 14:41:53 +00:00

25 lines
382 B
Python

from myhdl import *
ACTIVE_LOW, INACTIVE_HIGH = 0, 1
def dff(q, d, clk, reset):
""" D flip-flop.
q -- output
d -- input
clock -- clock input
reset -- asynchronous reset input
"""
@always(clk.posedge, reset.negedge)
def logic():
if reset == ACTIVE_LOW:
q.next = 0
else:
q.next = d
return logic