Using modular arithmetic to explain end around carry

58 Views Asked by At

I understand that end-around carry occurs because the diminished-radix complement coding has two representations of zero, but I'm having trouble understanding how it follows from the rules of modular arithmetic.

I found an explanation on pages 8-9 of Introduction to Arithmetic for Digital Systems by Waser and Flynn:

This simplicity of complement computation comes at some expense in arithmetic operation, since the arithmetic logic itself is always $\mod \beta^p$ where $(p > n)$. Consider the computation $P \mod (\beta^n)$. If $P$ were initially represented as a $\mod \beta^p$ number, or the result of addition or subtraction of two numbers $\mod \beta^n$, then the conversion to a $\mod \beta^n - 1$ number, $P'$ would be

$$\text{If} \ \ \ P < \beta^n - 1 \text{, then} \ \ \ P = P'.$$

That is,

$$P \mod \beta^n \equiv P \mod (\beta^n - 1) = P'.$$

If $P > \beta^n - 1$, then $P'$ must be increased by 1 (called the end around carry) for each multiple of $\beta^n - 1$ contained in $P$. Thus,

$$P' = \left( P + \lfloor{ \frac{P}{\beta^n - 1} \rfloor} \right) \mod \beta^n.$$

That is, $P'$ is $P$ plus the largest integer contained by $\frac{P}{\beta^n - 1}$.

[...]

Questions

  • "...since the arithmetic logic itself is always $\mod \beta^p$ where $(p > n)$". What does this mean exactly?

    I see that the additions in Example 1.5 are performed using $\mod 1000$, but don't understand why $p$ must always be greater than $n$.

  • How do we arrive at the third equation above? Shouldn't it be $P' = \left( P + \lfloor{ \frac{P}{\beta^n - 1} \rfloor} \right) \mod \beta^n - 1$ as shown in Example 1.5(ii)?

  • In Example 1.5, hy do we reduce $\mod 1000$ to $\mod 100$ first?