Question: Using Simple Machine Language: Choose two memory locations that you will use to represent the variables x and y. Then write a program that performs

Using Simple Machine Language:

Choose two memory locations that you will use to represent the variables x and y. Then write a program that performs a loop that calculates the following value for y: y = x * x

This program implements the following loop:

N=10; j=0; for(i=0;i

Note that by the end of this loop j equals i * N. This fact can help you to write your loop.

UseUsing Simple Machine Language: Choose two memory locations that you will use

Simple Machine Instructions Instruction words are 16-bits, divided into 4 bits of opcode, 2 bits reserved, and 10 bits of address Below is a list of the opcodes for our class machine (from sim.h) HALT LOAD STORE 0x2 ADDC MVAC UEQ JLT JMP ADD SUB DEC # halt the machine # load accumulator from memory # store accumuator to memory # add counter to accumulator # move accumulator to c unter # Jump to address if counter equals 0 # jump to address if counter is less than 0 # jump to address # accumulator memory + accumulator # accumulator -memory - accumulator 0x1 0x3 0x4 0x5 0x6 0x7 0x8 0x9 OxA # decrement counter # LA takes the memory address from the instruction and loads it into the accumulator (load address) LA # LIA uses the memory address in the areg to load memory into the accumulator (load indirect address) LIA 0xC # SIA stores the value in the accumulator in the memory address found in the areg (store indirect address) SIA OxD # MAA moves the value in the accumulat?r to the areg MVAA OxE Simple Machine Instructions Instruction words are 16-bits, divided into 4 bits of opcode, 2 bits reserved, and 10 bits of address Below is a list of the opcodes for our class machine (from sim.h) HALT LOAD STORE 0x2 ADDC MVAC UEQ JLT JMP ADD SUB DEC # halt the machine # load accumulator from memory # store accumuator to memory # add counter to accumulator # move accumulator to c unter # Jump to address if counter equals 0 # jump to address if counter is less than 0 # jump to address # accumulator memory + accumulator # accumulator -memory - accumulator 0x1 0x3 0x4 0x5 0x6 0x7 0x8 0x9 OxA # decrement counter # LA takes the memory address from the instruction and loads it into the accumulator (load address) LA # LIA uses the memory address in the areg to load memory into the accumulator (load indirect address) LIA 0xC # SIA stores the value in the accumulator in the memory address found in the areg (store indirect address) SIA OxD # MAA moves the value in the accumulat?r to the areg MVAA OxE

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!