第一次运行程序(MIPS)之后,通过MIP进行投票无效
我做了一个民意调查序列,当我第一次打开该程序(在QTSPIM上)时,它会完美地进行轮询,当我第二次重新初始化并重新加载该程序时,它刚刚通过,根本没有进行轮询,必须关闭并重新打开该程序的QTSPIM,以使该程序以进行该程序以供该程序以便再次正确进行投票。我是否会重新打开该程序?
loopst: li $a3, 0xffff0000 # base of memory-mapped IO area
rloop: lw $t2,($a3)
nop
andi $t2, $t2, 1
beqz $t2, rloop
nop
这是我试图运行的小民意调查程序,只是为了捕获键盘上按下的键。
i made a polling sequence and when i first open the program (on QtSpim) it polls perfectly, when i reinitialize and reload the program a second time it just falls through and doesnt poll at all and have to close and reopen QTSpim for the program to properly poll again. am i reopening the program wrong?
loopst: li $a3, 0xffff0000 # base of memory-mapped IO area
rloop: lw $t2,($a3)
nop
andi $t2, $t2, 1
beqz $t2, rloop
nop
this is my little poll program im trying to run, just to catch a key pressed on the keyboard.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想这是QTSPIM中某种错误/缺陷/功能。
我编写了一些代码,以清除循环中的输入缓冲区,直到清空为止,它的工作原理太好了。 我将有一个循环打印和清空缓冲区中的每个角色,然后打印一条消息,说它这样做了。
但是,事实证明这是过度的:仅在数据传输位置进行一次读取就足以引起清除重新加载之间的输入缓冲区,因此建议您将其添加到代码的开头,也许是前两行<代码>主。
一旦在模拟中执行该操作,QTSPIM似乎在重新初始化和重新加载菜单命令时重新定位输入缓冲区。&nbsp;如果您在模拟过程中从未从数据传输MMIO位置读取,则QTSPIM显然不会清除Reinit上的输入缓冲区。重新加载。
我冒险在大多数情况下都避免了这个问题,因为所有模拟都必须在模拟中的任何时刻从输入缓冲区中读取一个字符。
因此,引起这种烦人的行为所需的是,某些字符已输入输入缓冲区,但是程序/仿真已停止&amp;在阅读一个字符之前重新启动(并且下一个程序是使用MMIO键盘输入)。
I would guess this is some kind of bug/flaw/feature in QtSpim.
I wrote some code code to clear the input buffer in a loop until it is emptied, and it works way too well. I was going to have a loop that printed and emptied each character in the buffer, then printed a message saying it had done so.
However, this turned out to be overkill: merely doing one single read from the data transfer location is sufficient to cause clearing the input buffer between Reloads, so suggest you add this to the beginning of your code, maybe as the first two lines of
main
.Once that's executed in your simulation, QtSpim seems to reinitialize the input buffer upon Reinitialize and Reload menu command. If you never read from the data transfer MMIO location during the simulation, QtSpim apparently won't clear the input buffer on Reinit & Reload.
I would venture that this issue is avoided in most situations, since all the simulation has to do a read just one character from the input buffer at any point in the simulation.
So what it takes to elicit this annoying behavior is that some characters are entered in the input buffer, but the program/simulation is stopped & restarted before reading even one character (and that the next program is using MMIO keyboard input).