#ifndef H_ED_PRG_20031003125418
#define H_ED_PRG_20031003125418

#ifdef __cplusplus
extern "C"
{
#endif

/* ---------------------------------------------------------------------
   (c) ED 2001
   Project      : CLIB
   Function     : Pseudo Random Generator (1 tap, 32 bit max)
   Module       : PRG
   File         : PRG.H
   Created      : 05-09-2001
   Modified     : 05-09-2001
   --------------------------------------------------------------------- */

/* ---------------------------------------------------------------------
   Log

   0.0 - 05-09-2001 Created
   1.0 - 05-09-2001 Working version

   --------------------------------------------------------------------- */
#include "ed/inc/types.h"

/* macros ============================================================== */
/* constants =========================================================== */
/* types =============================================================== */
/* structures ========================================================== */

   typedef struct
   {
      /* 32-bit register */
      ulong reg;

      int tap;
      int end;
      int nerr;
      int ferr;
   }
   sPRG;

/* entry points ======================================================== */

/* ---------------------------------------------------------------------
   PRG_sver()
   ---------------------------------------------------------------------
   Returns the "Version" string
   ---------------------------------------------------------------------
   E :
   S : ASCIIZ string pointer
   --------------------------------------------------------------------- */
   char const *PRG_sver (void);

/* ---------------------------------------------------------------------
   PRG_sid()
   ---------------------------------------------------------------------
   Returns the "Identification" string
   ---------------------------------------------------------------------
   E :
   S : ASCIIZ string pointer
   --------------------------------------------------------------------- */
   char const *PRG_sid (void);

/* ---------------------------------------------------------------------
   PRG_init()
   ---------------------------------------------------------------------
   Initializes the C-object
   ---------------------------------------------------------------------
   E : tap
   E : end
   S : 0 = OK 1 = err
   --------------------------------------------------------------------- */
   int PRG_init (sPRG * pPrg, int qtap, int qend);

/* ---------------------------------------------------------------------
   PRG_end()
   ---------------------------------------------------------------------
   Suppresses the C-object
   ---------------------------------------------------------------------
   E : Context
   S :
   --------------------------------------------------------------------- */
   void PRG_end (sPRG * pPrg);

/* ---------------------------------------------------------------------
 * PRG_get()
 * ---------------------------------------------------------------------
 *
 *           D0   D1   D2   ..   ..   ..   ..
 *           --   --   --   --   --   --   --
 *       +->|-1|-|-2|-|-3|-|..|+|..|-|..|-|..|-+
 *       |   --   --   --   -- | --   --   --  |
 *       |                    tap             end
 *       |             ---     |               |
 *       |    ---     |   |<---+               |
 *       |   |   |<---|XOR|                    |
 * out <-+---|XOR|    |   |<-------------------+
 *           |   |<-+  ---
 *            ---   |
 *                 cde
 *                  |
 *                 ---
 *                |0/1|
 *                 ---
 *
 * ---------------------------------------------------------------------
 * E : context
 * E : command
 * S : 0/1
 *     -1 = err
 * ---------------------------------------------------------------------
 */
   int PRG_get (sPRG * const pPrg, int cde);

/* ---------------------------------------------------------------------
   PRG_err()
   ---------------------------------------------------------------------
   n consecutive bits in error
   ---------------------------------------------------------------------
   E : Context
   E : Value or the errored bit : 0 1 2(XOR)
   E : Number of bits in error : 0-INT_MAX
   S :
   --------------------------------------------------------------------- */
   void PRG_err (sPRG * const pPrg, int ferr, int nerr);

/* public data ========================================================= */

/* File generated by 'NEW.EXE' Ver 1.30 (c) ED 1998-2001 */

#ifdef __cplusplus
}
#endif

#endif                          /* H_ED_PRG_20031003125418 */

/* Guards added by GUARD (c) ED 2000-2003 Feb 14 2003 Ver. 1.5 */
