Forum Discussion
Altera_Forum
Honored Contributor
14 years agoTrying to make sense of this always block
Hi, So I wanted to take an input and decrement it in a combinational block.. here is the code I am talking about.. always @ (posedge clock or posedge reset)
begin
if (reset)
...
Altera_Forum
Honored Contributor
14 years agoThanks for the helpful responses.
--- Quote Start --- So first, n_next gets assigned the value of "i" but that doesn't matter because the if statement is false so n_next gets the value of n-1. --- Quote End --- However I did not understand this.. How does it not matter as the value is assigned before the if statement.. need some clarification here please. --- Quote Start --- The behavior you mentioned is what I would expect... I think I never write combinational code in always statements like that. To me this would be much easier to understand ... --- Quote End --- Im familiar with this but with these statements I get confused with nested if's.. Thanks