module: int_order1_mash
parameters: int b, int beta
inputs: int in, double clk
outputs:  int out, int error
static_variables: 
int mask_b
int mask_error
int mask_out
classes: EdgeDetect clkedge()
init: 
if (b > 32 || b < 1)
  {
   printf("error in 'int_order1_mash':  must have 1 <= b <= 32\n");
   printf("   in this case, b = %d\n",b);
   exit(1);
 }
if (beta > b || beta < 0)
  {
   printf("error in 'int_order1_mash':  must have 0 <= beta <= b\n");
   printf("   in this case, beta = %d, b = %d\n",beta,b);
   exit(1);
 }
if (b == 32) 
   mask_b = ~0;
else
   mask_b = (1 << b) - 1;
mask_error = (1 << beta) - 1;
mask_out = mask_b ^ mask_error;
error = 0;
out = 0;
code:
if (clkedge.inp(clk))
   {
   if ((in & (~mask_b)) == 0)
      {
       out = in + error;
       error = out & mask_error;
       out = (out & mask_out) >> beta;
      }
   else
      {
       printf("error in 'int_order1_mash':  input values must\n");
       printf("      be constrained to 'b = %d bits'\n",b);
       printf("in = %s\n",bit_print(in));
       exit(1);
      }
   }
