`define ACE 7'b0001000 `define TWO 7'b0100100 `define THREE 7'b0110000 `define FOUR 7'b0011001 `define FIVE 7'b0010010 `define SIX 7'b0000010 `define SEVEN 7'b1111000 `define EIGHT 7'b0000000 `define NINE 7'b0010000 `define TEN 7'b1000000 `define JACK 7'b1100001 `define QUEEN 7'b0011000 `define KING 7'b0001001 `define BLANK 7'b1111111 module tb_card7seg(); logic err; logic [3:0] SW; logic [6:0] HEX0; card7seg DUT(SW, HEX0); task check; input logic [6:0] expected; if (HEX0 !== expected) begin err = 1; $display("FAILED: HEX is incorrect.",); end endtask: check initial begin err = 0; SW = 4'd0; #5; check(`BLANK); #5; SW = 4'd1; #5; check(`ACE); #5; SW = 4'd2; #5; check(`TWO); #5; SW = 4'd3; #5; check(`THREE); #5; SW = 4'd4; #5; check(`FOUR); #5; SW = 4'd5; #5; check(`FIVE); #5; SW = 4'd6; #5; check(`SIX); #5; SW = 4'd7; #5; check(`SEVEN); #5; SW = 4'd8; #5; check(`EIGHT); #5; SW = 4'd9; #5; check(`NINE); #5; SW = 4'd10; #5; check(`TEN); #5; SW = 4'd11; #5; check(`JACK); #5; SW = 4'd12; #5; check(`QUEEN); #5; SW = 4'd13; #5; check(`KING); #5; if (~err) $display("All tests passed."); #10; $stop; end endmodule