Non-restoring division algorithm

前端 未结 2 896
执念已碎
执念已碎 2021-02-06 06:45

Does anyone know the steps for dividing unsigned binary integers using non-restoring division?

It\'s hard to find any good sources online.

i.e if A = 10111

相关标签:
2条回答
  • 2021-02-06 07:03

    (My answer is a little late-reply. But I hope it will be useful for future visitors)

    Algorithm for Non-restoring division is given in below image :

    enter image description here

    In this problem, Dividend (A) = 101110, ie 46, and Divisor (B) = 010111, ie 23.

    Initialization :

    Set Register A = Dividend = 000000
    Set Register Q = Dividend = 101110
    ( So AQ = 000000 101110 , Q0 = LSB of Q = 0 )
    Set M = Divisor = 010111, M' = 2's complement of M = 101001
    Set Count = 6, since 6 digits operation is being done here.
    

    After this we start the algorithm, which I have shown in a table below :

    In table, SHL(AQ) denotes shift left AQ by one position leaving Q0 blank.

    Similarly, a square symbol in Q0 position denote, it is to be calculated later

    enter image description here

    Hope all the steps are clear from the table !!!

    0 讨论(0)
  • 2021-02-06 07:12

    1) Set the value of register A as 0 (N bits)
    2) Set the value of register M as Divisor (N bits)
    3) Set the value of register Q as Dividend (N bits)
    4) Concatenate A with Q {A,Q}
    5) Repeat the following “N” number of times (here N is no. of bits in divisor):
      If the sign bit of A equals 0,
       shift A and Q combined left by 1 bit and subtract M from A,
      else shift A and Q combined left by 1 bit and add M to A
      Now if sign bit of A equals 0, then set Q[0] as 1, else set Q[0] as 0
    6) Finally if the sign bit of A equals 1 then add M to A.
    7) Assign A as remainder and Q as quotient.

    0 讨论(0)
提交回复
热议问题