Task 2a: 16 bit subtraction

2 submissions | 1/1 users solved | Full Leaderboard

Create a woodpecker script that takes 16-bit a and 16-bit b and calculates the 16-bit difference a-b.

If b>a, output its two's complement.

<low    a    hi> | <low    b    hi> | <low  output hi>
------------------------------------------------------
0000000000000000 | 0000000000000000 | 0000000000000000
0100000000000000 | 1000000000000000 | 1000000000000000
0000000000000000 | 1000000000000000 | 1111111111111111
0000100000000000 | 1111000000000000 | 1000000000000000
0010010110000000 | 1010001000000000 | 1111101010000000
1010001000000000 | 0010010110000000 | 1000010101111111
1111111111111111 | 1111111111111111 | 0000000000000000

Submit new Solution