@@ -59,7 +59,7 @@ bits/channels are hardwired to zero.
59
59
[options="header",grid="rows"]
60
60
|=======================
61
61
| Signal | Width | Dir. | Function
62
- 4+^| **Global Control**
62
+ 4+^| **Global Control (<<_processor_clocking>> and <<_processor_reset>>) **
63
63
| `clk_i` | 1 | in | global clock line, all registers triggering on rising edge
64
64
| `rstn_i` | 1 | in | global reset, asynchronous, **low-active**
65
65
4+^| **JTAG Access Port for <<_on_chip_debugger_ocd>>**
@@ -1072,6 +1072,94 @@ See section <<_execute_in_place_module_xip>> for more information.
1072
1072
1073
1073
1074
1074
1075
+ <<<
1076
+ // ####################################################################################################################
1077
+ :sectnums:
1078
+ === Processor Clocking
1079
+
1080
+ The processor is implemented as fully-synchronous logic design using a _single clock domain_ that is driven by the top's
1081
+ `clk_i` signal. This clock signal is used by all internal registers and memories, which trigger on the rising edge of
1082
+ this clock signal. External "clocks" like the OCD's JTAG clock or the TWI's serial clock are synchronized into the
1083
+ processor's clock domain before being further processed.
1084
+
1085
+ [NOTE]
1086
+ The registers of the <<_processor_reset>> system trigger on a falling clock edge.
1087
+
1088
+ Many processor modules like the UARTs or the timers require a programmable time base for operations. In order to simplify
1089
+ the hardware, the processor implements a global "clock generator" that provides _clock enables_ for certain frequencies.
1090
+ These clock enable signals are synchronous to the system's main clock and will be high for only a single cycle of this main
1091
+ clock. Hence, processor modules can use these signals for sub-main-clock operations while still having a single clock domain
1092
+ only.
1093
+
1094
+ In total, 8 sub-main-clock signals are available. All processor modules, which feature a time-based configuration, provide a
1095
+ programmable three-bit prescaler select in their according control register to select one of the 8 available clocks. The
1096
+ mapping of the prescaler select bits to the according clock source is shown in the table below. Here, _f_ represents the
1097
+ processor main clock from the top entity's `clk_i` signal.
1098
+
1099
+ [cols="<3,^1,^1,^1,^1,^1,^1,^1,^1"]
1100
+ [grid="rows"]
1101
+ |=======================
1102
+ | Prescaler bits: | `0b000` | `0b001` | `0b010` | `0b011` | `0b100` | `0b101` | `0b110` | `0b111`
1103
+ | Resulting clock: | _f/2_ | _f/4_ | _f/8_ | _f/64_ | _f/128_ | _f/1024_ | _f/2048_ | _f/4096_
1104
+ |=======================
1105
+
1106
+ The software framework provides pre-defined aliases for the prescaler select bits:
1107
+
1108
+ .Prescaler Aliases from `neorv32.h`
1109
+ [source]
1110
+ --------------------------
1111
+ enum NEORV32_CLOCK_PRSC_enum {
1112
+ CLK_PRSC_2 = 0, /**< CPU_CLK (from clk_i top signal) / 2 */
1113
+ CLK_PRSC_4 = 1, /**< CPU_CLK (from clk_i top signal) / 4 */
1114
+ CLK_PRSC_8 = 2, /**< CPU_CLK (from clk_i top signal) / 8 */
1115
+ CLK_PRSC_64 = 3, /**< CPU_CLK (from clk_i top signal) / 64 */
1116
+ CLK_PRSC_128 = 4, /**< CPU_CLK (from clk_i top signal) / 128 */
1117
+ CLK_PRSC_1024 = 5, /**< CPU_CLK (from clk_i top signal) / 1024 */
1118
+ CLK_PRSC_2048 = 6, /**< CPU_CLK (from clk_i top signal) / 2048 */
1119
+ CLK_PRSC_4096 = 7 /**< CPU_CLK (from clk_i top signal) / 4096 */
1120
+ };
1121
+ --------------------------
1122
+
1123
+ [TIP]
1124
+ If no peripheral modules requires a clock signal from the internal generator (all available modules disabled by clearing the
1125
+ _enable_ bit in the according module's control register), it is automatically deactivated to reduce dynamic power consumption.
1126
+
1127
+
1128
+
1129
+ <<<
1130
+ // ####################################################################################################################
1131
+ :sectnums:
1132
+ === Processor Reset
1133
+
1134
+ The processor provides two reset systems: an _external_ one and an _internal_ one. The external reset is triggered by
1135
+ the asynchronous, low-active `rstn_i` top entity signal. The internal reset is a synchronous, low-active reset that
1136
+ can be triggered by the external reset, the <<_on_chip_debugger_ocd>> and the <<_watchdog_timer_wdt>>.
1137
+
1138
+ If the external hardware reset (`rstn_i` ) is active it will be _asynchronously_ applied to all processor modules. An
1139
+ internal shift register ensures that the system wide reset will be active for at least 4 clock cycles. After that,
1140
+ the system wide reset is de-asserted _synchronously_ at a _falling_ edge of the main clock to ensure there are no
1141
+ meta-stable situation (like de-asserting reset at a rising edge).
1142
+
1143
+ If one of the internal reset sources trigger a reset, this will be applied _synchronously_ to all processor modules
1144
+ at a rising edge. This signal is also extended to be active for at least 4 clock cycles. After that, the system wide
1145
+ reset is also de-asserted _synchronously_ at a _falling_ edge.
1146
+
1147
+ [TIP]
1148
+ The EE Times provided a nice article about FPGA resets. The reset system of the NEORV32 is loosely based on this
1149
+ article: https://www.eetimes.com/how-do-i-reset-my-fpga/
1150
+
1151
+ The system-wide reset will reset the CPU, the <<_processor_clocking>> system and the IO/peripheral devices.
1152
+
1153
+ [NOTE]
1154
+ Note that the system reset will **NOT** reset _all_ PCU register by default. See section <<_cpu_hardware_reset>>
1155
+ for more information.
1156
+
1157
+ [NOTE]
1158
+ The system reset will only reset the control registers of each implemented IO/peripheral module. This will also
1159
+ reset the according "module enable flag" to zero, which - in turn - will cause a _synchronous_ and
1160
+ module-internal reset of the remaining logic.
1161
+
1162
+
1075
1163
<<<
1076
1164
// ####################################################################################################################
1077
1165
:sectnums:
@@ -1372,40 +1460,7 @@ exited as soon as the application logic has finished initializing the memory wit
1372
1460
1373
1461
Basically, the NEORV32 processor is a SoC consisting of the NEORV32 CPU, peripheral/IO devices, embedded
1374
1462
memories, an external memory interface and a bus infrastructure to interconnect all units. Additionally, the
1375
- system implements an internal reset generator and a global clock generator/divider.
1376
-
1377
-
1378
- **Internal Reset Generator**
1379
-
1380
- The internal reset generator is responsible for controlling the processor-global system reset.
1381
- This system reset is either triggered via the external reset pin (`rstn_i` , low-active), by the internal
1382
- watchdog timer (if implemented) or by the on-chip debugger (if implemented). If any of those sources issues
1383
- an active reset the system reset is activated for at least 4 cycles.
1384
-
1385
-
1386
- **Internal Clock Divider**
1387
-
1388
- An internal clock divider generates 8 clock signals derived from the processor's main clock input `clk_i` .
1389
- These derived clock signals are not actual _clock signals_ . Instead, they are derived from a simple counter and
1390
- can be used as "clock enable" signal by the different processor modules. Thus, the whole processor operates using
1391
- only the main clock signal (single clock domain). Some of the processor peripherals like the Watchdog or the
1392
- UARTs can select one of the derived clock enabled signals for their internal operations.
1393
-
1394
- [TIP]
1395
- If none of the peripheral modules require a clock signal from the internal divider, it is automatically deactivated
1396
- to reduce dynamic power consumption.
1397
-
1398
- Peripheral devices, which feature a time-based configuration, provide a three-bit prescaler select in their
1399
- according control register to select one of the eight available clocks. The mapping of the prescaler select
1400
- bits to the according clock source is shown in the table below. Here, _f_ represents the processor main clock
1401
- from the top entity's `clk_i` signal.
1402
-
1403
- [cols="<3,^1,^1,^1,^1,^1,^1,^1,^1"]
1404
- [grid="rows"]
1405
- |=======================
1406
- | Prescaler bits: | `0b000` | `0b001` | `0b010` | `0b011` | `0b100` | `0b101` | `0b110` | `0b111`
1407
- | Resulting clock: | _f/2_ | _f/4_ | _f/8_ | _f/64_ | _f/128_ | _f/1024_ | _f/2048_ | _f/4096_
1408
- |=======================
1463
+ system implements an internal reset generator (-> <<_processor_reset>>) and a global clock system (-> <<_processor_clocking>>).
1409
1464
1410
1465
1411
1466
**Peripheral / IO Devices**
@@ -1415,7 +1470,7 @@ address _0xFFFFFE00_. A region of 512 bytes is reserved for this devices. Hence,
1415
1470
accessed using a memory-mapped scheme. A special linker script as well as the NEORV32 core software
1416
1471
library abstract the specific memory layout for the user.
1417
1472
1418
- .Address Space Mapping
1473
+ .Module Address Space Mapping
1419
1474
[IMPORTANT]
1420
1475
The base address of each component/module has to be aligned to the
1421
1476
total size of the module's occupied address space! The occupied address space
@@ -1428,19 +1483,18 @@ All peripheral/IO devices can only be written in full-word mode (i.e. 32-bit). B
1428
1483
Processor-internal memories as well as modules connected to the external memory interface can still
1429
1484
be written with a byte-wide granularity.
1430
1485
1431
- .Unimplemented Modules
1486
+ .Unimplemented Modules / "Address Holes"
1432
1487
[NOTE]
1433
- When accessing an IO device that hast not been implemented (disabled via the according generic), a
1434
- load or store access fault exception is triggered .
1488
+ When accessing an IO device that hast not been implemented (disabled via the according generic)
1489
+ or when accessing an address that is _unused_ , a load or store access fault exception is raise .
1435
1490
1436
1491
.Module Reset
1437
1492
[NOTE]
1438
- All processor-internal modules provide a dedicated hardware reset, which can be triggered by the external reset
1439
- signal, the watchdog timer or the on-chip debugger. When active, the system-wide reset will ensure that all
1440
- **module interface register** (like the control register) are reset to all-zero. Note that this hardware reset
1441
- does not _directly_ reset the remaining module's logic - the internal logic is reset _synchronously_ when the
1493
+ All processor-internal modules provide a dedicated hardware reset, which is triggered by the <<_processor_reset>>
1494
+ system. When active, the system-wide reset will reset all module's _control registers_ to all-zero. Note that this
1495
+ hardware reset does not _directly_ reset the remaining module's logic - the internal logic is reset _synchronously_ when the
1442
1496
enable bit in the according unit's control register is cleared. Software can trigger a module reset
1443
- by clearing the enable bit of the module's control register.
1497
+ by clearing the enable bit of the module's control register. See section <<_processor_reset>> for more information.
1444
1498
1445
1499
.Software Access
1446
1500
[TIP]
@@ -1458,9 +1512,10 @@ A CMSIS-SVD-compatible **System View Description (SVD)** file including all peri
1458
1512
Most peripheral/IO devices provide some kind of interrupt (for example to signal available incoming data). These
1459
1513
interrupts are entirely mapped to the CPU's <<_custom_fast_interrupt_request_lines>>. Note that all these
1460
1514
interrupt lines are high-active and are permanently triggered until the IRQ-causing condition is resolved.
1515
+ See section <<_processor_interrupts>> for more information.
1461
1516
1462
1517
1463
- **Nomenclature for the Peripheral / IO Devices Listing**
1518
+ **Nomenclature for Peripheral / IO Devices Listing**
1464
1519
1465
1520
Each peripheral device chapter features a register map showing accessible control and data registers of the
1466
1521
according device including the implemented control and status bits. C-language code can directly interact with these
0 commit comments