

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Answer: Yes, (1) The verilog race condition occurs in this module. (2) a and b should be declared as Reg. (b) What would be the final result after execution of this program(*for all the possible cases)? Module abc(a,b,clk,rst); Input clk,rst; output a,b; always @(posedge clk or rst) if(rst) a=0; else a=b; always @(posedge clk or rst) if(rst) b=1; else b=a; endmodule Answer: If first always block executes first after the reset, the value of both a and b will be โ1โ. If second always block executes first the value of both a and b will be โ0โ. Q2: Code a logical unit performing AND,OR,XOR,NOT of two (8โbit) numbers according to the user requirement. Use behavioral modeling. Answer: Done in lab.
Answer: There is no race condition in this module, the only problem is that a and b should be declared as reg. (b) What would be the final result after execution of this program(*for all the possible cases)? Module abc(a,b,clk,rst) Input clk,rst; output a,b; always @(posedge clk or rst) if(rst) a<=1; else a<=b; always @(posedge clk or rst) if(rst) b<=0; else b<=a; endmodule Answer: after reset, in any case the values will be a=0, b= Q2: Code an arithmetic unit performing increment, decrement, and sum of two (4โbit) numbers according to the user requirement. Use behavioral modeling. Answer: Done in lab.