home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s078 / 1.img / COUNT10.PLD < prev    next >
Encoding:
CUPL PLD Program format  |  1991-12-08  |  2.4 KB  |  90 lines

  1. Name      Count10;
  2. Partno      CA0018;
  3. Date      12/19/84;
  4. Revision  01;
  5. Designer  Kahl;
  6. Company   Assisted Technology;
  7. Assembly  None;
  8. Location  None;
  9. Device    p16rp4;
  10.  
  11. /****************************************************************/
  12. /*                                */
  13. /* Decade Counter                         */
  14. /*                                 */
  15. /* This is a 4-bit up/down decade counter with synchronous     */ 
  16. /* clear capability.  An asynchronous ripple carry output is    */
  17. /* provided for    cascading multiple devices.  CUPL state machine    */
  18. /* syntax is used.                        */
  19. /****************************************************************/
  20. /* Allowable Target Device Types :  PAL16RP4, GAL16V8, EP300       */
  21. /****************************************************************/
  22.  
  23. /**  Inputs  **/
  24.  
  25. pin 1        = clk;         /* Counter clock         */
  26. pin 2         = clr;        /* Counter clear input      */
  27. pin 3         = dir;        /* Counter direction input      */
  28. pin 11       = !oe;        /* Register output enable    */
  29.  
  30. /**  Outputs  **/
  31.  
  32. pin [14..17] = [Q3..0];     /* Counter outputs        */
  33. pin 18 = carry;            /* Ripple carry out        */
  34.  
  35. /** Declarations and Intermediate Variable Definitions **/
  36.  
  37. field count = [Q3..0];        /* declare counter bit field */
  38. $define S0 'b'0000        /* define counter states */
  39. $define S1 'b'0001
  40. $define S2 'b'0010
  41. $define S3 'b'0011
  42. $define S4 'b'0100
  43. $define S5 'b'0101
  44. $define S6 'b'0110
  45. $define S7 'b'0111
  46. $define S8 'b'1000
  47. $define S9 'b'1001
  48.  
  49. field mode = [clr,dir];        /* declare mode control field */
  50. up = mode:0;            /* define count up mode */
  51. down = mode:1;            /* define count down mode */
  52. clear = mode:[2..3];        /* define count clear mode */
  53.  
  54. /** Logic Equations **/
  55.  
  56. sequence count {            /* free running counter */
  57.  
  58. present S0    if up        next S1;
  59.         if down        next S9;
  60.         if clear    next S0;
  61. present S1    if up        next S2;
  62.         if down        next S0;
  63.         if clear    next S0;
  64. present S2    if up        next S3;
  65.         if down        next S1;
  66.         if clear    next S0;
  67. present S3    if up        next S4;
  68.         if down        next S2;
  69.         if clear    next S0;
  70. present S4    if up        next S5;
  71.         if down        next S3;
  72.         if clear    next S0;
  73. present S5    if up        next S6;
  74.         if down        next S4;
  75.         if clear    next S0;
  76. present S6    if up        next S7;
  77.         if down        next S5;
  78.         if clear    next S0;
  79. present S7    if up        next S8;
  80.         if down        next S6;
  81.         if clear    next S0;
  82. present S8    if up        next S9;
  83.         if down        next S7;
  84.         if clear    next S0;
  85. present S9    if up        next S0;
  86.         if down        next S8;
  87.         if clear    next S0;
  88.         out        carry;        /* assert carry output */
  89. }
  90.