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

  1.                                SKIP COUNTER
  2.  
  3. Here is a counter which might be called an elevator counter.  It counts up
  4. and down taking care never to visit the number 13.  This specialized
  5. counter is defined as a numerical map, allowing the detailed Boolean logic
  6. to be synthesized automatically by the PLD compiler.  See Chapter 5 of the
  7. reference guide for a discussion of numerical maps.
  8.  
  9. |PAL16V8 in:(RESET, UP), io:Q[3..0], clock:CLK
  10. |
  11. |  Map:  Q[3..0] -> Q[3..0]
  12. |  { n -> n+1,  RESET' & UP  & n/=12
  13. |    n -> n+2,  RESET' & UP  & n==12
  14. |    n -> n-1,  RESET' & UP' & n/=14
  15. |    n -> n-2,  RESET' & UP' & n==14
  16. |    n -> 1,    RESET }
  17. |
  18. |  Registers:   CLK // Q[3..0]
  19.  
  20. | Vectors:
  21. | { Display (CLK)c, "   Direction ", UP, "   Floor ", (Q[3..0])d
  22. |
  23. |   Test  RESET=1; CLK
  24. |   Clear RESET
  25. |   Test  UP=1; CLK=13(0,1)
  26. |   Test  UP=0; CLK=14(0,1)
  27. |   End  }
  28.  
  29.