• 2021-04-14
    下面是将输入的4位二进制数转换成为两个8421 BCD码的程序,该程序正确吗?module _4bitBIN2bcd(Bin, BCD1,BCD0); input [3:0] Bin; output reg[3:0] BCD1, BCD0; always @(Bin) begin {BCD1, BCD0} = 8h00; if(Bin < 10) begin BCD1 = 4h0; BCD0 = Bin; end else begin BCD1 = 4h1; BCD0 = Bin-4d10; end endendmodule