Translate the following C code to LEGv8 assembly code Assume

Translate the following C code to LEGv8 assembly code. Assume that the values of a, b, i and j are in registers X0, X1, X10 and X11, respectively. Also, assume that register X2 holds the base address of the array D. (Please write a comment in front of every assembly instruction)

For (i = 0; i < a; i++)

For (j = 0; j < b; j++)

D[8*i] = 2i + 3j;

Solution

int MainWindow::find()

{

ui->listWidget->clear();

QString text = ui->textEdit->toPlainText(); //store text

QString temp;

for (counter = 0;counter < text.length(); counter ++)

{

if (ui->comboBox->currentIndex() == 0)

{

ui->label->setText(\"Quoted text\");

if (text[counter] == \'\"\')

{

while (text[++counter] != \'\"\')

{

temp[temp_counter ++] = text[counter];   

}

ui->listWidget->addItem(temp);

temp_counter = 0;

temp.clear();

}

}

else if (ui->comboBox->currentIndex() == 1)

{

ui->label->setText(\"Text in brackets\");

if (text[counter] == \'(\')

{

while (text[++counter] != \')\')

temp[temp_counter ++] = text[counter];

ui->listWidget->addItem(temp);

temp_counter = 0;

temp.clear();

}

}

}

return 0;

}int MainWindow::find()

{

ui->listWidget->clear();

QString text = ui->textEdit->toPlainText(); //store text

QString temp;

for (counter = 0;counter < text.length(); counter ++)

{

if (ui->comboBox->currentIndex() == 0)

{

ui->label->setText(\"Quoted text\");

if (text[counter] == \'\"\')

{

while (text[++counter] != \'\"\')

{

temp[temp_counter ++] = text[counter];   

}

ui->listWidget->addItem(temp);

temp_counter = 0;

temp.clear();

}

}

else if (ui->comboBox->currentIndex() == 1)

{

ui->label->setText(\"Text in brackets\");

if (text[counter] == \'(\')

{

while (text[++counter] != \')\')

temp[temp_counter ++] = text[counter];

ui->listWidget->addItem(temp);

temp_counter = 0;

temp.clear();

}

}

}

return 0;

}

Translate the following C code to LEGv8 assembly code. Assume that the values of a, b, i and j are in registers X0, X1, X10 and X11, respectively. Also, assume
Translate the following C code to LEGv8 assembly code. Assume that the values of a, b, i and j are in registers X0, X1, X10 and X11, respectively. Also, assume
Translate the following C code to LEGv8 assembly code. Assume that the values of a, b, i and j are in registers X0, X1, X10 and X11, respectively. Also, assume

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site