Complete the provided RISC-V assembly language program to implement the code sequence. Test and verify the correctness of the program using the RARS software.  Attach your .asm source file to your assignment submission in Blackboard

Computer Architecture

Instruction Sets, Memory Address Alignment, RISC-V Assembly

This homework assignment is based on the information covering the topics of instruction sets, memory address alignment, and RISC-V assembly language programming.

 

  1. The four classes of instruction sets discussed in class are the stack, accumulator, register-memory and register-register. For this assignment, use the following specifications that are defined for each.

For all classes, opcodes are 8 bits (1 byte) and memory references are 64 bits (8 bytes).  For the register-memory and register-register classes, register references are 4 bits, and available registers are referenced R1 – R6. Memory references are labeled A – F.

 

  1. For each class, write the code sequence to compute the following:

 

C = A + B;

D = A – E;

F = C + D;

  1. To analyze and compare the differences between the four code sequences from part A, complete the following a table with the identified items:

 

Your code sequence should be listed in the first column labeled Code, then complete these remaining items in the table:

  1. Identify the destroyed data items for applicable instructions.
  2. Indicate in your code the overhead data in bytes for applicable instructions.
  3. Indicate the code size for each instruction.
  4. For all memory reference instructions, provide the total bytes transferred.

 

At the end of the table, total the values for the overhead data, code size and moved memory data and identify which instruction set class has the smallest of these total values.

 

  1. Complete the provided RISC-V assembly language program to implement the code sequence. Test and verify the correctness of the program using the RARS software.  Attach your .asm source file to your assignment submission in Blackboard.

 

  1. Consider the following example data structure that might be defined in a program written in C. The data size for the different data types on a 64-bit system are shown in the table.

The compiler allocates each element of the structure in memory in the order given in the struct definition. Alignment restriction forces data items to be aligned at memory addresses based on data size as shown in the table on page 8 in the lecture slides. How much total memory in bytes is required for the structure if all data items are required to be aligned based on data size?

 

  1. Rearrange the order of the struct definition so that the minimum possible size is achieved.