186 Appendix – Functional Space of a Queue A.2 Adding an Indirect Condition Now, if we add a mechanism to this queue so that priority is given to draining the queue (removing items) when the number of items in the queue reaches some high-water mark. For our example, the high-water mark is set to the constant value of 6. An indirect condition is established on the following clock cycle when the number of the items in the queue reaches the high-water mark. This indirect condition persists until the queue has been emptied. Even though the priority has been given to drain- ing the queue, we still permit items to be added to the queue. Of course, it could be designed with a much stricter drain policy that prevents the addi- tion of items to the queue until it has been emptied. Our example is not so strict, so even though priority has shifted to draining the queue, items can still be added (until it becomes full, of course). Fig. A.2a illustrates the uncondensed functional space of such a queue. The pair of values in each oval represents the value of the response vari- able ITEMS_IN_QUEUE and the indirect condition variable we shall call DRAIN_PRIORITY. Items can be added to the queue (and removed) in normal operation up until the number of items reaches 6. Then the indirect condition is established (DRAIN_PRIORITY == 1) on the next clock cycle, whether an item is added during that same clock cycle or removed or neither added nor removed. This shifted operation appears on the right- hand side of the figure in which the pair of values shows that drain priority has been established. Items can be removed (preferably) or added to the queue, but when it eventually becomes empty the indirect condition reverts back to normal on the next clock cycle. Three function points with DRAIN_PRIORITY == 0 are condensable and three function points with DRAIN_PRIORITY == 1 are condensable. Condensation removes 4 hold arcs, 4 add arcs, and 4 remove arcs. Fig. A.2b illustrates the con- densed functional space of the queue after this addition of the high-water mark and the indirect condition that establishes drain priority. A.2 Adding an Indirect Condition 187 Fig. A.2a. Reaching the high-water mark at 6 sets the indirect condition for drain priority 1 Appendix – Functional Space of a Queue Fig. A.2b. Condensed functional space of queue with high-water mark We can also add a low-water mark (at 2 for the purposes of our exam- ple) such that when the number of items in the queue reaches this value, the priority reverts back to normal at the next clock cycle. This is illus- trated in Fig. A.3. Note that none of the function points are condensable, because no two adjacent points have congruent arrival and departure arcs. 88 189 Fig. A.3. Queue with low-water mark added at 2 A.2 Adding an Indirect Condition 190 Appendix – Functional Space of a Queue A.3 Programmable High- and Low-water Marks We can make one more refinement to the basic 8-entry queue by making both the high-water mark and the low-water mark programmable. That is, we can define two new variables of condition called HWM and LWM respec- tively. Then logic would be designed that creates two software-visible reg- isters to hold these values. Upon activation of the queue these two values would default to some desired value, such as 7 and 2 respectively. Then at initialization either or both of these values can be re-written with other values to suit our intended operation. We can place constraints on the programming of the values such that the following relations always hold true: LWM ∈ [1 6] HWM ∈ [2 7] LWM < HWM (A.1) These constraints might be enforced by logic that prevents software from writing incompatible values into the software-visible registers that will hold them. Or, the burden could be placed on the software engineer to ensure that only compatible values are written into the registers, leaving the operation of the queue undefined when incompatible values are written into the registers. A.4 Size of the Functional Space for this Queue To better understand the size of this functional space of an 8-entry queue with programmable high- and low-water marks that set and reset an indi- rect condition of drain priority we can construct tables of the number of function points and of the number of function arcs. To understand the resulting functional space completely, value transi- tion graphs can be created for each pair of values for LWM and HWM. There are 42 such graphs in total, 21 for the uncondensed functional space ( 12345621 +++++= ) and 21 for the condensed functional space. These are shown on facing pages in Figs. A.4 through A.24. The reader is encouraged to examine each figure carefully to understand how to recog- nize condensable function points and how to recognize incondensable function spaces. A.5 Condensation in the Functional Space 191 Table A.1. Function points of the queue HWM LWM 234567 1 11 12 13 14 15 16 2 11 12 13 14 15 3 11 12 13 14 4 11 12 13 5 11 12 6 11 Total function points = 266 Table A.2. Function arcs of the queue HWM LWM 234567 1 31 34 37 40 43 46 2 31 34 37 40 43 3 31 34 37 40 4 31 34 37 5 31 34 6 31 Total function arcs = 756 Functional closure over this functional space requires traversal of each of the 756 function arcs, visiting each of the 266 function points during the process. A.5 Condensation in the Functional Space Taking advantage of functional condensation we can construct similar ta- bles for the condensed space as follows. Counts of points and arcs for incondensable sub-spaces are indicated in bold. 192 Appendix – Functional Space of a Queue Table A.3. Function points of the queue with condensation HWM LWM 234567 1 81012 14 13 12 2 9 11 13 14 13 3 10 12 13 14 4 11 11 12 5 9 10 6 8 Total function points = 239 Table A.4. Function arcs of the queue with condensation HWM LWM 234567 1 22 28 34 40 37 34 2 25 31 37 40 37 3 28 34 37 40 4 31 31 34 5 25 28 6 22 Total function arcs = 675 Functional closure over the condensed functional space requires tra- versal of each of the 675 function arcs (and visiting each of the 239 func- tion points along the way). Now consider the functional space that results when the two variables LWM and HWM are variables of internal topology rather than of stimu- lus/response. This would be the case for an IP core that could be instanti- ated in any of 21 ways, corresponding to the possible allowable values for LWM and HWM. For the IP integrator only one of the 21 possible value transition graphs is applicable, corresponding to the chosen values for LWM and HWM. For the IP producer, on the other hand, all 21value transition graphs must be considered if indeed all 21 possible instantiations are to be considered valid within the IP core product. One additional observation we can make is that there is a large vacant region in the functional space for this queue, corresponding to the blank entries in tables A.3 and A.4. A.7 VTGs for 8-entry Queue with Programmable HWM & LWM 193 A.6 No O ther Variables? It is worth mentioning that for the particular way in which this queue is de- fined, there is no specification related to the values of items added to or removed from the queue and there is no behavior defined that is dependent on the values of these items. Consequently, there are no variables of re- sponse defined for them and we do not observe them. Likewise, our specification does not mention any particular width for the queue and our analysis is independent of the width. There is no vari- able of topology defined for the width of the queue, but we could certainly modify the specification and define such a variable. If we did so, we would find that the functional arc connecting the points corresponding to number of items present in the queue are unaffected by this variable of topology. A.7 VTGs for 8-entry Queue with Programmable The following figures contain VTGs for both the uncondensed and the condensed functional space for the queue. Figs. A.4 through A.24 have VTGs for the LWM and HWM relations defined in Eq. A.1 (repeated be- low. LWM ∈ [1 6] HWM ∈ [2 7] LWM < HWM (A.1) These ranges are what might typically be found in a realistic queue de- sign. However, there may be some reason to extend the ranges to the ex- tremes of 0 and 8 entries as in Eq. A.2: LWM ∈ [0 7] HWM ∈ [1 8] LWM < HWM (A.2) To complete the picture, Figs. A.25 through A.32 illustrate the queue with LWM == 0, and Figs. A.32 through A.39 have the VTGs with HWM == 8. VTGs are shown both without condensation and with condensation. HWM & LWM 194 Appendix – Functional Space of a Queue Fig. A.4a. LWM=1 and HWM=2 A.7 VTGs for 8-entry Queue with Programmable HWM & LWM 195 Fig. A.4b. LWM=1 and HWM=2, with condensation . Functional closure over this functional space requires traversal of each of the 756 function arcs, visiting each of the 266 function points during the process. A.5 Condensation in the Functional. incompatible values are written into the registers. A.4 Size of the Functional Space for this Queue To better understand the size of this functional space of an 8-entry queue with programmable high-. resulting functional space completely, value transi- tion graphs can be created for each pair of values for LWM and HWM. There are 42 such graphs in total, 21 for the uncondensed functional