Line 267... |
Line 267... |
.Atomic Memory Operations
|
.Atomic Memory Operations
|
[IMPORTANT]
|
[IMPORTANT]
|
The `A` CPU extension only implements the `lr.w` and `sc.w` instructions yet.
|
The `A` CPU extension only implements the `lr.w` and `sc.w` instructions yet.
|
However, these instructions are sufficient to emulate all further atomic memory operations.
|
However, these instructions are sufficient to emulate all further atomic memory operations.
|
|
|
.Bit-Manipulation ISA Extension
|
|
[IMPORTANT]
|
|
The NEORV32 `B` extension only implements the _basic bit-manipulation instructions_ (`Zbb`) subset
|
|
and the _address generation instructions_ (`Zba`) subset yet.
|
|
|
|
|
|
|
|
|
|
// ####################################################################################################################
|
// ####################################################################################################################
|
:sectnums:
|
:sectnums:
|
=== CPU Top Entity - Signals
|
=== CPU Top Entity - Signals
|
Line 420... |
Line 414... |
==== **`B`** - Bit-Manipulation Operations
|
==== **`B`** - Bit-Manipulation Operations
|
|
|
The `B` ISA extension adds instructions for bit-manipulation operations. This extension is enabled if the
|
The `B` ISA extension adds instructions for bit-manipulation operations. This extension is enabled if the
|
`CPU_EXTENSION_RISCV_B` configuration generic is _true_.
|
`CPU_EXTENSION_RISCV_B` configuration generic is _true_.
|
The official RISC-V specifications can be found here: https://github.com/riscv/riscv-bitmanip
|
The official RISC-V specifications can be found here: https://github.com/riscv/riscv-bitmanip
|
|
A copy of the spec is also available in `docs/references`.
|
|
|
[IMPORTANT]
|
The NEORV32 `B` ISA extension includes the following sub-extensions (according to the RISC-V
|
The NEORV32 `B` extension only implements the _basic bit-manipulation instructions_ (`Zbb`) subset
|
bit-manipulation spec. v.093) and their corresponding instructions:
|
and the _address generation instructions_ (`Zba`) subset yet.
|
|
|
|
The `Zbb` sub-extension adds the following instructions:
|
|
|
|
* `andn` `orn` `xnor`
|
|
* `clz` `ctz` `cpop`
|
|
* `max` `maxu` `min` `minu`
|
|
* `sext.b` `sext.h` `zext.h`
|
|
* `rol` `ror` `rori`
|
|
* `orc.b` `rev8`
|
|
|
|
The `Zba` sub-extension adds the following instructions:
|
|
|
|
* `sh1add` `sh2add` `sh3add`
|
* **`Zba` - Address-generation instructions**
|
|
** `sh1add` `sh2add` `sh3add`
|
|
* **`Zbb` - Basic bit-manipulation instructions**
|
|
** `andn` `orn` `xnor`
|
|
** `clz` `ctz` `cpop`
|
|
** `max` `maxu` `min` `minu`
|
|
** `sext.b` `sext.h` `zext.h`
|
|
** `rol` `ror` `rori`
|
|
** `orc.b` `rev8`
|
|
* **`Zbc` - Carry-less multiplication instructions**
|
|
** `clmul` `clmulh` `clmulr`
|
|
* **`Zbs` - Single-bit instructions**
|
|
** `bclr` `bclri`
|
|
** `bext` `bexti`
|
|
** `bext` `binvi`
|
|
** `bset` `bseti`
|
|
|
[TIP]
|
[TIP]
|
By default, the bit-manipulation unit uses an _iterative_ approach to compute shift-related operations
|
By default, the bit-manipulation unit uses an _iterative_ approach to compute shift-related operations
|
like `clz` and `rol`. To increase performance (at the cost of additional hardware resources) the
|
like `clz` and `rol`. To increase performance (at the cost of additional hardware resources) the
|
<<_fast_shift_en>> generic can be enabled to implement full-parallel logic (like barrel shifters) for all
|
<<_fast_shift_en>> generic can be enabled to implement full-parallel logic (like barrel shifters) for all
|
shift-related `B` instructions.
|
shift-related `B` instructions.
|
|
|
[WARNING]
|
[WARNING]
|
The `B` extension is frozen but not officially ratified yet. There is no
|
The `B` extension is frozen and officially ratified. However, there is no
|
software support for this extension in the upstream GCC RISC-V port yet. However, an
|
software support for this extension in the upstream GCC RISC-V port yet. An
|
intrinsic library is provided to utilize the provided `B` extension features from C-language
|
intrinsic library is provided to utilize the provided `B` extension features from C-language
|
code (see `sw/example/bitmanip_test`).
|
code (see `sw/example/bitmanip_test`) to circumvent this.
|
|
|
|
|
==== **`C`** - Compressed Instructions
|
==== **`C`** - Compressed Instructions
|
|
|
The _compressed_ ISA extension provides 16-bit encodings of commonly used instructions to reduce code space size.
|
The _compressed_ ISA extension provides 16-bit encodings of commonly used instructions to reduce code space size.
|
Line 795... |
Line 793... |
| Bit-manipulation - shifts | `B(Zbb)` | `clz` `ctz` | 3 + 0..32
|
| Bit-manipulation - shifts | `B(Zbb)` | `clz` `ctz` | 3 + 0..32
|
| Bit-manipulation - shifts | `B(Zbb)` | `cpop` | 3 + 32
|
| Bit-manipulation - shifts | `B(Zbb)` | `cpop` | 3 + 32
|
| Bit-manipulation - shifts | `B(Zbb)` | `rol` `ror` `rori` | 3 + SA
|
| Bit-manipulation - shifts | `B(Zbb)` | `rol` `ror` `rori` | 3 + SA
|
| Bit-manipulation - single-bit | `B(Zbs)` | `sbset[i]` `sbclr[i]` `sbinv[i]` `sbext[i]` | 3
|
| Bit-manipulation - single-bit | `B(Zbs)` | `sbset[i]` `sbclr[i]` `sbinv[i]` `sbext[i]` | 3
|
| Bit-manipulation - shifted-add | `B(Zba)` | `sh1add` `sh2add` `sh3add` | 3
|
| Bit-manipulation - shifted-add | `B(Zba)` | `sh1add` `sh2add` `sh3add` | 3
|
|
| Bit-manipulation - carry-less multiply | `B(Zbc)` | `clmul` `clmulh` `clmulr` | 3 + 32
|
|=======================
|
|=======================
|
|
|
[NOTE]
|
[NOTE]
|
The presented values of the *floating-point execution cycles* are average values - obtained from
|
The presented values of the *floating-point execution cycles* are average values - obtained from
|
4096 instruction executions using pseudo-random input values. The execution time for emulating the
|
4096 instruction executions using pseudo-random input values. The execution time for emulating the
|