mirror of
https://github.com/enjoy-digital/litescope.git
synced 2025-01-04 09:52:27 -05:00
litescope/common: add Counter (will be removed from migen)
This commit is contained in:
parent
9393fee9f3
commit
984feb185f
1 changed files with 9 additions and 0 deletions
|
@ -8,6 +8,15 @@ from migen.flow.plumbing import Buffer
|
|||
from migen.fhdl.specials import Memory
|
||||
|
||||
|
||||
@ResetInserter()
|
||||
@CEInserter()
|
||||
class Counter(Module):
|
||||
def __init__(self, *args, increment=1, **kwargs):
|
||||
self.value = Signal(*args, **kwargs)
|
||||
self.width = flen(self.value)
|
||||
self.sync += self.value.eq(self.value+increment)
|
||||
|
||||
|
||||
def data_layout(dw):
|
||||
return [("data", dw, DIR_M_TO_S)]
|
||||
|
||||
|
|
Loading…
Reference in a new issue