Verilog blocking assignment and non-blocking assignment

Source: Internet
Author: User

1 Modulemain ();2 Regclk=0;3 Reg[ One:0] A=0;4 Reg[ One:0] B=0;5  always# -clk=~CLK;6  always@ (CLK)7 begin8a=a+4;9b<=a/4;Ten End One Endmodule

If you pour the two sentences in always, the output will change.

The above procedure 0~50s, b=1; change to the following situation after b=0;
1   Modulemain ();2   Regclk=0;3   Reg[ One:0] A=0;4   Reg[ One:0] B=0;5    always# -clk=~CLK;6    always@ (CLK)7   begin8b<=a/4;9a=a+4;Ten  End One  Endmodule

1) calculates the non-blocking assignment RHS expression at the beginning of the assignment time.
2) Update the non-blocking assignment LHS expression at the end of the assignment time.

keep these eight points in mind at the time of writing to the vast majority of Verilog users to solve the 90-100% risk competition problem in the integrated post-simulation.

1 "when the sequential circuit is modeled, it is assigned with a non-blocking value.
2 "When the latch circuit is modeled, it is assigned with a non-blocking value.
4) use non-blocking assignment when establishing timing and combinational logic circuits in the same always block.
6) do not assign a value to the same variable in more than one always block.
8) do not use #0 delay when assigning


Recommend this blog
Http://www.cnblogs.com/layup/archive/2013/05/14/3078605.html

Verilog blocking assignment and non-blocking assignment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.