Verilog HDL 的2位BCD码加法器
default: display1=7'b1000000; //默认时,数码管显示数字“0”;
endcase
case(S1) //和值第二位S1显示;
4'd0:display2=7'b1000000;
4'd1:display2=7'b1111001;
4'd2:display2=7'b0100100;
4'd3:display2=7'b0110000;
4'd4:display2=7'b0011001;
4'd5:display2=7'b0010010;
4'd6:display2=7'b0000010;
4'd7:display2=7'b1011000;
4'd8:display2=7'b0000000;
4'd9:display2=7'b0010000;
default:display2=7'b1000000;
endcase
case(S2)
4'd0:display3=7'b1000000;
4'd1:display3=7'b1111001;
4'd2:display3=7'b0100100;
4'd3:display3=7'b0110000;
4'd4:display3=7'b0011001;
4'd5:display3=7'b0010010;
4'd6:display3=7'b0000010;
4'd7:display3=7'b1011000;
4'd8:display3=7'b0000000;
4'd9:display3=7'b0010000;
default:display3=7'b1000000;
endcase
end
endmodule
//默认时,数码管显示数字“0”; //和值第三位S2显示; //默认时,数码管显示数字“0”;