Question

Turing Machine for subtraction of two binary numbers

Design a turing machine that subtracts two binary numbers
0 0
Add a comment Improve this question Transcribed image text
Answer #1
x.xÏ=nbsp;

Binary subtraction:

Lets build a turing machine that can subtract 2 binary numbers. A subtraction is done on two inputs: in a subtraction x-y we call x the base andy the subtrahend. Before going into the turing machine details, we first have to understand how binary numbers are subtracted. This is done bit by bit,starting at the least significant bit. Lets take the example of 35-15=22:

yyy n n n- borrowed? No or yes

10 0 01 1 -base input

00 1 10 1 - subtrahend input

--------------------------------------------

nyy y n n- ‘borrowed’ value (yes or no)is

Carried over to the next bit

--------------------------------------------------

0 10 1 10 - answer

Ruleset:

All possible combinations of inputs with the respective actions are listed in the ruleset in table 1.

We’he designed the ruleset such that the first decimal of the state number is used as a control register and the second decimal asadata refister.The first says where we are(reading the ase input, reading the subtrahend input,sweeping back to start,etc). The second holds the actualcomputational data and has everything to do with fig.

Look at the first 2 lines of the ruleset: At positions ‘s’ the state is always 50 or 51: 2 states to see whether we borrowed or not. With 50 wesay: yes, we borrowed, with 51 we say: ‘not borrowed’.

Now look at the last 4 lines: Whenever we read a blank ,we are at the end of our tape.note that the 4 possible leafnodesmatch the 4 possible machine states at this point: the last 4 lines in our rulest (with states 20,21,22,23 respectively for leaf nodes‘0,y’,’1,y’,’0n’,’1n’).Rule set for subtracting turning machine,rr
If in stateAnd on symbolWriteAnd moveSet next state
50515051SS!S!Srrll10115051Start left(withBorrowed)(withoutBorrowed)Move to Start.
1011202122230/10/10/10/10/10/1rrrrrr101120212223Move r and do nothing this is nobit in our interest
10113212223#####00000rrrrr3031414243Handle # (alert ! next position is the bit of interest)
111213***rrr212223Handle * and go from first to second input
20212223****rrrr20212223Left pas before answer do nothing
303031310101####rµM x.xÏ=iv align="center">r
answered by: This is for MattsRiceBowl
Add a comment
Know the answer?
Add Answer to:
Turing Machine for subtraction of two binary numbers
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT