HEX to DEC converter logic for (4 x 2bits subtractor)

Discussion in 'Homework Help' started by alphoneex, Apr 4, 2012.

  1. alphoneex

    Thread Starter New Member

    Mar 2, 2012
    I am building a calculator by using "Logic Gate Simulator"(http://www.kolls.net/gatesim/)

    I have, so far, successfully build from input section to memory and BCD adder unit(HEX adder + BCD converter)
    and now I am trying to build BCD subtractor and I think I am almost their.

    (I attached a picture of my HEX-BCD logic)
    The main role of HEX-BCD is prevent output from going any higher than 1001(BNR).
    and the HEX-BCD logic should be turned on ONLY when...

    1. A - B < 0
    2. Circuit is borrowing a bit(when the Blue circle is ON)

    I confirmed the logic was working by subtracting A(1 to 9) - B(9).
    Then I tested it with A - B(A>B) condition, then I found an error:eek:
    As you can see in my picture, 5 - 1 should turn 3rd significant bit, however, it is suppressed because of my bad logic...
    When I tried "3 - 9" showed me "4" as correct answer, with borrowing a bit so 3rd bit is working when blue lines are at HI.

    Sorry for bad wiring..that is the one problem of that program D:
    and you can ignore OR gate. They are only there to connect more than one outputs to an input port.
    (The program does not allow to connect "wire-to-wire" or "more than one output-to-one input")
    If anyone can correct my problem or knows better HEX-BCD logic, I am ready to listen!
    Thank you!
    Last edited: Apr 4, 2012