// // Title : Problem 2b test fixture // Design : Homework 3 // Author : Carl Ebeling // Company : CSE 370 // //------------------------------------------------------------------------------------------------- // // File : problem2b_tf.v // // Description : This test fixture tests the 8-bit comparator // //------------------------------------------------------------------------------------------------- `timescale 1ns / 1ns module hw1_3b_tf (A, B, EQ, GT); output [7:0] A, B; input EQ, GT; reg [7:0] A, B; integer errors; integer count; initial begin errors = 0; for (count = 0; count < 100; count = count + 1) begin A = $random; if ($random & 1) B = $random; // Make sure we test equality else B = A; #10 // $display("A:%d, B:%d, EQ:%d, GT:%d", A, B, EQ, GT); if ((EQ != (A == B)) || (GT != (A > B))) begin $display("A:%d, B:%d, EQ:%d, GT:%d", A, B, EQ, GT); errors = errors + 1; end end if (errors == 0) $display("Test passed - No errors!!"); else $display("**** %d Errors****", errors); end endmodule