-
Notifications
You must be signed in to change notification settings - Fork 4
Description
After ALU and memory work need control flow so loops and function calls work. Conditional branches (BEQ/BNE/BLT/BGE/BLTU/BGEU) evaluate condition and if true set PC to PC + offset otherwise PC += 4. Unconditional jumps JAL saves PC+4 to rd then sets PC to PC + offset, JALR saves PC+4 to rd then sets PC to (rs1 + offset) & ~1 (clear LSB per spec).
Need to update execution loop to handle PC changes from branches/jumps, validate targets are aligned to 4-byte boundaries, maybe add max cycle count to catch infinite loops in tests. Test branches taken vs not taken, signed vs unsigned comparisons with negative numbers, forward and backward jumps, function calls with JAL and returns with JALR, simple loops, nested calls. If this works fibonacci and factorial examples should run.