Answer To: Objective Understand how ARMv8 instructions function. Submitting Your Work Save your C program file...
Swapnil answered on Oct 25 2021
94563/Solution/code.txt
100 512 0 0 0
104 24 0 0 0
108 22 0 0 0
200 ADDI X0, XZR, #100
204 LDUR X9, [X0, #0]
208 ADDI X0, X0, #4
212 LDUR X10, [X0, #4]
216 ADD X9, X9, X10
94563/Solution/code2.txt
100 32 0 0 0
104 0 0 0 0
200 ADDI X0, X0, #16
204 LDUR X1, [X3, #100]
208 ADD X3, X0, X1
212 SUB X3, X3, X0
216 CBZ X3, 224, 0
220 B 212, 0, 0
224 STUR X0, [X2, #104]
228 LDUR X4, [X4, #104]
232 ADD X4, X1, X3
236 SUB X4, X2, X4
240 ADD X1, X3, X4
94563/Solution/output.txt
PC = 204, INSTRUCTION: ADDI X0, X0, #16
Registers:
X0 = 16
PC = 208, INSTRUCTION: LDUR X1, [X3, #100]
Registers:
X0 = 16 X1 = 32
PC = 212, INSTRUCTION: ADD X3, X0, X1
Registers:
X0 = 16 X1 = 32 X3 = 48
PC = 216, INSTRUCTION: SUB X3, X3, X0
Registers:
X0 = 16 X1 = 32 X3 = 32
PC = 220, INSTRUCTION: CBZ X3, 224, 0
Registers:
X0 = 16 X1 = 32 X3 = 32
PC = 212, INSTRUCTION: B 212, 0, 0
Registers:
X0 = 16 X1 = 32 X3 = 32
PC = 216, INSTRUCTION: SUB X3, X3, X0
Registers:
X0 = 16 X1 = 32 X3 = 16
PC = 220, INSTRUCTION: CBZ X3, 224, 0
Registers:
X0 = 16 X1 = 32 X3 = 16
PC = 212, INSTRUCTION: B 212, 0, 0
Registers:
X0 = 16 X1 = 32 X3 = 16
PC = 216, INSTRUCTION: SUB X3, X3, X0
Registers:
X0 = 16 X1 = 32
PC = 224, INSTRUCTION: CBZ X3, 224, 0
Registers:
X0 = 16 X1 = 32
PC = 228, INSTRUCTION: STUR X0, [X2, #104]
Registers:
X0 = 16 X1 = 32
PC = 232, INSTRUCTION: LDUR X4, [X4, #104]
Registers:
X0 = 16 X1 = 32 X4 = 16
PC = 236, INSTRUCTION: ADD X4, X1, X3
Registers:
X0 = 16 X1 = 32 X4 = 32
PC = 240, INSTRUCTION: SUB X4, X2, X4
Registers:
X0 = 16 X1 = 32 X4 = -32
PC = 244, INSTRUCTION: ADD X1, X3, X4
Registers:
X0 = 16 X1 = -32 X4 = -32
94563/Solution/Solution.c
#include
#include
#include
#define MAX_LINES 50
#define NUM_FIELDS 5
#define SIZE_FIELDS 6
char memory[MAX_LINES][NUM_FIELDS][SIZE_FIELDS];
int pc = 200;
int regArray[33];
char *ptr;
void parseFile(char* fileName, int *opCount, int *memCount);
void ADD(char * dest, char * src1, char * src2);
void ADDI(char * dest, char * src1, char * src2);
void SUB(char * dest, char * src1, char * src2);
void LDUR(char * dest, char * src1, char * src2);
void STUR(char * dest, char * src1, char * src2);
void AND(char * dest, char * src1, char * src2);
void ORR(char * dest, char * src1, char * src2);
void EOR(char * dest, char * src1, char * src2);
void EORI(char * dest, char * src1, char * src2);
void LSL(char * dest, char * src1, char * src2);
void LSR(char * dest, char * src1, char * src2);
void B(char * dest);
int convertSrc(char *src1, char *src2);
int convertIntermed(char *intermed);
int convertReg(char *reg);
int main(int argc, char* argv[])
{
regArray[32] = 0;
char *filename = "code.txt";
int opCount = 0;
int memCount =...