xiaop1 / Verilog-Practice

HDLBits website practices & solutions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Avoid warning in 0_Getting_Started

Kuo-TingKai opened this issue · comments

按照 Verilog-Practice/0_Getting Started/01_Step_one.v 答案運行之後,雖然答案正確但會出現這樣的警告:

Warning (13024): Output pins are stuck at VCC or GND
This warning says that an output pin never changes (is "stuck"). This can sometimes indicate a bug if the output pin shouldn't be a constant. If this pin is not supposed to be constant, check for bugs that cause the value being assigned to never change (e.g., assign a = x & ~x;)

請問要如何避免這樣的警告?
謝謝!

02_Zero.v 也會有一樣警告但是
03就沒有出現了,這感覺是類似高階語言中初始化沒有「歸零」的問題? (抱歉用詞不精確)

commented

首先回答你的问题,在 01 和 02 这类 module 中,无法避免这样的警告。

因为题目要求输出为固定值,且没有输入变量,所以只能用常量 constant 进行赋值,所以产生了 Warning。
其实在工程中经常出现 Warning,因为工程实践中当你的代码量非常大时,无法避免类似工程需求。可能当你的工程对效率和代码质量有较高要求时,可以通过增加输入量避免此类错误,但是会造成代码冗余。

希望我的解释能让你理解,并能够在硬件 FPGA 上进行实践,祝你学习愉快~