Question: Program 2: Parsing a RISC-Vinstruction In this assignment, you will take a RISC-V instruction stored in memory, and print it in normal printed format. RISC-V

 Program 2: Parsing a RISC-Vinstruction In this assignment, you will take

Program 2: Parsing a RISC-Vinstruction In this assignment, you will take a RISC-V instruction stored in memory, and print it in normal printed format. RISC-V uses a number of formats for its instructions. The first format is for an R-type instruction, with three registers. The second type is the S-type instruction, which is for Store instructions. The third row shows the bit allocations. The fourth row is for the I-type instructions, for use with immediates, See the example below R-Format S-FormatImm 11:5 Bit alloc I-Format RS1 RS1 9..15 RS1 Func7 RS2 RS2 24..20 Func3 Func3 14..12 Func3 RD Imm 4:0 6..0 Imm[11:0 Here are some example instructions, with their machine code equivalents. Notice that instead of having St and Ss registers, they are simply referred to as x registers. The opcodes provided in the table are appropriate for a number of I, R and S type instructions. Thus, you can tell the format of the instruction from the provided es. Instruction Meaning Machine Opcodes Output Code add x1,x2,x3 Add 0x003100b3 0110011 Ox3e813083 0010011 R-format xl I-format xl,x2,1000 ld x1,1000(x2)Load sd x1,1000(x2)Store Your job in this homework is to take the machine code listed above as input and print out the doubleword or 0000011 Ox3el13423 0100011 S-format x1.x2,1000 doubleword Output column above. This means parsing the instruction, determining its format from the opcode, and printing the output as shown. Print the instruction type, as well as the registers or immediate value. Program 2: Parsing a RISC-Vinstruction In this assignment, you will take a RISC-V instruction stored in memory, and print it in normal printed format. RISC-V uses a number of formats for its instructions. The first format is for an R-type instruction, with three registers. The second type is the S-type instruction, which is for Store instructions. The third row shows the bit allocations. The fourth row is for the I-type instructions, for use with immediates, See the example below R-Format S-FormatImm 11:5 Bit alloc I-Format RS1 RS1 9..15 RS1 Func7 RS2 RS2 24..20 Func3 Func3 14..12 Func3 RD Imm 4:0 6..0 Imm[11:0 Here are some example instructions, with their machine code equivalents. Notice that instead of having St and Ss registers, they are simply referred to as x registers. The opcodes provided in the table are appropriate for a number of I, R and S type instructions. Thus, you can tell the format of the instruction from the provided es. Instruction Meaning Machine Opcodes Output Code add x1,x2,x3 Add 0x003100b3 0110011 Ox3e813083 0010011 R-format xl I-format xl,x2,1000 ld x1,1000(x2)Load sd x1,1000(x2)Store Your job in this homework is to take the machine code listed above as input and print out the doubleword or 0000011 Ox3el13423 0100011 S-format x1.x2,1000 doubleword Output column above. This means parsing the instruction, determining its format from the opcode, and printing the output as shown. Print the instruction type, as well as the registers or immediate value

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!