Question 6

AQA Computer Science Specimen Paper 2 (7517/2)A level8 marks

On the specification

6.1
3.7 Fundamentals of computer organisation and architecture
6.2
3.7 Fundamentals of computer organisation and architecture
6.3
3.7 Fundamentals of computer organisation and architecture
6.4
3.7 Fundamentals of computer organisation and architecture
Question text

6 Figure 3 shows the structure of an example machine code instruction, taken from the instruction set of a particular processor. Figure 3 Opcode Operand(s) Basic Machine Addressing Operation Mode 1 1 0 1 0 1 0 0 1 0 1 0 1 1 6.1 How many different basic machine operations could be supported by the instruction set of the processor used in the example in Figure 3? [1 mark] Figure 4 shows an assembly language program together with the contents of a section of the main memory of the computer that the program will be executed on. The assembly language instruction set that has been used to write the program is listed in Table 2.The lines of the assembly language program have been numbered to help you answer question parts 0 6 . 2 to . 4 . 6 1 Figure 4 Line Command Memory Main Memory 1 MOV R2, #100 Address Contents 2 LDR R3, 101 (in decimal) (in decimal) 3 ADD R2, R2, R3 100 23 4 LSL R3, R2, #1 101 10 5 HALT 102 62 103 18 6.2 What value will be stored in register R2 immediately after the command in line 1 has been executed? [1 mark] 6.3 What value will be stored in register R2 immediately after the program has executed the commands from line 1 through to line 3? [1 mark] 6.4 What value will be stored in register R3 after the complete program has finished executing? [1 mark] Table 2 LDR Rd, <memory ref> Load the value stored in the memory location specified by <memory ref> into register d. STR Rd, <memory ref> Store the value that is in register d into the memory location specified by <memory ref>. ADD Rd, Rn, <operand2> Add the value specified in <operand2> to the value in register n and store the result in register d. SUB Rd, Rn, <operand2> Subtract the value specified by <operand2> from the value in register n and store the result in register d. MOV Rd, <operand2> Copy the value specified by <operand2> into register d. CMP Rn, <operand2> Compare the value stored in register n with the value specified by <operand2>. B <label> Always branch to the instruction at position <label> in the program. B<condition> <label> Conditionally branch to the instruction at position <label> in the program if the last comparison met the criteria specified by the <condition>. Possible values for <condition> and their meaning are:  EQ: Equal to.  NE: Not equal to.  GT: Greater than.  LT: Less than. AND Rd, Rn, <operand2> Perform a bitwise logical AND operation between the value in register n and the value specified by <operand2> and store the result in register d. ORR Rd, Rn, <operand2> Perform a bitwise logical OR operation between the value in register n and the value specified by <operand2> and store the result in register d. EOR Rd, Rn, <operand2> Perform a bitwise logical exclusive or (XOR) operation between the value in register n and the value specified by <operand2> and store the result in register d. MVN Rd, <operand2> Perform a bitwise logical NOT operation on the value specified by <operand2> and store the result in register d. LSL Rd, Rn, <operand2> Logically shift left the value stored in register n by the number of bits specified by <operand2> and store the result in register d. LSR Rd, Rn, <operand2> Logically shift right the value stored in register n by the number of bits specified by <operand2> and store the result in register d. HALT Stops the execution of the program. Interpretation of <operand2> <operand2> can be interpreted in two different ways, depending upon whether the first symbol is a # or an R:  # - use the decimal value specified after the #, eg #25 means use the decimal value 25.  Rm - use the value stored in register m, eg R6 means use the value stored in register 6. The available general purpose registers that the programmer can use are numbered 0 to 12. Programs written in a high-level language can be compiled or interpreted. Companies that develop computer programs to sell usually compile the final version of a program before distributing it to customers. 6.5 Explain why the final version of a computer program is usually translated using a compiler. [2 marks] The JavaScript programming language can be used to write programs that are executed in a web browser on any Internet user’s computer. 6.6 Explain why programs written in the JavaScript language, to be executed in a web browser, are interpreted rather than compiled. [2 marks]