File: blif02g_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 (44 lines) | stat: -rw-r--r-- 1,164 bytes parent folder | download | duplicates (4)
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

module main;

   localparam WID = 4;
   reg [WID:0] X;
   wire        q_and, q_or, q_xor, q_nand, q_nor, q_xnor;

   test_logic DUT(.\A[3] (X[3]), .\A[2] (X[2]), .\A[1] (X[1]), .\A[0] (X[0]),
		  .q_and(q_and), .q_or(q_or), .q_xor(q_xor),
		  .q_nand(q_nand), .q_nor(q_nor), .q_xnor(q_xnor));

   initial begin
      for (X = 0 ; X < 16 ; X = X+1) begin
	 #1 /* Let gates settle. */;
	 if (q_and !== & X[WID-1:0]) begin
	    $display("FAILED -- q_and=%b, X=%b", q_and, X[WID-1:0]);
	    $finish;
	 end
	 if (q_or  !== | X[WID-1:0]) begin
	    $display("FAILED -- q_or=%b, X=%b", q_or, X[WID-1:0]);
	    $finish;
	 end
	 if (q_xor !== ^ X[WID-1:0]) begin
	    $display("FAILED -- q_xor=%b, X=%b", q_xor, X[WID-1:0]);
	    $finish;
	 end
	 if (q_nand !== ~& X[WID-1:0]) begin
	    $display("FAILED -- q_nand=%b, X=%b", q_nand, X[WID-1:0]);
	    $finish;
	 end
	 if (q_nor  !== ~| X[WID-1:0]) begin
	    $display("FAILED -- q_nor=%b, X=%b", q_nor, X[WID-1:0]);
	    $finish;
	 end
	 if (q_xnor !== ~^ X[WID-1:0]) begin
	    $display("FAILED -- q_xnor=%b, X=%b", q_xnor, X[WID-1:0]);
	    $finish;
	 end

      end
      $display("PASSED");
   end

endmodule // main