Question: Question 1 - 2 : Please provide the assembly code for the C - based array multiplication using the RV 6 4 I ISA. Your
Question :
Please provide the assembly code for the Cbased array multiplication using the RVI ISA. Your assembly code should be integrated into the arraymulbaseline.c file within the arraymulbaseline function in exercise c Specifically, you are tasked with writing assembly code for the forloop section where each element yi is calculated as hi xi c
The header file arraymul.h specifies the constantsvariables used in this assignment. You can adjust the arrsize variable in arraymul.h to meet the exercise requirements, but please refrain from modifying the rest of the header file.
VariablesConstants defined in the header files used in this exercise:
x: Input array
h: Input array
y: Output array
arraymulbaselinecyclecount: Clock cycle count in arraymulbaseline.c you need to calculate this
cycletime: Given clock cycle time of the target RISCV processor running at GHz
arraymulbaselinecputime: CPU time in arraymulbaseline.c you need to calculate this
arrsize: Size of the array
Your obtained scores for this exercise are determined by the correctness of your reported performance data and statistics.
The values of seven counters:
addcnt: Add counter
subcnt: Subtract counter
mulcnt: Multiply counter
divcnt: Divide counter
lwcnt: Load counter
swcnt: Store counter
otherscnt: Other operations counter
The total cycle count arraymulbaselinecyclecount
The CPU time arraymulbaselinecputime
Choose any arrsize, but logarrsize must be an integer and answer the question: Is this program CPUbound or Memorybound?
The arraymulbaseline function in exercise c is provided below:
void arraymulbaseline
short int ph h;
short int px x;
short int py y;
short int id studentid;
asm volatile
#include "arraymulbaseline.c
: hrph
xrpx
yrpy
addcntraddcnt
subcntrsubcnt
mulcntrmulcnt
divcntrdivcnt
lwcntrlwcnt
swcntrswcnt
otherscntrotherscnt
: idrid
arrsizerarrsize
: tt
;
printf Question
;
printfoutput: ;
for int i ; i arrsize; i
printfd yi;
printf
;
printfadd counter used: d
addcnt;
printfsub counter used: d
subcnt;
printfmul counter used: d
mulcnt;
printfdiv counter used: d
divcnt;
printflw counter used: d
lwcnt;
printfsw counter used: d
swcnt;
printfothers counter used: d
otherscnt;
macroarraymulbaselinecyclecount printfThe total cycle count in this program: f
arraymulbaselinecyclecount;
macroarraymulbaselinecputime printfCPU time f us
arraymulbaselinecputime;
macrocalcarraymulbaselineratio if arraymulbaselineratio
printfThis program is a CPU bound task.
;
else
printfThis program is a Memory bound task.
;
Record the CPU time
FILE fp;
fp fopenarraymulbaselinecputime.txtw;
fprintffpf arraymulbaselinecputime;
fclosefp;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
