Lab 3: Seven-Segment Display and Multiplexing
Displaying numbers on the seven-segment display.

Displaying numbers on the seven-segment display

Verilog HDL Code

module hexTo7Seg(
	input [3:0] hex_input,
	output reg [6:0] seven_seg_out
);
	always @*
		case (hex_input)
			4'b0000 : // Hexadecimal 0
				seven_seg_out = 7'b1000000;
			4'b0001 : // Hexadecimal 1
				seven_seg_out = 7'b1111001;
			4'b0010 : // Hexadecimal 2
				seven_seg_out = 7'b0100100;
			4'b0011 : // Hexadecimal 3
				seven_seg_out = 7'b0110000;
			4'b0100 : // Hexadecimal 4
				seven_seg_out = 7'b0011001;
			4'b0101 : // Hexadecimal 5
				seven_seg_out = 7'b0010010;
			4'b0110 : // Hexadecimal 6
				seven_seg_out = 7'b0000010;
			4'b0111 : // Hexadecimal 7
				seven_seg_out = 7'b1111000;
			4'b1000 : // Hexadecimal 8
				seven_seg_out = 7'b0000000;
			4'b1001 : // Hexadecimal 9
				seven_seg_out = 7'b0011000;
			4'b1010 : // Hexadecimal A
				seven_seg_out = 7'b0001000;
			4'b1011 : // Hexadecimal B
				seven_seg_out = 7'b0000011;
			4'b1100 : // Hexadecimal C
				seven_seg_out = 7'b1000110;
			4'b1101 : // Hexadecimal D
				seven_seg_out = 7'b0100001;
			4'b1110 : // Hexadecimal E
				seven_seg_out = 7'b0000110;
			4'b1111 : // Hexadecimal F
				seven_seg_out = 7'b0001110;
			default : // Other values
				seven_seg_out = 7'b0000000; // Display nothing
		endcase
endmodule

Pin Planner

Node NameDirectionLocationI/O BankVREF GroupCurrent StrengthSlew Rate
hex_input[0]InputPIN_C107B7_N03.3-V LVTTL8mA (default)
hex_input[1]InputPIN_C117B7_N03.3-V LVTTL8mA (default)
hex_input[2]InputPIN_D127B7_N03.3-V LVTTL8mA (default)
hex_input[3]InputPIN_C127B7_N03.3-V LVTTL8mA (default)
seven_seg_out[0]OutputPIN_C147B7_N03.3-V LVTTL8mA (default)
seven_seg_out[1]OutputPIN_E157B7_N03.3-V LVTTL8mA (default)
seven_seg_out[2]OutputPIN_C157B7_N03.3-V LVTTL8mA (default)
seven_seg_out[3]OutputPIN_C167B7_N03.3-V LVTTL8mA (default)
seven_seg_out[4]OutputPIN_E167B7_N03.3-V LVTTL8mA (default)
seven_seg_out[5]OutputPIN_D177B7_N03.3-V LVTTL8mA (default)
seven_seg_out[6]OutputPIN_C177B7_N03.3-V LVTTL8mA (default)