

module lab3p2(SW[17:0], HEX0);

input [17:0] SW;
output [7:0] HEX0;

bin_2_hex inst0(SW[3:0], HEX0);

endmodule


module bin_2_hex(bin, hex);	
	parameter n0 = 8'b11000000;
	parameter n1 = 8'b11111001;
	parameter n2 = 8'b10100100;
	parameter n3 = 8'b10110000;
	parameter n4 = 8'b10011001;
	parameter n5 = 8'b10010010;
	parameter n6 = 8'b10000010;
   //Fill in the missing ones here
	parameter ne = 8'b10000110;
	parameter nf = 8'b10001110;
	
	input  [3:0] bin;
	output [7:0] hex;
	assign hex = 	(bin == 4'h0) ? n0:
						(bin == 4'h1) ? n1:
						(bin == 4'h2) ? n2:
						(bin == 4'h3) ? n3:
						(bin == 4'h4) ? n4:
						(bin == 4'h5) ? n5:
						(bin == 4'h6) ? n6:
						//Fill in the missing ones here.
						(bin == 4'he) ? ne: nf;
endmodule