Jackson S.

asked • 04/06/24

How do we test if a number is < 2, >2 or =2?

A function is defined as follows: ๐‘“(๐‘›) = { ๐‘› 2 ๐‘“๐‘œ๐‘Ÿ ๐‘› < 2

๐‘› โˆ’ 4๐‘› ๐‘“๐‘œ๐‘Ÿ ๐‘› = 2

๐‘› 2 + 6๐‘› + 5 ๐‘“๐‘œ๐‘Ÿ ๐‘› > 2

Write Wombat1 machine language program that reads an input integer value n, and computes and displays the output of the above function f(n). In the binary version of your programs that can be executed on the CPUSim simulator, you are also required to write as comments the line number/address, equivalent decimal version of the binary and appropriate comments to explain each line in your program. The decimal version of the program represents each binary line as two decimal values (first value is the opcode โ€“ 4 bits; second value is the operand/memory address โ€“ 12 bits). Therefore, each line of your program should be formatted as follows: Binary-number, Semi-colon, Line-number/address, Decimal-opcode, Decimal-operand/address, Comments

1 Expert Answer

By:

Christopher B. answered • 04/18/24

Tutor
New to Wyzant

Bachelors in Computer Science, looking to help someone get there!

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.