从 C 到 UAL 汇编的 UAL 汇编

发布于 2025-01-03 18:01:28 字数 238 浏览 4 评论 0原文

给定 C 代码,在 UAL 汇编中重写以下程序。假设gcd() 和 print() 是计算最大公约数的符合 ABI 的函数 并分别打印变量。确保注释你的汇编代码,

int main() {
uint32_t a=0x5, b, i;
b = 4*a;
while(i<10) {
b = gcd(a, b);
i++;
}
print(b);
}

这是我正在尝试做的预实验......谢谢

Rewrite the following program in UAL assembly, given its C code. Assume that gcd()
and print() are ABI compliant functions that calculate the greatest common divider
and print the variable respectively. Make sure to annotate your assembly code

int main() {
uint32_t a=0x5, b, i;
b = 4*a;
while(i<10) {
b = gcd(a, b);
i++;
}
print(b);
}

this is for a pre-lab that i am trying to do ... thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

衣神在巴黎 2025-01-10 18:01:28

这看起来不像预实验。然而,它看起来确实像嵌入式系统中刚刚分配的问题 1(值 20 分)。你应该花时间学习汇编和 C 语言中的同等内容。否则你在课堂上会很吃力,因为 Stack Overflow 不会在你即将到来的考试中帮助你......如果你在汇编方面遇到问题,请加入一个学习小组,那里有班上的其他学生正在处理与您相同的问题。实验室里几乎总是有学生。

另外,UAL 是 ARM 汇编语法,请参阅链接:
http://infocenter.arm.com/help/index .jsp?topic=/com.arm.doc.dui0473c/BABJIHGJ.html

This does not look like a prelab. It does however look like problem 1 (worth 20 points) that was just assigned in Embedded Systems. You should take the time to learn assembly and the equivalent in C. You will struggle in the class otherwise, since Stack Overflow wont help you on your upcoming exam.... Join a study group if you are having problems with assembly, there are other student in the class dealing with the same issues as you. There is almost always students in the lab as well.

Also, UAL is a ARM Assembly syntax see link:
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0473c/BABJIHGJ.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文