Convert the following C code to PIC24 assembly instructions:
uint16 j, k, p, q;
if ( (j < p) && (k >= p) ) {
q = q + 4;
}
else {
q = q + 8;
}
C program to Assembly Code Conversion
C CODE: test.c
#include<stdio.h>
#include<inttypes.h>
main()
{
uint16_t j,k,p,q;
if((j<p)&&(k>=q))
{
q=q+4;
}
else
{
q=q+8;
}
}
ASSEMBLY CODE:
.file "test.c"
.text
.globl main
.type main,@function
main:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6,-16
movq %rsp,%rbp
.cfi_def_cfa_register 6
movzwl -2(%rbp), %eax
cmpw -4(%rbp), %ax
jnb .L2
movzwl -6(%rbp), %eax
cmpw -8(%rbp), %ax
jb .L2
addw $4, -8(%rbp)
jmp .L4
.L2:
addw $8,-8(%rbp)
.L4:
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-11)"
.section .note.GNU-stack,"",@progbits
Convert the following C code to PIC24 assembly instructions: uint16 j, k, p, q; if (...
Give a PIC24 assembly language implementation of the following C code. uint16 i,j, k; if (i-=j 1 (i>=k & & !j)) if-body else else-body
01) Write PIC24 assembly language equivalents for the Sollowing C code fragments. Assume variables u16 iul kal6 j.ul6 n are uintl6 variables, while uš p, u8 q, u8 rare uin variables 1. Code fragent 2. Code fragment . Code frapent (use place holders for if-body, else-body) if-body statements else-body statements 4. Code fragent (use place holders for if-body, else-body) if-body statements l else I else-body statenents 5. Code frapent (use place holders for loop-body) &. Code fragent (use place holders...
Convert the following c code into instructions MIPS Assembly language. Assume a associated with $s0, i with $s1, and j with $s2. if( i < 10) { if( j < 10) { a = 0; } else { a = 1;} } else { a = 2; }
05/0172019 Q1: (20) Choose one of these C code fragments and write it in PIC24 assembly form. if (u16 i< u16 k) |I True if((u 16-i <ul6k) && TAR (ul6j_u16_p)11 (16.9 !=0)) { if body Falttau 16-j != 80)) { if body else else else-body else-body f code rest of code s else.
05/0172019 Q1: (20) Choose one of these C code fragments and write it in PIC24 assembly form. if (u16 i
please show work and explain steps
Implement the following subroutine in PIC24 assembly language. Use the policy estab- lished in this chapter for using working registers for subroutine parameters and loca II this subroutine implements an uint16 t swap. void u16-swap(uint16-t* pul 6-х, uint8-t u8-1, uint8-t u8.j)( ls uint16-t u16_k; u16-k = pu16-XLu8-1);
Convert from Java code to MIPS Assembly code C statements MIPS Assembly code f = (g + h) + (j + 13) A[12] = h + A[8] if (f != 0) { f = f + j; j = j - 1; } if (j==h) f = g+h; else f = g-h; f = f + A[2]; if (j !=h ) f = f + 1; f = g + h;
Compile the assembly code for the following C codes. Assume that i, j, and k have been stored in $s0, $s1, and $s2 respectively. The base address of the array B is stored in $s4. Please only use only TRUE MIPS instructions. for (i = k; i > 0; i = i - 2) j = i + 2k; for (i = 0; i < k; i++) for (j = 1; j < i; j++) B[2j] = B[i - k]-4
B2. Convert the C code to MIPS assembly with only 2 efficient instructions: Register assignment: timer-v0 int timer = 0x0AC8 0001; B3. Write MIPS assembly code segment for the following C code snippet for (i - 0, i < 100; i++) -array Register assignment: i-) $ao Base of array -> $s0 array [ i+1] [i] / 2;
B2. Convert the C code to MIPS assembly with only 2 efficient instructions: Register assignment: timer-v0 int timer = 0x0AC8 0001; B3. Write...
4. Convert the below C code snippet to LEGV8 assembly code. Base address of x is stored in register X19. Assume variables a, b, andc are stored in registers X20, X21, and X22 respectively. Assume all values are 64-bits. Do not use divide and multiply instructions in your code. Comment your assembly code. (30 Points) x[e] a x[1]; q [e]x x[a/2]b; x[2]; + x[1] x[2] x[c] C >> 4: x[1] +
4. Convert the below C code snippet to LEGV8...
3. Convert the following C code to assembly. Assume a, b, and c are in main memory at addresses 1000, 1004, and 1008. if(a == 20) b=c+10; else b = c-14;