Let us start with the CM-based graph of Figure 2, which consists of the cascade of a subgraph H with p − l A-operations and a CM subgraph with l A-operations. This graph is exploited in [14] to obtain optimal multiplications by rational constants with periodic binary representations, and it has the following characteristics:
-
1)
At the output of every A-operation of the CM subgraph, the MNSD of the resulting constant is at most twice the MNSD of the constant at its inputs, according to Observation A. If the MNSD at the output of the subgraph H, denoted by n
H
, is the highest possible in H, the maximum resulting MNSD at the overall graph is 2l × n
H
.
-
2)
If H has the minimum A-depth, the overall graph has the minimum A-depth because the CM subgraph has also the minimum A-depth. The same holds for the A-cost.
-
3)
If H is non-multiplicative, the CM-based graph has l articulation points formed with the minimum A-cost and A-depth and clustered in the higher depth levels. Thus, this graph has the highest MNSD in its first articulation point in comparison to any other graph with l articulation points. Moreover, it can have the maximum MNSD with respect to other graphs with l articulation points.
Due to their aforementioned characteristics, CM-based graphs will be analyzed in the following to show that the graph of a constant whose MNSD is given in specific intervals into the MNSD-range requires certain multiplicative characteristics to preserve the lower bound L
A
. It shall be considered henceforth that the MNSD is given in the MNSD-range (2p − 1, 2p] with p > 1, since L
A
= L
d
= 1 for S(c) = 2 (i.e., when p = 1).
Theorem 1 A constant c whose MNSD is S(c) > 2p − 1 + 1 cannot be obtained with a non-multiplicative graph with p A-operations.
Proof Let us review the simplest case p = 2. There are two possible graphs, one of them additive and the other one multiplicative, as shown in Figure 3 (see also Cost-2 Graphs No. 1 and 2 of Appendix A of [13]). The highest MNSD of any NOF in both graphs is equal to 2. The last A-operation of the non-multiplicative graph only can add one nonzero digit to a constant, thus yielding OFs whose highest MNSD is 2p − 1 + 1 = 3 according to Observation A. The highest MNSD of any OF in the multiplicative graph is equal to 4 because both inputs to the last A-operation can have up to 2 nonzero digits each. Thus, the case p = 2 is a base for the following inductive hypothesis: the highest MNSD of any OF in a non-multiplicative graph with p A-operations is equal to 2p − 1 + 1 for all p > 1. Assuming it as a true statement, let us construct a non-multiplicative graph with p + 1 A-operations, with the aim of obtaining an OF whose MNSD is n = 2p + 2, i.e., the lowest MNSD that contradicts the hypothesis.
A non-multiplicative graph with p operations cannot have the inputs of its last A-operation (the A-operation placed at the p-th depth level) coming from the same position because an articulation point is generated and the graph becomes multiplicative (see Observation C). For the sake of clarity, let us identify the two inputs of the last A-operation as a1 and a2. Let us assume, without loss of generality, that a1 comes from the output of a subgraph G1, as shown in Figure 4. This subgraph can be either non-multiplicative or multiplicative (Figure 4a,b, respectively). In the following, we will review each of these two cases, along with the point where a2 can come from.
If G1 is non-multiplicative (Figure 4a), the highest MNSD of any of its OFs is n1 = 2p − 1 + 1 (this follows from the inductive hypothesis). For the overall graph, the only way to obtain an OF whose MNSD is n = 2p + 2 is having a2 coming from an A-operation that produces constants with an MNSD at least equal to n − n1 = 2p − 1 + 1. From Observation B, we have that this MNSD can be obtained only from the p-th A-operation, which means that a1 and a2 would be coming from the same A-operation, generating an articulation point. If a2 comes from the (p − 1)-th A-operation, the articulation point is avoided and the whole graph can still be non-multiplicative. However, the highest MNSD of a constant generated from the (p − 1)-th A-operation is equal to 2p − 1 (see Observation B) and thus the highest MNSD of the OF in the overall graph is equal to n1 + 2p − 1 = 2p − 1 + 1 + 2p − 1 = 2p + 1.
If G1 is multiplicative (Figure 4b), it can have l articulation points where 1 ≤ l ≤ p − 2. With l articulation points and p operations, the highest MNSD of any OF produced by G1 is n1 = 2l × (2p − l − 1 + 1). This follows from the assumption that G1 is a CM-based graph and from the inductive hypothesis. In order to obtain an OF whose MNSD is n = 2p + 2, a2 must come from an A-operation that produces constants with an MNSD at least equal to n − n1 = 2p − 1 − 2l + 2. Moreover, such A-operation must be placed at a depth level less than the depth level where the first articulation point is placed; otherwise this articulation point will make the whole graph multiplicative. Since G1 has its first articulation point at a depth level equal to p − l, a2 must come from an A-operation placed in a depth level that does not exceed p − l − 1. The highest MNSD of any NOF obtained from an A-operation placed in the (p − l − 1)-th depth level is 2p − l − 1 (from Observation B). Hence, this value should be equal or greater than n − n1 = 2p − 1− 2l + 2 in order to obtain an OF in the overall graph whose MNSD is n = 2p + 2. However, it can be shown that 2p − l − 1 < 2p − 1− 2l + 2 holds. Thus, the highest MNSD of any OF in the overall graph is equal to n1 + 2p − l − 1 = 2l × (2p − l − 1 + 1) + 2p − l − 1 ≤ 2p + 1.
As a result, we have that the inductive hypothesis for a graph with p A-operations implies that it holds for p + 1 A-operations. Therefore, considering this implication along with the base case with p = 2, we prove Theorem 1 by induction on p. ■
Theorem 2
A constant c whose MNSD is S(c) > 2
p − 1
+ 2
q − 1
with q = {1, 2,…, (p − 1)} can be obtained by using a graph with p A-operations only if at least q of these operations are articulation points.
Proof Consider that the overall graph is a CM-based graph with l articulation points, where l < p. The highest MNSD of any OF in the overall graph is n = 2l × (2p − l − 1 + 1) = 2p − 1 + 2l (from Theorem 1). Therefore, l has to be at least equal to q in order to achieve n > 2p − 1 + 2q − 1. Note that Theorem 1 corresponds to the case q = 1. ■
Theorem 3 A constant c whose MNSD is S(c) > 3 × 2p − 2 + 1 cannot be obtained by using a non-multiplicative graph with only p + 1 A-operations and A-depth preserved equal to p.
Proof For the simplest case p = 2, there is only one graph with p + 1 = 3 A-operations and A-depth preserved equal to p = 2. This graph is shown in Figure 5 (see also Cost-3 Graph No. 7 of Appendix A of [13]). The highest MNSD of the OF in this graph is 3 × 2 p − 2 + 1 = 4.
Now, we review the case p ≥ 3. Since the A-depth must be preserved equal to p, only p of these operations can be sequentially connected. Consider that a graph G1 with A-cost and A-depth equal to p − 1 is connected to one of the inputs of the last A-operation, as shown in Figure 6. In order to avoid an articulation point, the other input must come from a different position. Thus, this input is connected to the remaining A-operation, which should be placed in the (p − 1)-th depth level to obtain the highest possible MNSD (from Observation B), and whose inputs are identified as a1 and a2. Consider that a1 comes from the A-operation placed in the (p − 2)-th depth level. Let us review the cases when G1 is either non-multiplicative (Figure 6a) or multiplicative (Figure 6b), along with the point where a2 can come from.
If G1 is non-multiplicative (Figure 6a), the highest MNSD of its OFs is n1 = 2p − 2 + 1 (from Theorem 1) and a1 with a2 can come from the A-operation placed in the (p − 2)-th level. Thus, the highest possible MNSD of the OF in the last A-operation is n = n1 + na 1 + na 2, where na 1 and na 2 are the respective highest MNSD in a1 and a2. The highest MNSD of G1 is n1 = 2p − 2 + 1 and na 1 = na 2 = 2p − 2. Therefore, we have n = (2p − 2 + 1) + 2p − 2 + 2p − 2 = 2p − 2 + 1 + 2p − 1 = 3 × 2p − 2 + 1.
If G1 is multiplicative (Figure 6b), consider that it is a CM-based graph with l articulation points, where 1 ≤ l ≤ p − 2. The highest MNSD of its OFs is n1 = 2l × (2p − l − 2 + 1). Similarly, the highest MNSD in a1 is na 1 = 2l − 1 × (2p − l − 2 + 1). To avoid an articulation point, a2 must come from a depth level that does not exceed p − l − 2, thus na 2 = 2p − l − 2. The highest possible MNSD of the OFs in the last A-operation is n = n1 + na 1 + na 2 = 2p − 2 + 2p − 3 + 2l + 2l − 1 + 2p − l − 2, which can be shown to be less or equal to 3 × 2p − 2 + 1. ■
Theorem 4 A constant c whose MNSD is S(c) > 3 × 2p − 2+ 2q − 1with q = {1, 2,…, (p − 2)} can be obtained by using a non-multiplicative graph whose A-depth is equal to p only if at least p + q + 1 A-operations are used.
Proof Consider p + r A-operations, with r < p. Since the A-depth is equal to p, only p of these operations can be sequentially connected. Let us assume that a graph G1 with A-cost and A-depth equal to p − 1 is connected to one of the inputs of the last A-operation, whereas the other input comes from a different position to avoid an articulation point. Consider that this input comes from a graph G2, formed with r − 1 of the remaining A-operations. To obtain the highest MNSD in G2, we can consider that G2 is a CM graph with its last A-operation placed at the (p − 1)-th depth level. Let us assume that the last of the remaining A-operations is connected to the input of G2, with its inputs being a1 and a2. This is shown in Figure 7. The highest MNSD of any OF from G2 is n2 = 2r − 1 × (na 1 + na 2), where na 1 and na 2 are the respective highest MNSD in a1 and a2.
If G1 is non-multiplicative (Figure 7a), the highest MNSD of its OFs is n1 = 2p − 2 + 1 (from Theorem 1). Both inputs a1 and a2 can come from the same point because G1 is non-multiplicative, and the highest depth level where this point can be placed is p − r − 1; thus, na 1 = na 2 = 2p − r − 1. Hence, the highest MNSD of any OF in the overall graph is n = n1 + n2 = (2p − 2 + 1) + 2r − 1 × (na 1 + na 2) = (2p − 2 + 1) + 2r − 1 × (2p − r) = (2p − 2 + 1) + 2p − 1 = 3 × 2p − 2 + 1, which clearly is less or equal than 3 × 2p − 2 + 2q − 1 even for the smallest q = 1.
If G1 is multiplicative, consider that it is a CM-based graph with l articulation points, where 1 ≤ l ≤ p − 2. The highest MNSD of its OFs is n1 = 2l × (2p − l − 2 + 1). We can have two cases, depending on whether r is greater than l or not. Let us see each one of these cases.
When r ≤ l (Figure 7b), only either a1 or a2 can come from the A-operation placed in the (p − l − 1)-th depth level but not both, because an articulation point would be generated. If a1 comes from this A-operation, a2 can come from the immediate lower depth level. Thus, na 1 = (2p − l − 2 + 1) and na 2 = 2p − l − 2. Hence, the highest MNSD of any OF in the overall graph is n = n1 + n2 = (2p − 2 + 2l) + 2r − 1 × (na 1 + na 2) = (2p − 2 + 2l) + 2r − 1 × [(2p − l − 2 + 1) + 2p − l − 2] = 2p − 2 + 2l + 2r − 1 × (2p − l − 1 + 1), which can be shown to be less or equal to 3 × 2p − 2 + 2r − 1. Thus, r must be at least equal to q + 1 in order to achieve a value n > 3 × 2p − 2 + 2q − 1.
When r > l (Figure 7c), a1 and a2 can come from the same point because the subgraph H in G1 is non-multiplicative, thus na 1 = na 2 = 2p − r − 1. Hence, the highest MNSD of any OF in the overall graph is n = n1 + n2 = (2p − 2 + 2l) + 2r − 1 × (na 1 + na 2) = (2p − 2 + 2l) + 2r − 1 × (2p − r) = 2p − 2 + 2l + 2p − 1 = 3 × 2p − 2+ 2l. Since l is at most equal to r − 1, we have that the highest value for n is n = 3 × 2p − 2 + 2r − 1. Thus, n > 3 × 2p − 2 + 2q − 1 holds only if r is at least equal to q + 1. ■
Now, let us introduce the number of prime factors of the constant c, denoted as Ω(c). Note that, along with S(c), Ω(c) is a function that can be known a priori from the constants. Generally speaking, obtaining the prime factors of c is a challenging problem for very large constants (over 110 digits) and it is one of the bases for the Rivest-Shamir-Adleman (RSA) encryption scheme [19]. However, for constants up to 32 bits, which cover the DSP problem sizes of the most practical importance [14], the prime factors of c can be obtained straightforwardly even with the simple sieve approach, such as the one used in the MATLAB function ‘factor’.
The following theorems present the relations between the values Ω(c) and S(c). If the required multiplicative characteristics for the corresponding graph of the constant c, highlighted in the previous theorems, cannot be accomplished due to the value Ω(c), the lower bounds for the A-cost and the A-depth are affected.
Theorem 5
A constant c whose MNSD is S(c) > 2
p − 1
+ 2
Ω(c) − 1
only can be obtained by using a graph with at least p + 1 A-operations.
Proof From Theorem 2, it is known that at least Ω(c) articulation points are required if only p A-operations can be used. However, since Ω(c) is the number of prime factors, only up to Ω(c) − 1 articulation points are allowed. Thus, the only solution is using an additional A-operation. By adding one more A-operation, the overall non-multiplicative graph can give an OF whose MNSD is up to 2p + 1, which covers the MNSD-range regardless of the value Ω(c). Therefore, at least p + 1 A-operations are required. ■
Theorem 6 A constant c whose MNSD is S(c) > 3 × 2p − 2+ 2Ω(c) + q − 2with q = {1, 2,…, (p − Ω(c) − 1)} only can be obtained by using a graph with A-depth at least equal to p + 1 if up to p + q A-operations are used, or with at least p + q + 1 A-operations if the minimum A-depth equal to p is preserved.
Proof Let us consider a CM-based graph with p + r A-operations and A-depth equal to p + s, where r < p and s ≥ 0. Since at most Ω(c) − 1 articulation points can be used, its CM subgraph has Ω(c) − 1 A-operations, whereas its non-multiplicative subgraph H has p + r − Ω(c) + 1 A-operations and an A-depth equal to p + s − Ω(c) + 1. According to Theorem 4, the highest MNSD of any OF generated in the subgraph H is 3 × 2p + s − Ω(c) − 1 + 2r − s − 1 and the highest MNSD at the output of the overall graph is n = 2Ω(c) − 1 × (3 × 2p + s–Ω(c) − 1 + 2r − s − 1) = 3 × 2p + s − 2 + 2Ω(c)+r − s − 2. If the A-depth is preserved equal to p, we have s = 0. In such case r needs to be at least equal to q + 1 in order to achieve n > 3 × 2p − 2 + 2Ω(c) + q − 2. On the other hand, if r ≤ q holds, the value s should be at least equal to 1 in order to achieve n > 3 × 2p − 2 + 2Ω(c) + q − 2, implying that the A-depth of the overall graph is at least equal to p + 1. ■
From Theorem 5 and substituting p using (3), the lower bound L
A
can be expressed as
(4)
Note that if L
A
= ⌈ log2S(c)⌉ holds, L
d
will have the same value as L
A
without requiring any additional A-operation (as given by (2)). From (4), we can see that this only can be accomplished if Ω(c) ≥ log2{S(c) − 2} + 1 holds. The argument S(c) − 2 in the log2{x} operation is always greater than zero and therefore the condition can always be evaluated.
From Theorem 6, we have that if the A-cost is given as N
A
≥ ⌈ log2S(c)⌉ + q + 1 and if log2{S(c) − 3 × 2 } + 2 − Ω(c) > q holds, the A-depth can be kept equal to ⌈ log2S(c)⌉. By noticing that any real number a is greater than an integer b if this integer is given as b = ⌈a⌉ − 1 and applying this observation to q, we obtain q = + 1. In this equality, the log2{x} operation does not yield finite values when S(c) ≤ 3 × 2 holds. However, according to Theorem 3, the A-depth can be kept equal to ⌈ log2S(c)⌉ by using only one additional A-operation if the condition S(c) ≤ 3 × 2 + 1 holds. Therefore,
(5)
where L
EA
, the lower bound for the number of extra A-operations required to generate NEFs and preserve L
d
= ⌈ log2S(c)⌉, is given as
(6)
It is worth highlighting that, whereas the lower bound L
A
only depends on the relation between Ω(c) and S(c), the lower bound L
d
depends on the A-cost N
A
. As pointed out in [12], for many problem instances, there is a tradeoff between the A-cost and the A-depth. From (5), we have that such tradeoff is the minimum theoretical value L
EA
, given in (6).