OpenCores
URL https://opencores.org/ocsvn/neorv32/neorv32/trunk

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [docs/] [datasheet/] [soc_mtime.adoc] - Blame information for rev 70

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 60 zero_gravi
<<<
2
:sectnums:
3
==== Machine System Timer (MTIME)
4
 
5
[cols="<3,<3,<4"]
6
[frame="topbot",grid="none"]
7
|=======================
8
| Hardware source file(s): | neorv32_mtime.vhd |
9
| Software driver file(s): | neorv32_mtime.c |
10
|                          | neorv32_mtime.h |
11
| Top entity port:         | `mtime_i` | System time input from external MTIME
12
|                          | `mtime_o` | System time output (64-bit) for SoC
13
| Configuration generics:  | _IO_MTIME_EN_ | implement MTIME when _true_
14
| CPU interrupts:          | `MTI` | machine timer interrupt (see <<_processor_interrupts>>)
15
|=======================
16
 
17 70 zero_gravi
The MTIME module implements the memory-mapped MTIME machine timer from the official RISC-V
18
specifications. This module features a 64-bit system timer incrementing with the primary processor clock.
19
Besides accessing the MTIME register via memory operation the current system time can also be obtained using
20
the `time[h]` CSRs. Furthermore, the current system time is made available for processor-external
21
usage via the top's `mtime_o` signal.
22 60 zero_gravi
 
23 70 zero_gravi
The 64-bit system time can be accessed via the `TIME_LO` and `TIME_HI` memory-mapped registers (read/write) and also via
24
the CPU's `time[h]` CSRs (read-only). A 64-bit time compare register - accessible via the memory-mapped `TIMECMP_LO` and `TIMECMP_HI`
25
registers - is used to configure the CPU's MTI (machine timer interrupt). The interrupt is triggered
26
whenever `TIME` (high & low part) is greater than or equal to `TIMECMP` (high & low part).
27
The interrupt remain active (=pending) until `TIME` becomes less `TIMECMP` again (either by modifying `TIME` or `TIMECMP`).
28 60 zero_gravi
 
29
[NOTE]
30 70 zero_gravi
If the processor-internal **MTIME module is NOT implemented**, the top's `mtime_i` input signal is used to update the `time[h]` CSRs
31
and the `MTI` machine timer CPU interrupt (`MTI`) is directly connected to the top's `mtime_irq_i` input. The `mtime_o` signal
32
is hardwired to zero in this case.
33 60 zero_gravi
 
34
 
35 64 zero_gravi
.MTIME register map (`struct NEORV32_MTIME`)
36 60 zero_gravi
[cols="<3,<3,^1,^1,<6"]
37
[options="header",grid="all"]
38
|=======================
39
| Address      | Name [C]      | Bits | R/W | Function
40 64 zero_gravi
| `0xffffff90` | `NEORV32_MTIME.TIME_LO`    | 31:0 | r/w | machine system time, low word
41
| `0xffffff94` | `NEORV32_MTIME.TIME_HI`    | 31:0 | r/w | machine system time, high word
42
| `0xffffff98` | `NEORV32_MTIME.TIMECMP_LO` | 31:0 | r/w | time compare, low word
43
| `0xffffff9c` | `NEORV32_MTIME.TIMECMP_HI` | 31:0 | r/w | time compare, high word
44 60 zero_gravi
|=======================

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.