mirror of
https://github.com/myhdl/myhdl.git
synced 2025-01-24 21:52:56 +08:00
19 lines
387 B
Python
19 lines
387 B
Python
from myhdl import block, always_seq
|
|
|
|
@block
|
|
def inc(count, enable, clock, reset):
|
|
""" Incrementer with enable.
|
|
|
|
count -- output
|
|
enable -- control input, increment when 1
|
|
clock -- clock input
|
|
reset -- asynchronous reset input
|
|
"""
|
|
|
|
@always_seq(clock.posedge, reset=reset)
|
|
def seq():
|
|
if enable:
|
|
count.next = count + 1
|
|
|
|
return seq
|