module excess3_bcd(input [3:0]e ,output reg [3:0]bcd );
always @(e)begin
case(e)
4'b0011: bcd=4'b0000; // 3 -> 0
4'b0100: bcd=4'b0001; // 4 -> 1
4'b0101: bcd=4'b0010; // 5 -> 2
4'b0110: bcd=4'b0011; // 6 -> 3
4'b0111: bcd=4'b0100; // 7 -> 4
4'b1000: bcd=4'b0101; // 8 -> 5
4'b1001: bcd=4'b0110; // 9 -> 6
4'b1010: bcd=4'b0111; // 10 -> 7
4'b1011: bcd=4'b1000; // 11 -> 8
4'b1100: bcd=4'b1001; // 12 -> 9
default: bcd=4'b0000; // invalid excess-3
endcase
end
endmodule
module tb_excess3_bcd;
reg [3:0]e;
wire [3:0]bcd;
excess3_bcd dut(e,bcd);
integer i;
initial
begin
for(i=3;i<13;i=i+1)
begin
e=i[3:0];
#10;
end
$finish;
end
endmodule
RTL SCHEMATIC:
POWER:
TIMING
UTILIOZATION REPORT: