Represent the following conditional control statements by two register transfer statements with control functions. If (P=1) then (R1 <- R2) else if (Q=1) then (R1 <- R3)
Represent the following conditional control statements by two register transfer statements with control functions. If (P=1) then (R1 <- R2) else if (Q=1) then (R1 <- R3)
The statement has two conditions, so it gives two register transfers. The first one occurs when $P = 1$. The second occurs when $P = 0$ and $Q = 1$, because the "else if" is checked only when the first condition fails.
$$P:\ R1 \leftarrow R2$$
$$P'Q:\ R1 \leftarrow R3$$
Here $P'$ means the complement (NOT) of $P$. The part before the colon is the control function. It must be 1 for the transfer to take place at the next clock pulse. If both $P = 0$ and $Q = 0$, no transfer happens and R1 keeps its old value.
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.
Up nextDesign a 4-bit combinational incremental circuit using four full adder circuits.