What is need of Assign/Deassign in Verilog?

安稳与你 提交于 2019-12-07 15:35:36

The original purpose of the procedural assign/deassign statements in your example was to separate synchronous logic from asynchronous logic in two distinct processes. It's also more efficient for simulation because the synchronous block does not have to check the reset signal every clock cycle. Modeling latches is also more efficient for simulation because because you don't have to check the enable signal every time the data changes, only when the latch is open.

This construct was synthesizable by early synthesis tools, but unfortunately, the big synthesis vendor decided not to support it, so no one uses these procedural constructs anymore.

GreenAsJade

The statements without assign are within a @ edge block, and are evaluated only at that edge. assign describes combinatorial continuous logic, and is by definition sensitive to its inputs.

In Code 1, q will change only when clk or reset changes, not when d changes.

Code 2 has the effect that when reset is asserted, this block will continuously drive q=1 (conflicting with any other driver) but when reset is negated, it will stop driving q.

This is actually more unusual use perhaps of assign - within an @edge block.

More conventional use would be like

assign out = (enable) ? data : 1'bz; 

which will change whenever either enable or data changes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!