Updated the ALU operations to allow me to select whether I want the addition/subtraction ops to take carry-in into account.
I'm also going rewrite my ALU verilog so it's actually ROM based as that's what the physical impl will be. I expect that that approach will make automated testing of the logic easier too.
More details here: https://github.com/Johnlon/spam-1/blob/master/docs/alu_with_carry_in.md
Updated ops are:
0-7 ALU Ops | 8-15 ALU Ops | 16-23 ALU Ops | 24-31 ALU Ops |
---|---|---|---|
0 | B-1 | A*B (high bits) | A ROR B |
A | A+B*1 | A*B (low bits) | A AND B |
B | A-B*1 | A/B | A OR B |
-A | B-A*1 | A%B | A XOR B |
-B | A-B (special) | A << B | NOT A |
A+1 | A+B+1*2 | A >> B arithmetic | NOT B |
B+1 | A-B+1*2 | A >> B logical | A+B (BCD) |
A-1 | B-A+1*2 | A ROL B | A-B (BCD) |
*1 these ops will be used if the instruction directly selects ops 9/10/11, or, when the instruction selects 13/14/15 but carry-in is not set
*2 these ops are selected when the instruction is selecting ops 13/14/15 and carry-in is set; if carry-in is not set then see *1
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.