I'm not a RISC-V fan-boi by any stretch of the imagination but I have to admit that they certainly cleaned up RISC which 40+ years later was in order for a thorough house cleaning. X86 is gloriously messy but RISC had become quite a mess as well.
That's kind of a nonsensical statement — "RISC" is not a particular ISA, RISC is a vague methodology/philosophy.
RISC-V is not officially related to any previous ISA, but people like to call it "MIPS in a trenchcoat". RISC-V got off the ground in academia, and MIPS was often used for teaching before. They are quite similar in some ways, but it's really independent.
https://people.eecs.berkeley.edu/~krste/papers/EECS-2016-1.p...
Is Power clean? Myself, I've never liked its special purpose Condition, Link and Count registers. I don't see the need for a Branch Processing Unit being an architectural division. The last time I checked, pushing a register value across that boundary was slow. It wasn't handled by a renamer.
Not suggesting it as a substitute for RV, just wondering why they saw nothing in it to learn from. It's not defunct like PA-RISC, Alpha, and (forgive me) SPARC, and quite some research has gone into it.
https://en.wikipedia.org/wiki/Sunway_(processor)
Is there an architectural feature in Power you think should have been considered by RISC-V for inclusion or omission?
My 2030 prediction is that Intel will have a simpler x86 where they discard a shit ton of legacy.
It is conventional to complain about condition codes, but I don't see what would be debilitating about just appending a set of condition codes to each register, so that renaming a register carries them along. Going from storing 64 bits to 70 bits each would't break the bank.
I believe that an element of your idea is done in modern x86 microarchitectures. I was having an argument on LLVMdev about a peephole optimization and partial register update stalls. Eventually one of the Intel compiler people popped in on the thread and settled the argument, saying:
Regarding the partial EFLAGS write, modern OOO processors independently rename the carry flag, et al, so this is no longer a problem.
The "Reduced" refers to reduced workload per instruction, not number or complexity of instructions for programmer. For example adding explicit load/store instructions.
Many modern RISC ISA's have more instructions than CISC processors.
This trade-off equation changed enormously the moment that L1 I-caches moved on-chip - which was when the RISC revolution flowered
Here is a good example[1]:
For general signed addition, three additional instructions after the addition are required, leveraging the observation that the sum should be less than one of the operands if and only if the other operand is negative.
add t0, t1, t2
slti t3, t2, 0
slt t4, t0, t1
bne t3, t4, overflow
...good luck programming this insane design with anything other than a high level language compiler.And the difficulty isn't really about exposing the internals, this isn't like a branch delay slot for instance. It's about making the relationship between instructions conceptually simple where there's always up to 2 inputs and up to one output. That doesn't help much in cases where the processor is doing something close to what the instructions are saying but it makes the simplest possible out of order processor, where the internals diverge wildly from the ISA, much easier to create.
EDIT: Also, the using C and compiling rather than doing assembly by hand is really a fundamental part of the whole RISC philosophy and RISC-V is just a more extreme form of that.
Contrast this with a leading CISC design, the VAX, which had plenty of addressing modes which practically all opcodes could use. A single opcode could expand into a whole stream of micro-operations to compute the addresses being loaded from, actually perform the named opcode, and then compute the address being stored to, and possibly more. Doing that in the presence of virtual memory, where an opcode might have to be stopped and restarted so the OS could take a page fault, was rather nontrivial.
> We did not include special instruction-set support for overflow checks on integer arithmetic operations in the base instruction set, as many overflow checks can be cheaply implemented using RISC-V branches.
So this boils down to "there's no platform overflow (V) flag", which is also a problem on other RISC systems, and is in any case rarely used in C code because it doesn't check for overflow.
add t0, t1, t2
in the occasional case where you want overflow as well add the other 3 instructions - if you're hand coding in assembler you probably know which you want, if you're using a compiler, it can map it's semantics where appropriate
But that's the only big issue, saying that the whole ISA is insane due to this specific point of design is totally overstated
Every processor architecture (and computer language for that matter) has it's own idiosyncrasies, every assembler programmer builds up a repertoire of sequences for handling them over time. It was plain he was giving you one of those sequences, and it is pretty obvious how to apply it.
Oh, and to answer your question: being simple to understand is _not_ a design criterion for processors. We've been there, done that with the VAX and later the iAPX32. It wasn't a success. We've since settled on what they are supposed to be: efficient in terms of silicon and power consumption. Architectures that win those races will be here in the long term. The VAX and iAPX32 were poor at it, and died. x86 is grimly holding onto it's niche, but I don't expect that to last. It has already lost the consumer market as most consumers use ARM now.
But your example shows no internal states exposure, it's just arithmetic to detect overflow. What are you trying to show ?
That's been the RISC idea from day one. CISC ISAs were nice to the assembly programmer, RISC ISAs were nice to the C programmer and the hardware implementer. Do you know how to do integer multiplication on the MIPS? I'll tell you:
li $a0, 5
li $a1, 6
mult $a0, $a1
... do some other stuff here ...
mfhi $a2
mflo $v0
Why do you want to do other stuff? What's that mfhi and mflo stuff? Why is mult not three-operand? Because RISC! The MIPS model is so RISCy it exposes the fact its multiplication isn't single-cycle. It does this by making it somewhat asynchronous: You issue the multiplication opcode, and your code continues to run while the arithmetic is performed. If you try to get the result immediately, you'll stall the pipeline, so you were encouraged to schedule opcodes that don't rely on the result of the multiplication to run in that hazard.In a CISC chip, that would have been handled by microcode, and you would have gotten nice three-operand multiplication opcodes which could even do memory-to-memory operations, like on the VAX. In a RISC chip, the compiler was assumed to have all the intelligence the microcode used to have, so you got simpler-and-supposedly-faster hardware with really funky assembly language behavior.
https://devblogs.microsoft.com/oldnewthing/20180404-00/?p=98...
TL;DR: Compared to the MIPS, RISC-V is a model of rationality and clarity.
Note that Apollo Core isn't OSHW, so you won't be synthesizing that one.
Compared to the earlier CPU's like Z80's, or god help us DSP's and GPU's, this thing an absolute delight. In fact even compared to x86, it's a model of clarity. Have you ever looked at the Intel architecture manuals for x86? The description of how a "jmp" operates runs for pages and pages of pseudo code. I'll guess you will counter "but most people don't use the more complex features like gates", but the reality is I've used jumps via gates far more times than I've tested for overflow - and I've had to digest those pages and pages of pesudo code and the related data structures many times because they are so damned complex and unintuitive you keep forgetting the details.
I have written lots of MOS6502, MC68000 and UltraSPARC assembler, as I come from the demo and cracking scene. That's where I grew up.
That's either a lie, or the author is severely traumatized from coding on x86 and is suffering from the Stockholm syndrome. Poor author; I feel sorry for the bloke.
Code on UltraSPARC or MC68000 family of processors and then you will know what simple means. The instruction set of RISC-V is insane, absolutely insane.