40 bit binary number to BCD
Posted: Sat Jul 29, 2023 5:43 pm
I have five binary words called W0, W1, W2, W3 and W4. Each word has 8 bit p0 to p7, where p0 is LSB and p7 is MSB. The word W0 is the lowest and W4 is the highest word. All words concatenated together (W0 through W4) represent a 40-bit binary number:
p7(W4) is bit 39 and is MSB of 40 bit binary number
p6(W4) is bit 38
:
:
p1(W0) is bit 1
p0(W0) is bit 0 and is LSB of 40 bit binary number
I need an algorithm, a program to convert this 40 bit number to twelve BCD numbers. each BCD number represents with 4 bit.
p7(W4) is bit 39 and is MSB of 40 bit binary number
p6(W4) is bit 38
:
:
p1(W0) is bit 1
p0(W0) is bit 0 and is LSB of 40 bit binary number
I need an algorithm, a program to convert this 40 bit number to twelve BCD numbers. each BCD number represents with 4 bit.