首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Verilog,测试零标志

Verilog,测试零标志
EN

Stack Overflow用户
提问于 2017-12-11 18:44:17
回答 1查看 1.2K关注 0票数 0
代码语言:javascript
复制
module NOR31_1x1(Y,A);
input [31:0] A;
output Y;

wire [29:0] norWire;

    nor nor1(norWire[0], A[0], A[1]);
        nor nor2(norWire[1], norWire[0], A[2]);
    nor nor3(norWire[2], norWire[1], A[3]);
    nor nor4(norWire[3], norWire[2], A[4]);
    nor nor5(norWire[4], norWire[3], A[5]);
    nor nor6(norWire[5], norWire[4], A[6]);
    nor nor7(norWire[6], norWire[5], A[7]);
    nor nor8(norWire[7], norWire[6], A[8]);
    nor nor9(norWire[8], norWire[7], A[9]);
    nor nor10(norWire[9], norWire[8], A[10]);
    nor nor11(norWire[10], norWire[9], A[11]);
    nor nor12(norWire[11], norWire[10], A[12]);
    nor nor13(norWire[12], norWire[11], A[13]);
    nor nor14(norWire[13], norWire[12], A[14]);
    nor nor15(norWire[14], norWire[13], A[15]);
    nor nor16(norWire[15], norWire[14], A[16]);
    nor nor17(norWire[16], norWire[15], A[17]);
    nor nor18(norWire[17], norWire[16], A[18]);
    nor nor19(norWire[18], norWire[17], A[19]);
    nor nor20(norWire[19], norWire[18], A[20]);
    nor nor21(norWire[20], norWire[19], A[21]);
    nor nor22(norWire[21], norWire[20], A[22]);
    nor nor23(norWire[22], norWire[21], A[23]);
    nor nor24(norWire[23], norWire[22], A[24]);
    nor nor25(norWire[24], norWire[23], A[25]);
    nor nor26(norWire[25], norWire[24], A[26]);
    nor nor27(norWire[26], norWire[25], A[27]);
    nor nor28(norWire[27], norWire[26], A[28]);
    nor nor29(norWire[28], norWire[27], A[29]);
    nor nor30(norWire[29], norWire[28], A[30]); 
        nor result(Y, norWire[29], A[31]);
endmodule

嗨,所以我写了上面的代码来测试Zero标志是否由nor每一位对另一位设置,看起来逻辑是正确的,但无论任何输入,结果都保持零标志的返回1。我通过模拟来测试,似乎norWire已经包含了一些值,尽管还没有设置任何值。我能得到一些帮助来调试这个吗?由于不熟悉Verilog和ModelSim模拟器,我很难对其进行调试。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-12-11 21:49:06

让我们将其限制为三位,以说明问题。如果我们标记A,B和C位,你想要表达的是:

代码语言:javascript
复制
!(A | B | C)

你写的是:

代码语言:javascript
复制
!(!(A | B) | C)

其中一个NOR的输出(与最后的否定一起完成)被前馈到下一阶段。

因此,明智地使用“or”和“not”原词应该会让你达到这个目的。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47751146

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档