pveentjer / Rust-based-ARM-emulator

A bogus CPU emulator written in Rust.
52 stars 6 forks source link

Add support for condition codes #4

Open pveentjer opened 4 months ago

pveentjer commented 4 months ago

An instruction like ADD can be combined with a condition code like EQ (equals).

E.g.

   CMP r1,r2
   ADDNE r3,r1,r2

So only add r1,r2 if r1!=r2.

When the condition holds, it is easy to process this operation. The problem is when the condition doesn't hold because you still need to update the r3 register so that register renaming doesn't break. This means that the ADDNE has a read dependency on the previous value of r3.

This should be easy to add since the DataProcessing has a rd_read flag that ensures that the destination register is read.