I was reading about something in the assembler documentations of the AVR microcontroller and I usually come across a line used to describe how would an instruction affect specific flag in the status register.
let's take an example from ADD instruction page
H:
Rd3 • Rr3 + Rr3 • R3 ¯ + R3 ¯ • Rd3
set if there was a carry
from bit 3; cleared otherwise
In this line
Rd3 • Rr3 + Rr3 • R3 ¯ + R3 ¯ • Rd3
How can I read this line, what do those symbols mean?
Best Answer
To start with the formulas suffer from a typographical error on that HTML version of the documents (the pdf doesn't). The formula you quote should read:
$$\mathrm{Rd3}\cdot\mathrm{Rr3} + \mathrm{Rr3}\cdot\overline{\mathrm{R3}} + \overline{\mathrm{R3}} \cdot\mathrm{Rd3}$$
In that formula there are three values. \$\mathrm{Rd}\$ is the current value of the destination register, \$\mathrm{Rr}\$ is the current value of the source register, and \$\mathrm{R}\$ is the result of the instruction (e.g. for
ADD
it would be \$\mathrm{R}=\mathrm{Rd}+\mathrm{Rr}\$).The number next the value represents which bit from the value that is used in the calculation. In this case it would be bit \$3\$ for each of the registers.
The operators are the standard Boolean operators for AND (\$\cdot\$) and OR (\$+\$).
If you add the inferred brackets (AND has precedence over OR in Boolean equations), you get:
$$(\mathrm{Rd3}\cdot\mathrm{Rr3}) + (\mathrm{Rr3}\cdot\overline{\mathrm{R3}}) + (\overline{\mathrm{R3}} \cdot\mathrm{Rd3})$$
Hopefully in that form it is quite easy to follow.