module thermo7_binary3( input [6:0] thermo_code ,output reg [2 :0] binary_code ); wire [2:0]sum; assign sum=thermo_code[0]+thermo_code[1]+thermo_code[2]+thermo_code[3]+thermo_code[4]+thermo_code[5]+thermo_code[6]; always @(*) begin case(sum) 3'd0 : binary_code<=3'b000; 3'd1 : binary_code<=3'b001; 3'd2 : binary_code<=3'b010; 3'd3 : binary_code<=3'b011; 3'd4 : binary_code<=3'b100; 3'd5 : binary_code<=3'b101; 3'd6 : binary_code<=3'b110; 3'd7 : binary_code<=3'b111; endcase end endmodule