Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Verilog Assignment with condition

Status
Not open for further replies.

beginner_EDA

Full Member level 4
Joined
Aug 14, 2013
Messages
191
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Activity points
3,854

Code Verilog - [expand]
1
2
3
4
5
6
7
8
always @(posedge clk) begin
 
    x<=1'b1;     //  First Assignment
      if (y) begin    //some condition met
        x <= 1'b1;  // Second Assignment
      end
 
end



I would like to know in above code when also condition met which assignment will be executed although both assignments are same? First Assignment or Second Assignment?
 

It doesn't matter that both assigments are identical. Only the second assignment is used if the condition "y" is true.
 

If there is clear execution ordering of a set of nonblocking assignments, the order of the resulting updates to the LHS are preserved. So the second assignment overrides the first.

In synthesis, the conditional statement would be optimized away as it has no impact on the result.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top