home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / p / p078 / 7.img / TUTOR.PLB / UDMAP.PLD < prev    next >
Encoding:
Text File  |  1990-12-11  |  2.3 KB  |  58 lines

  1.                     FOUR-BIT UP/DOWN COUNTER AS A MAP
  2.  
  3. This is a four-bit up/down counter defined as a map, with the carry bits
  4. defined as a truth table.  This input method can be contrasted with a
  5. related counter shown in the reference guide as an indexed equation.
  6.  
  7. The two input signals D and U control the counter in the following way.
  8.  
  9.     D  U     Action
  10.  
  11.     0  0     Reset
  12.     0  1     Count up
  13.     1  0     Count down
  14.     1  1     Hold
  15.  
  16. The output signals DC and UC allow cascading of several parts.  They
  17. become the D and U inputs of the next state.
  18.  
  19. |GAL16V8 in:(D, U), io:(DC, UC, Q[3..0]), clock:CLK
  20. |
  21. | Signature:  "CLL 9/11"
  22. | Registers:   CLK // Q[3..0]
  23. |
  24. | High:  CLK, D, U, DC, UC
  25. |
  26. | Map: Q[3..0] -> Q[3..0]
  27. | { n -> n+1, U & D'              |Count up
  28. |   n -> n-1, D & U'              |Count down
  29. |   n -> n,   D & U               |Hold
  30. |   n -> 0,   D'& U' }            |Reset
  31. |
  32. | Table: D, U, Q[3..0] -> DC, UC
  33. | { 00xxxxb -> 00b                |Reset higher bits
  34. |   011111b -> 01b                |Carry to higher bits
  35. |   01xxxxb -> 11b                |Do not carry to higher bits
  36. |   100000b -> 10b                |Borrow from higher bits
  37. |   10xxxxb -> 11b                |Do not borrow from higher bits
  38. |   11xxxxb -> 11b }              |Hold
  39.  
  40. |Vectors:
  41. |
  42. |{ Display (D,U), CLK, Q[3..0], "=", (Q[3..0])d, (DC,UC)
  43. |
  44. |  Test D,U=00b; CLK=02(0,1)   |Reset the counter to 0
  45. |  Test D,U=01b; CLK=17(0,1)   |Count up 0, 1, 2, ..., 15, 0, 1
  46. |  Test D,U=00b; CLK=02(0,1)   |Reset the counter
  47. |  Test D,U=10b; CLK=18(0,1)   |Count down 0, 15, 14, ..., 2, 1, 0, 15, 14
  48. |  Test D,U=00b; CLK=02(0,1)   |Reset the counter again
  49. |  Test D,U=11b; CLK=02(0,1)   |Test that the counter holds 0
  50. |  Test D,U=10b; CLK=01(0,1)   |Step backward to 15
  51. |  Test D,U=11b; CLK=02(0,1)   |Test that the counter holds 15
  52. |  Test D,U=00b; CLK=01(0,1)   |Reset all bits
  53. |  Test D,U=10b; CLK=07(0,1)   |Count to a random value
  54. |  Test D,U=11b; CLK=02(0,1)   |Test that the value holds
  55. |  Test D,U=00b; CLK=01(0,1)   |End of test
  56. |  End  }
  57.  
  58.