home *** CD-ROM | disk | FTP | other *** search
- FOUR-BIT UP/DOWN COUNTER AS A MAP
-
- This is a four-bit up/down counter defined as a map, with the carry bits
- defined as a truth table. This input method can be contrasted with a
- related counter shown in the reference guide as an indexed equation.
-
- The two input signals D and U control the counter in the following way.
-
- D U Action
-
- 0 0 Reset
- 0 1 Count up
- 1 0 Count down
- 1 1 Hold
-
- The output signals DC and UC allow cascading of several parts. They
- become the D and U inputs of the next state.
-
- |GAL16V8 in:(D, U), io:(DC, UC, Q[3..0]), clock:CLK
- |
- | Signature: "CLL 9/11"
- | Registers: CLK // Q[3..0]
- |
- | High: CLK, D, U, DC, UC
- |
- | Map: Q[3..0] -> Q[3..0]
- | { n -> n+1, U & D' |Count up
- | n -> n-1, D & U' |Count down
- | n -> n, D & U |Hold
- | n -> 0, D'& U' } |Reset
- |
- | Table: D, U, Q[3..0] -> DC, UC
- | { 00xxxxb -> 00b |Reset higher bits
- | 011111b -> 01b |Carry to higher bits
- | 01xxxxb -> 11b |Do not carry to higher bits
- | 100000b -> 10b |Borrow from higher bits
- | 10xxxxb -> 11b |Do not borrow from higher bits
- | 11xxxxb -> 11b } |Hold
-
- |Vectors:
- |
- |{ Display (D,U), CLK, Q[3..0], "=", (Q[3..0])d, (DC,UC)
- |
- | Test D,U=00b; CLK=02(0,1) |Reset the counter to 0
- | Test D,U=01b; CLK=17(0,1) |Count up 0, 1, 2, ..., 15, 0, 1
- | Test D,U=00b; CLK=02(0,1) |Reset the counter
- | Test D,U=10b; CLK=18(0,1) |Count down 0, 15, 14, ..., 2, 1, 0, 15, 14
- | Test D,U=00b; CLK=02(0,1) |Reset the counter again
- | Test D,U=11b; CLK=02(0,1) |Test that the counter holds 0
- | Test D,U=10b; CLK=01(0,1) |Step backward to 15
- | Test D,U=11b; CLK=02(0,1) |Test that the counter holds 15
- | Test D,U=00b; CLK=01(0,1) |Reset all bits
- | Test D,U=10b; CLK=07(0,1) |Count to a random value
- | Test D,U=11b; CLK=02(0,1) |Test that the value holds
- | Test D,U=00b; CLK=01(0,1) |End of test
- | End }
-
-