soc/cores/timer/doc: rewrite a little bit, avoid some redundancy, change ident.

This commit is contained in:
Florent Kermarrec 2019-09-18 10:14:47 +02:00
parent f1139c36b4
commit 28885064f7

View file

@ -1,4 +1,6 @@
# This file is Copyright (c) 2013-2015 Sebastien Bourdeauducq <sb@m-labs.hk> # This file is Copyright (c) 2013-2015 Sebastien Bourdeauducq <sb@m-labs.hk>
# This file is Copyright (c) 2019 Sean Cross <sean@xobs.io>
# This file is Copyright (c) 2019 Florent Kermarrec <florent@enjoy-digital.fr>
# License: BSD # License: BSD
@ -10,22 +12,19 @@ from litex.soc.interconnect.csr_eventmanager import *
class Timer(Module, AutoCSR): class Timer(Module, AutoCSR):
def __init__(self, width=32): def __init__(self, width=32):
self._load = CSRStorage(width, description="""This is the initial value loaded into the self._load = CSRStorage(width, description=
timer. You can make a one-shot timer by disabling the """Load value when timer is (re-)enabled.
timer, writing to this register, and then re-enabling This register is only used to create a One-Shot timer and specify the timer's duration
the timer. For a recurring timer, set this to the same in clock cycles: Disable the timer, write load value and re-enable the timer""")
value as `reload`, or to 0.""") self._reload = CSRStorage(width, description=
self._reload = CSRStorage(width, description="""The internal timer value will be updated """Reload value when timer reaches 0.
with this value whenever it reaches 0. Use this to create This register is used to create a Periodic timer and specify the timer's period in clock
a periodic timer that fires whenever this transitions from cycles. For a One-Shot timer, this register need to be set to 0.""")
0 to >0. To create a one-shot timer, leave this value as 0.""") self._en = CSRStorage(1, description=
self._en = CSRStorage(fields=[CSRField("en", description="Write a `1` here to start the timer running")]) """Enable. Write 1 to enable/start the timer, 0 to disable the timer""")
self._update_value = CSRStorage(fields=[CSRField("update", description="""Writing to this register causes self._update_value = CSRStorage(1, description=
the `value` register to be updated with with the current countdown """Update. Write 1 to latch current countdown to value register.""")
value.""")]) self._value = CSRStatus(width, description="""Latched countdown value""")
self._value = CSRStatus(width, description="""Last snapshotted value of the countdown
timer. This value is only updated when a `1` is written
to `update_value`.""")
self.submodules.ev = EventManager() self.submodules.ev = EventManager()
self.ev.zero = EventSourceProcess() self.ev.zero = EventSourceProcess()