home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / CUPL30-4.ZIP / DECADE.PLD < prev    next >
Encoding:
CUPL PLD Program format  |  1986-03-02  |  2.6 KB  |  84 lines

  1. Name      decade;
  2. Partno      CA0015;
  3. Date      12/19/84;
  4. Revision  01;
  5. Designer  Kahl;
  6. Company   Assisted Technology;
  7. Assembly  None;
  8. Location  None;
  9. Device    f157;
  10.  
  11. /****************************************************************/
  12. /*                                */
  13. /* Decade Counter                         */
  14. /*                                 */
  15. /* This 4-bit synchronous free-running decade counter uses the    */ 
  16. /* complement-array to force invalid states to reset the    */
  17. /* counter registers.  A square wave output is also provided.    */
  18. /****************************************************************/
  19. /* Allowable Target Device Types :  82S157                   */
  20. /****************************************************************/
  21.  
  22. /**  Inputs  **/
  23.  
  24. pin 1        = clk;         /* Register clock         */
  25. pin 2         = preset;        /* Register preset input      */
  26. pin 3         = reset;        /* Register reset input      */
  27. pin 11       = !en;        /* Register output enable    */
  28.  
  29. /**  Outputs  **/
  30.  
  31. pin [13..16] = ![Q3,Q2,Q1,Q0];     /* Register outputs        */
  32. pin 18       = !wave;        /* Square wave output        */
  33.  
  34. /**  Internal Nodes  **/
  35.  
  36. node           !valid_states;    /* complement array node declaration */
  37.                 /* active (LO) for valid counter states */
  38.  
  39. /** Declarations and Intermediate Variable Definitions **/
  40.  
  41. field count = [Q3,Q2,Q1,Q0];
  42. $define S0 'b'0000
  43. $define S1 'b'0001
  44. $define S2 'b'0010
  45. $define S3 'b'0011
  46. $define S4 'b'0100
  47. $define S5 'b'0101
  48. $define S6 'b'0110
  49. $define S7 'b'0111
  50. $define S8 'b'1000
  51. $define S9 'b'1001
  52.  
  53. /** Logic Equations **/
  54.  
  55. count.ap = preset;            /* preset term forces state 15 */
  56.                     /* lets us observe effect of */
  57.                     /* complement array */
  58.  
  59. append [count,wave].k = valid_states;    /* when any invalid states are seen */
  60.                     /* this term forces all the k inputs */
  61.                     /* of the registers active, thereby */
  62.                     /* generating a reset to state 0 */
  63. wave.ap = preset;
  64.  
  65. valid_states.ca = count:S0 # count:S1    /* include all valid states */
  66.                 # count:S2 # count:S3    /* any state not included here */
  67.                 # count:S4 # count:S5    /* will force counter to state 0 */
  68.                 # count:S6 # count:S7
  69.                 # count:S8 # count:S9;
  70.  
  71. sequence count {            /* free running counter */
  72.  
  73. present S0    next S1        out wave;    /* set output */
  74. present S1    next S2;            /* ouput stays set */
  75. present S2    next S3;            /* since its a JK flip-flop */
  76. present S3    next S4;
  77. present S4    next S5;
  78. present S5    next S6        out !wave;    /* reset output */
  79. present S6    next S7;            /* output stays reset */
  80. present S7    next S8;            /* since its a JK flip-flop */
  81. present S8    next S9;
  82. present S9    next S0;
  83. }
  84.