|
|
|
|
|
by phire
10 days ago
|
|
Huh, it does have CLZ on all ALUs (And CLZ can actually be used to reduce the cost of checking for all zeros). So it must be something about limiting the complexity of the flags register file and/or its bypass network. > But I hadn't considered the ISA design option of only carry flag, no seperate cmp and branch, before. Well, RISC-V does have a decent point: Most of the time you simply don't need flags. The only area this approach falls apart is detecting overflow or add-with-carry. So, why not just cover that flaw by adding a carry/overflow flag. The counter-argument is that as soon has you "ruin the purity of the design" by adding one flag, you might as well add the complete set of all four. Then you can simply branch instruction encodings, and use the extra bits for something else (like seperate set-flags versions of all the ALU instructions) |
|
Actually, why not just have a single generic 1-bit flag?
You could still have cmp + branch, but now you put the comparison type into the cmp. This gives you a larger branch range again. A flag setting add/sub could also simply set that flag on carry. cmov works, some form of ccmp also works.