Question

In: Computer Science

explain why a computer needs to use memory (registers, stacks, heaps) when executing assembly language instructions...

explain why a computer needs to use memory (registers, stacks, heaps) when executing assembly language instructions using the computer's architecture?

Solutions

Expert Solution

explain why a computer needs to use memory (registers, stacks, heaps) when executing assembly language instructions using the computer's architecture?

Ans:

Since instructions are simply bit patterns, they can be stored in memory. The instruction pointer register always has the memory address of (points to) the next instruction to be executed. In order for the control unit to execute this instruction, it is copied into the instruction register.

The situation is as follows:

  1. A sequence of instructions is stored in memory.

  2. The memory address where the first instruction is located is copied to the program counter.

  3. The CPU sends the address in the program counter to memory via the address bus.

  4. Memory responds by sending a copy of the state of the bits at that memory location on the data bus, which the CPU then copies into its instruction register.

  5. The instruction pointer is automatically incremented to contain the address of the next instruction in memory.

  6. The CPU executes the instruction in the instruction register.

  7. Go to step 3.

While executing assembly language instruction, computer needs to use memory in order to complie, execute and save the code in the memory storage. In memory, we have stack, heap, and main memory. Stack is used to store the variables, arrays etc all the things which was initialized in the program, heap is used for dynamic storage, and main memory is responsible to store the entire code. RAM is also used to compile and run the code.

Let me know if you have any doubts or if you need anything to change. 

If you are satisfied with the solution, please leave a +ve feedback : ) Let me know for any help with any other questions.

Thank You!
===========================================================================

Related Solutions

Question 3. Describe memory types used in the MIPS assembly. Explain registers used in the MIPS...
Question 3. Describe memory types used in the MIPS assembly. Explain registers used in the MIPS assembly. Differentiate between assembly source code and machine code. Write a note on MIPS instruction formats.
1. Convert the machine language instructions into assembly language instructions: 7976C1 06
1. Convert the machine language instructions into assembly language instructions: 7976C1 06
Example: A 3-address computer has 40 instructions, 16 Registers, and 256KB memory. Assume each instruction has...
Example: A 3-address computer has 40 instructions, 16 Registers, and 256KB memory. Assume each instruction has three operands. Two registers and the third operand is a direct address location of a memory. Find minimum size of PC, MAR, MDR, IR. Solution: OPCODE R1, R2, address OPCODE is 6 bits since 2^6>40 Register field is 4 bits since 2^4 =16 Memory field is 18 bits since 2^18=256K Instruction length =6+4+4+18=32 bits MDR=32 bits IR=32 bits MAR=18 PC=18 Please explain
In assembly 1.What is the effect of the following instructions executing on a modern x86 64-bit...
In assembly 1.What is the effect of the following instructions executing on a modern x86 64-bit system (describe what happens and the final contents of the registers involved)? Can you obtain the same end result using only two instructions, and no other registers? PUSH RAX PUSH RBX PUSH RCX XOR RAX,RAX XOR RBX,RBX XOR RCX,RCX POP RAX POP RAX POP RBX 2. What is the purpose of a segment register in protected mode memory addressing? 3. For a 32-bit Pentium4...
Assembly Language 2. Suppose the processor is executing at the fix speed 755MHz. After how much...
Assembly Language 2. Suppose the processor is executing at the fix speed 755MHz. After how much time will the 32-bit counter overflow?   3. What exactly happens when “ret” (asm) or “return” (C++) executes? 4. What is the precise name of the greatest program ever built in assembly language?
MIPS assembly language. Why do "la label" instructions always need to be translated into 2 lines...
MIPS assembly language. Why do "la label" instructions always need to be translated into 2 lines of pseudo code? What about "lw label" instructions? Explain the similarities and differences in how they are implemented in MARS.
Write a sequence of assembly language instructions to subtract each entry of an array A of...
Write a sequence of assembly language instructions to subtract each entry of an array A of five two’s complement 16-bit binary integers from the corresponding entry of an array B of five two’s complement 16-bit binary integers and construct a third array C of two’s complement 16-bit binary integers. i.e. C[i] = A[i] - B[i]. Use the following data for the arrays A and B. A: 10, -15, 20, 4, -5 B: 25, -5, -30, 6, 10 please answer in...
For the PIC16F887, using the execution delay of instructions, write assembly language commands to implement a...
For the PIC16F887, using the execution delay of instructions, write assembly language commands to implement a delay of 3 seconds
Write a possible assembly language instruction or set of instructions to accomplish the following: a) Compare...
Write a possible assembly language instruction or set of instructions to accomplish the following: a) Compare the byte stored at the memory location pointed to by register R4 to the upper (higher) byte stored in register R5 b) Branch to instruction at label ‘ZERO’ if the lower byte of register R6 is zero c) Jump to the instruction at label ‘EVEN’ if the value in register R7 is an even number
Give six examples of memory addressing commands in Intel assembly language two of each(register-memory, register offset...
Give six examples of memory addressing commands in Intel assembly language two of each(register-memory, register offset with an index, and perhaps one other) and explain what they are doing. Why is there no Assembly command to move an item from one RAM location to another directly?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT