aboutsummaryrefslogtreecommitdiff
path: root/bcd_adder.v
blob: 16790bd0d9f591f171932374b0dffb1141a1f385 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
module bcd_adder(
  input  wire [3:0] a,
  input  wire [3:0] b,
  output reg  [7:0] x
);
  always @(*) begin
    assign x = a + b;

    if (x > 9) begin
      x = x + 6;
    end
  end
endmodule