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

  1. Name      Tcounter;
  2. Partno      CA0020;
  3. Date      6/9/86;
  4. Revision  01;
  5. Designer  Kahl;
  6. Company   Personal CAD Systems, Inc.;
  7. Assembly  None;
  8. Location  None;
  9. Device    ep600;
  10.  
  11. /****************************************************************/
  12. /*                                */
  13. /* 16 Bit Synchronous Up/Down Counter                */
  14. /*                                */
  15. /* This is a 16-bit up/down counter with built-in shift         */ 
  16. /* register using toggle flip-flops.  The various modes are     */
  17. /* controlled by the signals CNTUP (1 = count up)                  */
  18. /*                           SHIFT (1 = shift)               */
  19. /*                           SHLFT (1 = shift left)             */
  20. /****************************************************************/
  21. /* Allowable Target Device Types :  EP600                          */
  22. /****************************************************************/
  23.  
  24. /**  Inputs  **/
  25.  
  26. Pin 1    = clock1;         /* Counter Clock 1        */
  27. Pin 13  = clock2;           /* Counter Clock 2              */
  28. Pin 2   = data_in;            /* Serial Shift Data Input      */
  29. Pin 11    = cntup;            /* Count Up/Down Mode Control   */
  30. Pin 14  = shift;                /* Shift/Count Mode Control     */
  31. Pin 23  = shlft;                /* Shift Left Mode Control      */
  32.  
  33. /**  Outputs  **/
  34.  
  35. Pin [3..10,15..22] = [q0..15];  /* Counter/Shifter Outputs      */
  36.  
  37. /** Declarations and Intermediate Variable Definitions **/
  38.  
  39. count_up = !shift & cntup & !shlft;
  40. count_down = !shift & !cntup & !shlft;
  41. shift_left = shift & !cntup & shlft;
  42. shift_right = shift & !cntup & !shlft;
  43. reset_count = shift & cntup & shlft;   /* Counter Reset Command */
  44.  
  45. Field counter = [q15..0];    /* Declared Counter Field    */
  46.  
  47. /** Logic Equations **/
  48.  
  49. counter.t = 'h'0001 & (count_up & 'b'1        /* BIT 0 (LSB)  */
  50.                     # count_down & 'b'1
  51.                     # shift_left & (data_in $ q0)
  52.                     # shift_right & (q0 $ q1))
  53.           # 'h'0002 & (count_up & q0        /* BIT 1     */
  54.                     # count_down & !q0
  55.                     # shift_left & (q0 $ q1)
  56.                     # shift_right & (q1 $ q2))
  57.           # 'h'0004 & (count_up & [q0..1]:&    /* BIT 2    */
  58.                     # count_down & ![q0..1]:&
  59.                     # shift_left & (q1 $ q2)
  60.                     # shift_right & (q2 $ q3))
  61.           # 'h'0008 & (count_up & [q0..2]:&    /* BIT 3    */
  62.                     # count_down & ![q0..2]:&
  63.                     # shift_left & (q2 $ q3)
  64.                     # shift_right & (q3 $ q4))
  65.           # 'h'0010 & (count_up & [q0..3]:&    /* BIT 4    */
  66.                     # count_down & ![q0..3]:&
  67.                     # shift_left & (q3 $ q4)
  68.                     # shift_right & (q4 $ q5))
  69.           # 'h'0020 & (count_up & [q0..4]:&    /* BIT 5    */
  70.                     # count_down & ![q0..4]:&
  71.                     # shift_left & (q4 $ q5)
  72.                     # shift_right & (q5 $ q6))
  73.           # 'h'0040 & (count_up & [q0..5]:&    /* BIT 6    */
  74.                     # count_down & ![q0..5]:&
  75.                     # shift_left & (q5 $ q6)
  76.                     # shift_right & (q6 $ q7))
  77.           # 'h'0080 & (count_up & [q0..6]:&    /* BIT 7    */
  78.                     # count_down & ![q0..6]:&
  79.                     # shift_left & (q6 $ q7)
  80.                     # shift_right & (q7 $ q8))
  81.           # 'h'0100 & (count_up & [q0..7]:&    /* BIT 8    */
  82.                     # count_down & ![q0..7]:&
  83.                     # shift_left & (q7 $ q8)
  84.                     # shift_right & (q8 $ q9))
  85.           # 'h'0200 & (count_up & [q0..8]:&    /* BIT 9    */
  86.                     # count_down & ![q0..8]:&
  87.                     # shift_left & (q8 $ q9)
  88.                     # shift_right & (q9 $ q10))
  89.           # 'h'0400 & (count_up & [q0..9]:&    /* BIT 10    */
  90.                     # count_down & ![q0..9]:&
  91.                     # shift_left & (q9 $ q10)
  92.                     # shift_right & (q10 $ q11))
  93.           # 'h'0800 & (count_up & [q0..10]:&    /* BIT 11    */
  94.                     # count_down & ![q0..10]:&
  95.                     # shift_left & (q10 $ q11)
  96.                     # shift_right & (q11 $ q12))
  97.           # 'h'1000 & (count_up & [q0..11]:&    /* BIT 12    */
  98.                     # count_down & ![q0..11]:&
  99.                     # shift_left & (q11 $ q12)
  100.                     # shift_right & (q12 $ q13))
  101.           # 'h'2000 & (count_up & [q0..12]:&    /* BIT 13    */
  102.                     # count_down & ![q0..12]:&
  103.                     # shift_left & (q12 $ q13)
  104.                     # shift_right & (q13 $ q14))
  105.           # 'h'4000 & (count_up & [q0..13]:&    /* BIT 14    */
  106.                     # count_down & ![q0..13]:&
  107.                     # shift_left & (q13 $ q14)
  108.                     # shift_right & (q14 $ q15))
  109.           # 'h'8000 & (count_up & [q0..14]:&    /* BIT 15 (MSB) */
  110.                     # count_down & ![q0..14]:&
  111.                     # shift_left & (q14 $ q15)
  112.                     # shift_right & (q15 $ data_in))  ;
  113.  
  114. counter.ar = reset_count;          /* Resets the Counter */
  115.