File: eqne_tb.v

package info (click to toggle)
iverilog 12.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 30,148 kB
  • sloc: cpp: 109,972; ansic: 62,713; yacc: 10,216; sh: 3,470; vhdl: 3,246; perl: 1,814; makefile: 1,774; python: 78; csh: 2
file content (52 lines) | stat: -rw-r--r-- 1,039 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
module main;

   wire eq1, eq2, eq5;
   wire ne1, ne2, ne5;

   reg [7:0] x, y;

   eqne dut(.eq1(eq1), .eq2(eq2), .eq5(eq5),
	    .ne1(ne1), .ne2(ne2), .ne5(ne5),
	    .x(x), .y(y));

   initial begin
      for (x = 0 ;  x < 'h20 ;  x = x+1)
	for (y = 0 ;  y < 'h20 ;  y = y+1) begin
	   #1 $display("x=%h, y=%h: ", x, y,
		       "eq1=%b, eq2=%b, eq5=%b, ", eq1, eq2, eq5,
		       "ne1=%b, ne2=%b, ne5=%b", ne1, ne2, ne5);
	   if (eq1 !== (x[0] == y[0])) begin
	      $display("FAILED");
	      $finish;
	   end

	   if (eq2 !== (x[1:0] == y[1:0])) begin
	      $display("FAILED");
	      $finish;
	   end

	   if (eq5 !== (x[4:0] == y[4:0])) begin
	      $display("FAILED");
	      $finish;
	   end

	   if (ne1 !== (x[0] != y[0])) begin
	      $display("FAILED");
	      $finish;
	   end

	   if (ne2 !== (x[1:0] != y[1:0])) begin
	      $display("FAILED");
	      $finish;
	   end

	   if (ne5 !== (x[4:0] != y[4:0])) begin
	      $display("FAILED");
	      $finish;
	   end
	end

      $display("PASSED");
   end

endmodule // main