aboutsummaryrefslogtreecommitdiff
path: root/AUTHORS
blob: 1e30a74a64f51ec735dcc44ff4dfe5fa4fa13c6f (about) (plain)
1
2
3
4
5
6
7
8
9
GNU Guix consists of Scheme code that implements the deployment model
of the Nix package management tool.  In fact, it currently talks to a
build daemon whose code comes from Nix (see the manual for details.)

Nix was initially written by Eelco Dolstra; other people have been
contributing to it.  See `nix/AUTHORS' for details.

The list of GNU Guix contributors is now generated from the output of
'git log' and written to this file, as can be seen in release tarballs.
href='#n15'>15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
`default_nettype none

`include "messages.vh"

`ifndef SIMULATION
 `error_SIMULATION_not_defined
; /* Cause syntax error */
`endif

module div_test();
   reg clock;
   reg start;
   reg [15:0] dividend;
   reg [15:0] divisor;

   wire [15:0] quotient;
   wire [15:0] remainder;
   wire        done;

   div
  #(
    .WIDTH(16)
    ) div
    (
     .clock(clock),
     .start(start),
     .dividend(dividend),
     .divisor(divisor),
     .quotient(quotient),
     .remainder(remainder),
     .done(done)
     );

   integer     seed;
   integer     progress;
   reg [15:0]  new_divisor;
   reg [16:0]  max_divisor;

   initial begin
      seed <= 0;
      progress <= 0;
      clock <= 0;
   end

   // initial
   //   $monitor("[%t] clock is %b", $time, clock);

   always #1
     clock <= ~clock;

   always @ (posedge clock) begin
      if (progress == 0) begin
	 start <= 1;
	 dividend <= 15;
	 divisor <= 3;
	 progress <= progress + 1;
      end else begin
	 if (done) begin
	    if (dividend / divisor === quotient && dividend % divisor === remainder) begin
	       `DBG(("%0d/%0d computed as %0d r %0d", dividend, divisor, quotient, remainder));
	    end else begin
	       `MSG(("error: %0d/%0d computed as %0d r %0d",
		     dividend, divisor, quotient, remainder));
	    end
	    start <= 1;
	    case (progress)
	      1 : begin
		 dividend <= 3;
		 divisor <= 4;
	      end
	      2 : begin
		 dividend <= 65535;
		 divisor <= 65534;
	      end
	      3 : begin
		 dividend <= 1024;
		 divisor <= 4;
	      end
	      4 : begin
		 dividend <= 319;
		 divisor <= 17;
	      end
	      default : begin
		 if (progress == 500)
		   $finish;
		 else if (progress > 400)
		   max_divisor = 2**16;
		 else if (progress > 200)
		   max_divisor = 2**10;
		 else
 		   max_divisor = 2**5;

		 for (new_divisor = $urandom(seed) % max_divisor;
		      new_divisor == 0;
		      new_divisor = $urandom(seed) % max_divisor)
		   ;

		 dividend <= $urandom(seed);
		 divisor <= new_divisor;
	      end
	    endcase // case (progress)
	    progress <= progress + 1;
	 end else begin // if (done)
	    start <= 0;
	 end // else: !if(done)
      end // else: !if(progress == 0)
   end // always @ (posedge clock)
endmodule // div_test