4 ms·
How does the modular instruction set work? If someone proposes an extension, is the onus on them to also provide a minimal RISCV implementation of that function
by bee_rider 5y ago
How does the modular instruction set work? If someone proposes an extension, is the onus on them to also provide a minimal RISCV implementation of that functionality? Or is it just accepted that some binaries won't work on all devices?
- forty 5y agoI have no idea for Riscv specifically, but x86/amd64 have a lot of optional instructions (I'm mostly aware of vector stuff like SSE, AVX but I'm sure there are other stuff). On the programming side, you can detect at runtime feature support and use specific code path accordingly, or decide at compile time that you require a specific CPU feature and then your binary will just not work on CPUs without the feature.
- Pet_Ant 5y ago> Or is it just accepted that some binaries won't work on all devices? Yes. Just like you cannot run Pentium code on a 386 because they added new extensions. Or how Scheme isn't really a programming language but more like a _family_ of very nearly compatible languagues. RISCV has multiple targets and so so they have very different needs from embedded automotive to desktop. But with a common core is easier to develop and share tooling.
- deleted 5y ago[deleted]
- YorkshireSeason 5y agoIt's best to think of RISCV not as a single ISA (= instruction set architecture), but a parametric ISA. The extensions are parameters. RISCV offers lots of official extensions to choose from, such as M, A, F, D, P, V, .... In addition you have the 32 vs 64 bit data width parameter. Any specific ISA will have to instantiate those parameters, like e.g. so: RISCV32MFP or RISCV64MAF. Any implementation of e.g. RISCV64MAF will have to implement in silicon exactly those assembly command (and supporting features) that the M, A and F extension demand, with 64 bit register width. Like in OO-programming the class constructors take arguments that parameterise the created object. ------ Regarding an implementation, given that RISCV is an ISA, not an ISA implementation, you need to provide a functional model. The official standard is [1] but it's a bit behind the ratified extensions. For example [2] defines the (ISA-visible) registers, while [3] gives you the instruction decoding and execution clause for the most base instruction set. [4] describes part of one of the available address translation modes (for the 32 bit variant of the ISA). Note: in modern processors page-table walks are hardware accelerated, so OS and processor need to use the same format here, which is why this is part of the ISA. [1] https://github.com/riscv/sail-riscv/tree/master/model https://github.com/riscv/sail-riscv/tree/master/model [2] https://github.com/riscv/sail-riscv/blob/master/model/riscv_regs.sail https://github.com/riscv/sail-riscv/blob/master/model/riscv_... [3] https://github.com/riscv/sail-riscv/blob/master/model/riscv_insts_base.sail https://github.com/riscv/sail-riscv/blob/master/model/riscv_... [4] https://github.com/riscv/sail-riscv/blob/master/model/riscv_vmem_sv32.sail https://github.com/riscv/sail-riscv/blob/master/model/riscv_...
- panick21_ 5y agoThe way it works is that there are profiles. The idea behind profiles is that different use cases define profiles with the instruction extensions the require or are optional and so on. So the major Linux distros agree on a set of instructions and that's called a profile. Same for embedded and others eventually. You can add your own extensions for yourself if you want. You can also make extentions and try to make it a sudo standard. Or you can attempt to make it into a standard extention. To be a standard extension it has to go threw a long process and it will likely be tapped out multiple times before it is ever ratified. Once its ratified it will find its way into profiles. So for example standard Linux distros now use RV64GC, likely the next version of the Linux profile will include more of the new instructions. But yes, the goal is not to create a 'universal binary'. But a reasonable compromise between reuse and specialization.