38. Safe Signed Non-Restoring Divider Finalizer

Loading simulator…

The predefined circuit already contains the correction adders, the quotient and remainder conditional-negation paths, the exception MUXes, and all fixed datapath wiring. Complete the 11 open control connections in four wiring groups, then verify the final safe-output behavior.

  1. Complete the final remainder correction.

    Connect the R_NEG fanout to D_MASK_0, D_MASK_1, D_MASK_2, and D_MASK_3. Each mask gate forms:

    D_CORR[i] = D_MAG[i] AND R_NEG
    

    The predefined CORR_FA chain then computes:

    R_CORR = R_RAW + D_CORR
    

    Therefore:

    R_NEG = 0 -> D_CORR = 0000 -> R_CORR = R_RAW
    R_NEG = 1 -> D_CORR = D_MAG -> R_CORR = R_RAW + D_MAG
    

    This performs the single final correction required when the non-restoring divider finishes with a negative partial remainder.

  2. Complete the quotient sign restoration.

    Connect DividendSign and DivisorSign to the two inputs of Q_SIGN. The XOR gate generates:

    Q_SIGN = DividendSign XOR DivisorSign
    

    The existing Q_NEG_XOR and Q_NEG_FA chain uses Q_SIGN as the conditional-negation control:

    QuotientSigned = (Q_MAG XOR {4{Q_SIGN}}) + Q_SIGN
    

    Thus Q_SIGN = 0 passes Q_MAG unchanged, while Q_SIGN = 1 produces its two's complement.

  3. Complete the remainder sign restoration.

    Connect the DividendSign fanout into the remainder sign-control network. The existing Nodes distribute this signal to all four R_NEG_XOR gates and to the carry-in of R_NEG_FA0. The fixed remainder-negation chain therefore performs:

    RemainderSigned = (R_CORR XOR {4{DividendSign}}) + DividendSign
    

    A positive dividend leaves R_CORR unchanged; a negative dividend converts it to two's complement, so the final remainder follows the dividend sign.

  4. Complete the exception control.

    Connect DivZero and Overflow to the two inputs of the EXCEPTION OR gate:

    Exception = DivZero OR Overflow
    

    Then connect the EXCEPTION output to the existing exception fanout network. That network already reaches every Q_SAFE and R_SAFE MUX select input.

  5. Verify the final safe-output behavior.

    The normal signed quotient and remainder are already connected to input 0 of the protection MUXes, while input 1 is tied to 0. Therefore:

    Exception = 0 -> Quotient = QuotientSigned, Remainder = RemainderSigned
    Exception = 1 -> Quotient = 0000,          Remainder = 0000
    

    For example, if R_RAW = 1110, D_MAG = 0011, and R_NEG = 1, the correction stage produces R_CORR = 0001. If DividendSign = 1, the remainder sign-restoration stage converts this to 1111 (-1).