Chat with us, powered by LiveChat

How much total memory in bytes is required for the structure if all data items are required to be aligned based on data size?

Words: 68
Pages: 1
Subject: Architecture

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.

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.

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

C = A + B;
D = A – E;
F = C + D;
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:
Identify the destroyed data items for applicable instructions.
Indicate in your code the overhead data in bytes for applicable instructions.
Indicate the code size for each instruction.
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.

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.

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?

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