Altera_Forum
Honored Contributor
9 years agobasic always block question
I have questions about always blocks. Both will use the following always block for context:
always @ (posedge Clk)
begin
if (x1)
q <= 1;
else if (x2)
q <= 0;
else
q <= q;
end
where q, x1 and x2 are all 1 bit wide. Would this code 'prioritize' checking x1 before x2? What would happen if x1 and x2 were both high? How exactly would it synthesize? Also, if I want q to retain it's value, is it necessary for me to explicitly code that in the form of q <= q? or is there another way? Thanks