Docsity

Module-Digital System Design-Quiz, Exercises of Digital Systems Design

Toggle sidebar
bg1
Digital๎˜ƒSystem๎˜ƒDesign๎˜ƒ
Quiz๎˜ƒ(A)๎˜ƒ
Q1:๎˜ƒ(a)๎˜ƒIs๎˜ƒthere๎˜ƒany๎˜ƒproblem๎˜ƒin๎˜ƒthis๎˜ƒmodule?๎˜ƒIf๎˜ƒyes,๎˜ƒmention๎˜ƒit.๎˜ƒ
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.๎˜ƒ
docsity.com
pf3

Partial preview of the text

Download Module-Digital System Design-Quiz and more Exercises Digital Systems Design in PDF only on Docsity!

Digital System Design

Quiz (A)

Q1: (a) Is there any problem in this module? If yes, mention it.

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.

Digital System Design

Quiz (B)

Q1: (a) Is there any problem in this module? If yes, mention it.

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.