PandA-2024.02
asm.c
Go to the documentation of this file.
1 extern __attribute__((fastcall,noinline)) int sub2values(int a, int b);
2 
3 int check(int a, int b)
4 {
5  int res1;
6 #if 1
7  asm(
8  "{"
9  " movl %2, %%edx\n\t"
10  " movl %1, %%ecx\n\t"
11  " call sub2values\n\t"
12  " movl %%eax, %0\n\t"
13  "|"
14  " mov esi, %2\n\t"
15  " mov edi, %1\n\t"
16  " call sub2values\n\t"
17  " mov eax, %0\n\t"
18  "|"
19  "/* Here Verilog is considered as third assembler dialect..*/\n"
20  "reg done_port;\n"
21  "// synthesis translate_off\n"
22  " always @(negedge clock)\n"
23  " if(start_port == 1'b1)\n"
24  " begin\n"
25  " $display(\"hello world %%h %%d\", in1, in2);\n"
26  " end\n"
27  " // synthesis translate_on\n"
28  " always @(posedge clock) done_port <= start_port;\n"
29  " assign out1 = in1 - in2;"
30  "}"
31  : "=r" (res1)
32  : "r" (a), "r" (b) /*two inputs*/
33  );
34 #else
35  res1 = sub2values(a,b);
36 #endif
37  return a + b + res1;
38 }
39 
40 int main()
41 {
42  volatile int a= 7;
43  volatile int b= 5;
44  return check(a,b)!=14;
45 }
__attribute__((fastcall, noinline))
Definition: asm.c:1
int main()
Definition: asm.c:40

Generated on Mon Feb 12 2024 13:02:50 for PandA-2024.02 by doxygen 1.8.13