为什么 "less than" 在“等于”起作用时不起作用?

Why "less than" doesn't work when "equal' works?

我有一个简单的项目:

NET "sw<2>"   LOC = "P89";
NET "sw<1>"   LOC = "P95";
NET "sw<0>"   LOC = "P101";
NET "ld"   LOC = "P59";
module top_module(
    input [2:0] sw,
    output ld
);
assign ld = sw == 3'd2;
endmodule

编译无任何错误。但是,如果我将 == 更改为 <,它不会:

WARNING:PhysDesignRules:367 - The signal <sw<0>_IBUF> is incomplete. The signal does not drive any load pins in the design.

WARNING:Par:288 - The signal sw<0>_IBUF has no load. PAR will not attempt to route this signal.

谁能解释一下为什么会这样?

因为只有两个(无符号,整数)小于2的数字是1和0,所以数字的低位无所谓,即sw[0]无所谓。这里什么都没有 'not working',只有一些 probably-irrelevant 警告。

警告只是告诉您 sw[0] 不会影响输出。如果将比较更改为 <=,则警告将消失,因为逻辑将需要再次关注 sw[0]。