๐(๐) = { ๐ + 1 ๐๐๐ ๐ < 1
3๐ + 5 ๐๐๐ ๐ = 1
๐^3 โ 3๐ + 5 ๐๐๐ ๐ > 1
AVI K.
asked 04/07/21Wombat 1.1
A function is defined as follows:
๐(๐) = { ๐ + 1 ๐๐๐ ๐ < 1
3๐ + 5 ๐๐๐ ๐ = 1
๐^3 โ 3๐ + 5 ๐๐๐ ๐ > 1
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
As an example, suppose you are writing a program to read and display a number. This program could be written as follows:
0011000000000000 ; 0 : 3 0 read into the accumulator
0010000000001010 ; 2 : 2 10 store n at location 10
0001000000001010 ; 4 : 1 10 load n from location 10
0100000000000000 ; 6 : 4 0 output n
0000000000000000 ; 8 : 0 0 stop
0000000000000000 ; 10 : 0 0 storage location for n
write the code in notepad++
๐(๐) = { ๐ + 1 ๐๐๐ ๐ < 1
3๐ + 5 ๐๐๐ ๐ = 1
๐^3 โ 3๐ + 5 ๐๐๐ ๐ > 1
Get a free answer to a quick problem.
Most questions answered within 4 hours.
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
Rachael N.
y n-1 in 3rd line04/24/22