4 ms·
I want to see every extension be forwards and backwards compatible. Ie. a binary should run fine with or without a processor extension. To make that happen, e
by londons_explore 4y ago
I want to see every extension be forwards and backwards compatible.
Ie. a binary should run fine with or without a processor extension.
To make that happen, every processor extension should either be implemented in hardware, or be emulated by software.
None of these extensions to the ISA have software implementations. Sure, someone could write one, but I don't think the RISC-V standards group should allow any extensions to make it into silicon without a software implementation being published and freely available.
The RISC-V group should publish an official binary (and source) which can trap and emulate every possible extension.
- adgjlsfhk1 4y agoYou can't allow for forward compatibility without sacrificing performance. If a chip knows that there is a fixed set of opcodes, it can specialize decoding to only decode the opcodes it knows about.
- colejohnson66 4y ago> If a chip knows that there is a fixed set of opcodes, it can specialize decoding to only decode the opcodes it knows about. What does that mean? The CPU still needs to trap on undefined ones. I don't think the spec even allows non-trapping behavior[a]. So there's still some kind of decode happening. And if each instruction is 32 bits, you don't need any logic to find the instruction boundary on an undefined one. [a]: By "non-trapping", I mean behavior akin to what old processors would do where every opcode would do something because of gaps in the PLAs (such as 0xAF on the 6502 performing 0xAD (LDA abs) and 0xAE (LDX abs) at the same time)
- dzaima 4y agoThe spec contains "The behavior upon decoding a reserved instruction is unspecified." which to me sounds like that the CPU can do whatever it wants.
- colejohnson66 4y agoI stand corrected
- kragen 4y agoThe RISC-V spec does allow non-trapping behavior and SeRV in particular has non-trapping behavior, which is an important part of how it can fit into 200 4-input LUTs. Trap handling is also not part of the base ISA. https://github.com/olofk/serv#good-to-know https://github.com/olofk/serv#good-to-know
- yababa_y 4y agothat sounds like a fun project! a suite of minimal m-mode code that implements your selection of “couldn’t bother to have hardware”. want to work on it with me? :)
- brucehoult 4y agoJust link Spike into SBI :-) I have thought that it would be good to have M-mode emulation available of everything except rv32i/rv64i. The AMO operations are a prime candidate. Very annoying for a simple implementation to have to implement read-modify-write in hardware. You can emulate AMOs easily using LR/SC, and in simple single-core systems those are no-ops anyway. It would be handy to have a special trap vector for illegal instruction, to save a few instructions checking mcause in the normal trap handler. It would also be awesome to have some special CSRs that presented the contents of the rs1, rs2, rs3 encoded in the instruction and another CSR you could write to that put the value into rd. That would save a whole lot of mucking about extracting the register specifier fields from the opcode yourself, and then having to use a switch to read or write each register (or, worse, dump all registers into RAM and then access them as an array). You might think you'd want another CSR that holds the decoded value of the literal/offset in I, S, SB, U, UJ instruction formats -- but you probably don't want to be emulating any of the basic I ISA. Maybe LB/LBU/SB/LH/LHU/SH? Those can be a pain, and are seldom used.
- crest 4y agoThe AMO aren't NOPs in the presence of any other bus master like DMA engines found on all but the cheapest microcontrollers.
- monocasa 4y agoI'm not sure that slightly more complex ucontroller archs with DMA engines require AMOs to be coherent with other masters like DMA engines. You normally do a song and dance where you just guarantee that you don't need atomic RMW in the first place, handing off filled in descriptors to the peripherals and getting interrupts on completion. But interrupts themselves complicate AMOs making them not nops and needing a CLI/RMW/STI sequence.
- Someone 4y agoRequiring a software fallback to be present on every system would IMO kill the platform for small-ish CPUs. For example, why would a CPU with a few kilobytes of RAM need to support vector extensions? Why would it have to support UEFI if it doesn’t have or support disks? For CPUs intended to be used in small embedded systems, supporting either easily could make the necessary amount of ROM ten times as large, and thus significantly increase their cost. Also, having source code to emulate functionality may be nicer, but publishing both source code and a spec will run into problems when the two aren’t compatible with each other. Finally, I’m not sure it’s possible to emulate all extensions using only the minimal subset of RISC-V instructions. Examples are support for atomic instructions, hypervisors, instruction fences, transactional memory, weak memory ordering, or user-level interrupts.