Tutorial 4

.pdf
School
Taylor's University**We aren't endorsed by this school
Course
ITS 6270410234
Subject
Computer Science
Date
Jan 1, 2025
Pages
4
Uploaded by BaronSnakeMaster3224
1.What is machine language? Give ONE (1) example of machine language instruction.Machine language is a low-level programming language that is directly understood by a computer's CPU. It consists of binary instructions that tell the computer what actions to perform. E.g. LOAD the register R with the bit pattern found in the memory cell whose address is XY2. Explain how the typical instruction of computer is encoded based on the below figure.In a typical computer architecture, as illustrated in the figure, instructions are encoded using a specific format that involves the Opcode and Operand components.1.Opcode: The opcode (operation code) tells the CPU what action to perform. It is a binary code that corresponds to a particular instruction, such as LOAD, ADD, STORE, etc. This part of the instruction determines the type of operation that the CPU will execute.2.Operands: The operand contains the data to be processed or the memory address where the data is located. In the figure:oRegisters: These are used to temporarily store data or addresses. For instance, if an instruction refers to a register (like register 0 or 1), the data in that register will be used for the operation.oProgram Counter: Holds the address of the next instruction to be executed. After fetching an instruction, the program counter increments to point to the next instruction in sequence.oInstruction Register: Once an instruction is fetched from memory, it is placed here, decoded, and then executed.3.Main Memory: Memory addresses store data or instructions. In this case, the memory contains addresses (00, 01, 02, etc.) and their corresponding data in cells. The CPU fetches instructions from these memory cells via the bus (a communication system between CPU and memory).The typical instruction execution involves fetching the instruction from memory (addressed by the program counter), placing it in the instruction register, decoding it to identify the opcode and operands, and then executing it by manipulating registers or interacting with memory.
Background image
3. Describe what is A, B and C at below machine language instruction (**refer the description table):A is the opcode, B is the register, and C is the memory address or data value used in the instruction.
Background image
5. Translate below set of encoded instruction.156C:1: Opcode, indicating a "LOAD" operation.5: Register 5 is being loaded.6C: Address or memory location from which the value will be loaded.Translation: Load the contents of memory address 6C into register 5.166D:1: Opcode, indicating a "LOAD" operation.6: Register 6 is being loaded.6D: Address or memory location from which the value will be loaded.Translation: Load the contents of memory address 6D into register 6.5056:5: Opcode, indicating an "ADD" operation.0: Register 0 will be the destination of the result.56: Operand for the ADD operation, involving registers or a memory location.Translation: Add the contents of register 5 and register 6, storing the result in register 0.306E:3: Opcode, indicating a "STORE" operation.0: Register 0, which contains the value to be stored.6E: Address in memory where the value will be stored.Translation: Store the contents of register 0 into memory address 6E.C000:C: Opcode, indicating a "HALT" operation.000: Operand (irrelevant for HALT, as it simply stops execution).Translation: Halt the program execution.
Background image
5. Watch the video below and list the components which are involved in the Machine Cycle. Explain the steps described in the video below.
Background image