第2章Alu.hdl不在最后一行

发布于 2025-01-17 20:58:37 字数 1162 浏览 1 评论 0原文

当我运行alu-nostat.tst时,代码执行完美。但是,当我运行alu.tst时,代码在第1行中停止。如果然后再次单击前向箭头并允许其测试以下测试用例,则似乎可以工作。我将生成的输出文件与比较文件进行了比较,我认为一切都匹配。由于输出文件为空(仅带有输入和输出列标头),因此错误似乎是在测试案例之前进行测试之前。

set x %B0000000000000000,  // x = 0

^是测试脚本停止的行。这很奇怪,因为它不会在这里停止:

set x %B0000000000000000,

在无stat脚本上。

如果有帮助,则代码在下面。

` 零件:

Mux16(a=x[0..15],b[0..15]=false,sel=zx,out=x1);
Not16(in=x1,out=maybex);
Mux16(a=x1,b=maybex,sel=nx,out=x2);

Mux16(a=y[0..15],b[0..15]=false,sel=zy,out=y1);
Not16(in=y1,out=maybey);
Mux16(a=y1,b=maybey,sel=ny,out=y2);

And16(a=x2,b=y2,out=output1);//I dont know what is wrong here
Add16(a=x2,b=y2,out=output2);
Mux16(a=output1,b=output2,sel=f,out=output3);

Not16(in=output3,out=almost);

Mux16(a=output3,b=almost,sel=no,out=out);

Mux16(a=output3,b=almost,sel=no,out[15]=pt2);
Mux16(a=output3,b=almost,sel=no,out=pt3);


And(a=pt2,b=true,out=ngtest);
Add16(a=pt3,b[0..15]=true,out[15]=pinname);
Mux(a=pinname,b=false,sel=ngtest,out=zr);
And(a=pt2,b=true,out=ng);`

即使评论了ZR和NG输出引脚的所有新行之后,它仍然在第1行上给我一个比较失败。

当我重新下载时,Alu.tst也不是问题不起作用。我不明白错误是什么。

非常感谢!!!

When I run ALU-nostat.tst, the code executes perfectly. However, when I run ALU.tst, the code stops on line 1. If I then click the forward arrow again and allow it to test out the following test cases, it seems to work. I compared the output file generated with the compare file and I think that everything matches. The error seems to be before the cases are tested out because the output file is empty (only with the input and output column headers) before I click the forward arrow again.

set x %B0000000000000000,  // x = 0

^ is the line where the test script stops. It is strange because it does not stop here:

set x %B0000000000000000,

on the no-stat script.

In case it helps, the code is below.

`
PARTS:

Mux16(a=x[0..15],b[0..15]=false,sel=zx,out=x1);
Not16(in=x1,out=maybex);
Mux16(a=x1,b=maybex,sel=nx,out=x2);

Mux16(a=y[0..15],b[0..15]=false,sel=zy,out=y1);
Not16(in=y1,out=maybey);
Mux16(a=y1,b=maybey,sel=ny,out=y2);

And16(a=x2,b=y2,out=output1);//I dont know what is wrong here
Add16(a=x2,b=y2,out=output2);
Mux16(a=output1,b=output2,sel=f,out=output3);

Not16(in=output3,out=almost);

Mux16(a=output3,b=almost,sel=no,out=out);

Mux16(a=output3,b=almost,sel=no,out[15]=pt2);
Mux16(a=output3,b=almost,sel=no,out=pt3);


And(a=pt2,b=true,out=ngtest);
Add16(a=pt3,b[0..15]=true,out[15]=pinname);
Mux(a=pinname,b=false,sel=ngtest,out=zr);
And(a=pt2,b=true,out=ng);`

Even after commenting out all of the new lines for the zr and ng output pins, it is still giving me a comparison failure on line 1.

It is not a problem with ALU.tst as I re-downloaded it and it still does not work. I do not understand what the error is.

Many thanks!!!!

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

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

发布评论

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

评论(1

梦醒时光 2025-01-24 20:58:37

这只是一个疯狂的猜测,但我注意到 alu.tst 中的 set y 行以 ; 结尾。虽然 alu-nostat.tst 中的一个以 a 结尾,但

文件中后面的另一组 y 也是如此。

我会将那些 ; 更改为 , ,看看是否可以解决问题。

如果没有,可能是您的 ALU 没有正确生成 zr 和 ng 值,因此它在第一次评估时确实失败了,但由于某种原因,您收到了一条误导性的错误消息,指出您指向错误的行。我建议您单步执行测试并手动检查 ALU 是否正确响应。

祝你好运!

This is just a wild guess, but I noticed that the set y line in alu.tst ends in a ; while the one in alu-nostat.tst ends in a ,

Same goes for the other set y later in the file.

I would change those ;'s to ,'s and see if it fixes the issue.

If it doesn't, it may be that your ALU isn't generating the zr and ng values correctly so it's really failing on the first eval but for some reason you're getting a misleading error message pointing you to the wrong line. I would suggest you single-step through the tests and manually check to the ALU is responding correctly.

Good luck!

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