home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / p / p078 / 7.img / TUTOR.PLB / UNTIL.PLD < prev   
Encoding:
Text File  |  1990-12-11  |  768 b   |  27 lines

  1.                             GRAY CODE COUNTER
  2.  
  3. Here is a Gray code counter tested with the aid of an UNTIL clause.  An
  4. explanation of the UNTIL clause appears in Chapter 11 of the reference
  5. guide.
  6.  
  7. |PAL16R8 in:RESET, out:Q[3..0], clock:CLOCK
  8. |
  9. | Map:  Q[3..0] -> Q[3..0]
  10. | { Gray(n) -> Gray((n+1)\16), RESET'
  11. |   Gray(n) -> 0,              RESET
  12. |   }
  13. |
  14. | Registers:  CLOCK // Q[3..0]
  15.  
  16. |Vectors:
  17. |{ Display RESET, CLOCK, Q[3..0], (Q[3..0])s
  18. |
  19. |  Test RESET = 1; CLOCK = 0,1             |Clear the counter
  20. |  Test RESET = 0; CLOCK = 16(0,1)         |Test the full Gray sequence
  21. |
  22. |  Test CLOCK = 16(0,1) UNTIL Q[3..0]==15  |Advance until all bits are set
  23. |  Test RESET = 1; CLOCK = 0,1             |Make sure all bits reset
  24. |  End
  25. |  }
  26.  
  27.