Paul Rubin <no.email@nospam.invalid> wrote:
https://dmitry.gr/?r=06.%20Thoughts&proj=12.%20RV
Some comments.
1) Interrupt latency claim is half-truth. First, normal RISC-V has
32 registers while ARM has 16. If you can do with 16 registers
divide register set into 2 parts, use one part for normal code
and the other for interrupt handler. That way you will get few
cycle overhead, impossible feat for Cortex M. So it is really
a tradeoff; do you want to have modest overhead for pretty
typical use case, or do you for very low overhead in cases that
need it and higher overhead for typical cases?
Similarly, it is not safe to access the global register variables
from signal handlers or from more than one thread of control. Unless
you recompile them specially for the task at hand, the system
library routines may temporarily use the register for other things.
Furthermore, since the register is not reserved exclusively for the
variable, accessing it from handlers of asynchronous signals may
observe unrelated temporary values residing in the register.
5) Optionality. I do not like it and it is probably biggest
problem of RISC-V. OTOH to have any chance of success RISC-V
need a buy-in from several independent parties. I suspect that
the only practical way to get consensus from varied parties is
by making most of specification optional.
The most obvious example, to my mind, is something
GrinbergrCOs critique doesnrCOt even mentionrCerCorCeitrCOs having the divide >instruction in the M extension. Hardware multiplication is crucial for
all kinds of applications, including software-defined radio and other
DSP, image processing, 3-D rendering, and neural networks. By contrast, >hardware division is a minor advantage but rarely appears in inner
loops, and has been omitted from historical architectures including the >Cray-1, Cray-2, and ARM.
antispam@fricas.org (Waldek Hebisch) writes:
Paul Rubin <no.email@nospam.invalid> wrote:
https://dmitry.gr/?r=06.%20Thoughts&proj=12.%20RV
Some comments.
1) Interrupt latency claim is half-truth. First, normal RISC-V has
32 registers while ARM has 16. If you can do with 16 registers
divide register set into 2 parts, use one part for normal code
and the other for interrupt handler.-------snip-------
This is a really good point, and one I should have thought of. You can reserve some registers as rCLFIQrCY registers and only use them inside interrupt handlers, depsite the absence of an architectural FIQ
mechanism (which was present on the ARM2 but excised in the Cortex-M).
(Note that most existing RISC-V cores like the QingKe core used in the CH32V003 have their own, incompatible, interrupt-handling mechanisms.
Generally these are FIQ-like, enabling lower latency than the standard
RISC-V mechanism but with a limited depth of nested interrupts.)
You can write the rCLFIQrCY handler itself in assembly, since if it needs to be more than about 16 instructions long you might as well switch to the standard ABI, but you also need to compile the rest of your application
with the rCLFIQ registersrCY reserved, including any system libraries you might be using, such as an integer division subroutine. This is true
whether yourCOre using Forth, or C, or any other language.
8 registers is probably enough for the FIQ handler, so with RV32I you
have 24 left over for the rest of the code.
I had looked for how to achieve this three years ago for a project
called Monokokko, which is a five-machine-instruction-long cooperative-multitasking OS for ARM:
.thumb_func
yield: push {r4-r9, r11, lr} @ save all callee-saved regs except r10
str sp, [r10], #4 @ save stack pointer in current task
ldr r10, [r10] @ load pointer to next task
ldr sp, [r10] @ switch to next task's stack
pop {r4-r9, r11, pc} @ return into yielded context there
<http://canonical.org/~kragen/sw/dev3/monokokko.S>
Now I know how to solve the problem! So I can write Monokokko tasks in
C now!
5) Optionality. I do not like it and it is probably biggest
problem of RISC-V. OTOH to have any chance of success RISC-V
need a buy-in from several independent parties. I suspect that
the only practical way to get consensus from varied parties is
by making most of specification optional.
For CPU vendors and computer architecture researchers, I suspect this is
the biggest selling point of RISC-V: they can add experimental vector extensions without waiting for them to be ratified, they can add
FIQ-style low-latency interrupt handling, they can implement their own
memory protection mechanisms, they can add zero-overhead loops, etc. As
I understand it, Berkeley researchersrCO nightmarish negotiations with ARM
to get a license to perform such experiments on ARM cores was the hell
from which RISC-V came in the first place.
It also means that bad decisions by RISC-V International have much less impact on licensees. The most obvious example, to my mind, is something GrinbergrCOs critique doesnrCOt even mentionrCerCorCeitrCOs having the divide instruction in the M extension. Hardware multiplication is crucial for
all kinds of applications, including software-defined radio and other
DSP, image processing, 3-D rendering, and neural networks. By contrast, hardware division is a minor advantage but rarely appears in inner
loops, and has been omitted from historical architectures including the Cray-1, Cray-2, and ARM.
Kragen--- Synchronet 3.22a-Linux NewsLink 1.2
... You can
reserve some registers as "FIQ" registers and only use them inside
interrupt handlers, depsite the absence of an architectural FIQ
mechanism (which was present on the ARM2 but excised in the Cortex-M).
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 74 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 03:36:51 |
| Calls: | 1,194 |
| Files: | 1,353 |
| D/L today: |
2 files (1,590K bytes) |
| Messages: | 291,364 |