需要 MIPS 编程帮助
可能的重复:
需要有关 MIPS 程序的帮助
大家好,我在 MIPS 编程中遇到了最困难的时期汇编语言。我必须编写一个程序来读取字符串(从键盘),将其存储在内存中,然后计算并打印每个字符的频率;然后它反转字符串并打印反转的字符串。
我不知道如何开始写这篇文章。谁能帮助我吗?
非常感谢任何帮助,
谢谢。
Possible Duplicate:
Need help with MIPS program
Hi guys, I'm having the hardest time programming in MIPS assembly language. I have to write a program that reads a string (from a keyboard), stores it in the memory, and computes and prints the frequency of each character; and then it reverses the string and prints the reversed string.
I have no idea how to start writing this. Can anyone help me?
Any help is greatly appreciated,
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从这个免费的附录开始,它涵盖了您需要做的许多主题(主要针对 PCSPIM 上的 Mips,但应该没问题,因为您的问题似乎是家庭作业)。链接此处 (PDF)。
Start from this free Appendix that covers many topics of what you need to do (mainly for Mips over PCSPIM, but it should be ok since your question seems homework). Link here (PDF).
MIPS 只是指某种类型的处理器——它本身不能做任何有用的事情。
附加到某些内存上,它可以运行存储在该内存中的机器代码程序,并更改内存内容,但仍然无法与外界交互。
为了让它接受输入(字符串)并生成输出(频率和反向字符串),它必须连接到允许其与其他计算机或人交互的设备,例如图形或键盘控制器或网络接口。
您在评论中提到您正在使用 PCspim - 它模拟某种类型的 MIPS 处理器。它还模拟一个“内存映射控制台”,让您可以通过访问 0xffff0000 和 0xffff0010 之间的内存从键盘读取字符并写入屏幕。
我的方法是找到一个现有的程序(谷歌搜索 spim 示例 会显示一些),让它在 PCspim 中运行,以确保模拟器已安装并正常工作,弄清楚它是如何工作的,然后尝试对其进行调整(参考 spim 文档)来执行您想要的操作。如果您遇到无法解决的问题,请发布一个新问题,其中包含您遇到困难的位置以及您尝试过的具体详细信息。
MIPS just refers to a certain type of processor - by itself it can't do anything useful.
Attached to some memory, it can run machine-code programs stored in that memory, and change the memory contents, but still has no way of interacting with the outside world.
In order for it to accept input (the string) and generate output (the frequencies and reversed string) it must be connected to a device that allows it to interact with other computers or people, such as graphics or keyboard controllers or a network interface.
You mention in a comment that you're using PCspim - this emulates a certain type of MIPS processor. It also simulates a "memory-mapped console" which lets you read characters from the keyboard and write to the screen by accessing memory between 0xffff0000 and 0xffff0010.
My approach would be to find an existing program (Googling spim examples brings up a few), get it running in PCspim to ensure the simulator is installed and working correctly, figure out how it works, then try to adapt it (with reference to the spim docs) to do what you want. If you encounter a problem you can't solve then post a new question with specific details of where you're stuck and what you've tried.