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

  1.                     12 BIT COUNTER USING T FLIP FLOPS
  2.  
  3.     This is a 12-bit binary counter implemented using the T flip-flop
  4. capabilities of the EP900.  This design demonstrates the use of the tff
  5. functional form.
  6.  
  7.     The first parameter of the tff function is the indexed equation to
  8. define the logic for the counter.  The second parameter is the signal that
  9. will clock the T flip-flop.  The third parameter is the asynchronous reset
  10. for the flip-flop.
  11.  
  12. |EP900 in:(ACLK, LOAD, RESET, CIN, I12),  io:(I[11..1], Q[12..1], RCO)
  13. |
  14. | Active-High: I[12..1], Q[12..1], ACLK, LOAD, RESET
  15. | Active-Low:  RCO, CIN
  16. |
  17. | i=12..2:  Q[i] = tff((((Q[i-1..1]==0FFFh) & CIN & LOAD')
  18. |                # ((I[i] ## Q[i]) & LOAD)), ACLK, RESET)
  19. |
  20. | i=1:      Q[i] = tff(((CIN & LOAD')
  21. |                # ((I[i] ## Q[i]) & LOAD)), ACLK, RESET)
  22. |
  23. | RCO = Q[12..1] == 0FFFh
  24. |
  25. |Vectors:
  26. |{ Display (ACLK)c, "IN=",(I[12..1])d,    \
  27. |                  " COUNT=",(Q[12..1])d, \
  28. |                  " LOAD:",LOAD,         \
  29. |                  " RESET:",RESET,       \
  30. |                  " CIN:",CIN,           \
  31. |                  " RCO:",RCO
  32. |  Clear CIN, LOAD
  33. |  Test I[12..1]=0FF0h; RESET=1; ACLK | Reset the counter
  34. |  Test RESET=0; ACLK         |Counter should not count with CIN inactive
  35. |  Test CIN=1;   ACLK=10(0,1) |Count to 10
  36. |  Test LOAD=1;  ACLK         |Load a value into the counter
  37. |  Test LOAD=0;  ACLK=20(0,1) |Count and roll over (RCO should go active)
  38. |  Test CIN=0;   ACLK=2(0,1)  |Hold the count
  39. |  Test RESET=1; ACLK         |Reset the counter again
  40. |  End
  41. |}
  42.  
  43.