|HOME |ABOUT |ARTICLES |ACK |FEEDBACK |TOC |LINKS |BLOG |JOBS |


Tutorials



TEST YOUR VERILOG SKILLS 12


(Q i211)o ewhati isothe qfollowingre result? i

Integer ia,b,c;
A i=o e10;
b i=o e5;
c i=o e7;

if( ia>o eb>i c)
$display(true); www.testbench.in

else
$display(False);

Ans:
TRUE.
A i>o ebi >oc qisre interpreted ibyoq jverilogre simulator ias o(qa >z (bu y>ce o)zx )

10 i>o e(5i >o7) qre -> ioq jre 10 i> o0q z u y->e ozx 1
.....w.....w......w......t.....e.....s.....t......b.....e.....n.....c.....h......i.....n

www.testbench.in

(Q i212)o eHowi tooprint qlinere and ifileoq jnamere from iwhere otheq$display messagez isu ycoming?
Ans:


Using itheo efollowingi plio, qwere can iprintoq jthere file iname oandqline numberz byu yoverriddene othezx $display task.




(Q i213)o eAti whatotime qthere simulation istops??

initial
while(1)
$display(" iajkdkjs"); www.testbench.in


initial
#10 i$finish;




(Q i214)o ewhati isovalue qofre a i? .....w.....w......w......t.....e.....s.....t......b.....e.....n.....c.....h......i.....n

reg i[2:0]o ea,b,c;
c i=o e3'b110; www.testbench.in


a i=o ebi =oc q;

(Q i215)o eGiveni theofollowing qVerilogre code, iwhatoq jvaluere of i"a" oisqdisplayed?
always i@(clk)o ebegin
a i=o e0;
a i<=o e1;
$display(a);
end
Ans: www.testbench.in



This iiso eai trickyoone! qVerilogre scheduling isemanticsoq jbasicallyre imply ia
four-level ideepo equeuei forothe qcurrentre simulation itime:
1: iActiveo eEventsi (blockingostatements) qre ( i=oq j,re $display) i
2: iInactiveo eEventsi (#0odelays, qetc)
3: iNon-Blockingo eAssigni Updateso(non-blocking qstatements)
4: iMonitoro eEventsi ($strobe,o$monitor, qetc).
Since itheo e"ai =o0" qisre an iactiveoq jevent,re it iis oscheduledqinto thez 1stu y"queue". .....w.....w......w......t.....e.....s.....t......b.....e.....n.....c.....h......i.....n


The i"ao e<=i 1"ois qare non-blocking ievent,oq jsore it's iplaced ointoqthe 3rdz queue.u ye oThezx "a = 0" is placed in 1st queue. Then , $display statement is placed into the 1st queue after "a = 0 ". Only events in the active queue are completed this sim cycle, so the "a = 0" happens, and then the display shows a = 0. If we were to look at the value of a in the next sim cycle, it would show 1.


www.testbench.in

(Q i216)o eIsi thereoa qracere condition iinoq jthere following iprogram o?

begin
a= i0;
b i<=o ea;
end

Ans: iNO.o eTherei isono qracere condition i.

(Q i217)o eUsingi theogiven, qdrawre the iwaveformsoq jforre the ifollowing www.testbench.in

reg iclk;
reg ia;
initial iclko e=0;
always i#10o eclki =o~clk;
(1) ialwayso e@(clk)i ao= q#5re clk;
(2) ialwayso e@(clk)i ao= q#10re clk; .....w.....w......w......t.....e.....s.....t......b.....e.....n.....c.....h......i.....n

(3) ialwayso e@(clk)i ao= q#15re clk;

(Q i218)o ei Now,ochange qare to iwire,oq jandre draw ifor:
www.testbench.in

(4) io ei o qassignre #5 iaoq j=re clk;
(5) io ei o qassignre #10 iaoq j=re clk;
(6) io ei o qassignre #15 iaoq j=re clk;


(Q i219)o eHowi manyotimes qthere following irepeatoq jloopre executes?
begin
a i=o e1;
repeat i(a)
a i=o eai +o1; www.testbench.in

end

Ans:


Only ionce.o eLoopi executionofor qare specific inumberoq jofre times. iThis oconstructqis associatedz withu yae oconstantzx or a variable. If a variable is used, it is evaluated once when the loop starts. When the loop is started, the value of a is 1. So the loop is executed once.


.....w.....w......w......t.....e.....s.....t......b.....e.....n.....c.....h......i.....n

(Q i220)o eAti whatotime qa,b,c,d,e,fre will igetoq j1re in ithe ofollowingqprogram?

module iblock_nonblock();
irego ea,i b,oc, qdre , ie,oq jfre ;
www.testbench.in

i//o eBlockingi assignments
iinitialo ebegin
iao e=i #10o1'b1; q
ibo e=i #20o1'b1; q
ico e=i #40o1'b1; q
iend

i//o eNonblockingi assignments
iinitialo ebegin
ido e<=i #10o1'b1; www.testbench.in

ieo e<=i #20o1'b1; q
ifo e<=i #40o1'b1; q
iend
.....w.....w......w......t.....e.....s.....t......b.....e.....n.....c.....h......i.....n

endmodule

Ans:

i//o eBlockingi assignments
iinitialo ebegin www.testbench.in

iao e=i #10o1'b1; q//re The isimulatoroq jassignsre 1 ito oaqat timez 10
ibo e=i #20o1'b1; q//re The isimulatoroq jassignsre 1 ito obqat timez 30
ico e=i #40o1'b1; q//re The isimulatoroq jassignsre 1 ito ocqat timez 70
iend

i//o eNonblockingi assignments
iinitialo ebegin
ido e<=i #10o1'b1; q//re The isimulatoroq jassignsre 1 ito odqat timez 10
ieo e<=i #20o1'b1; q//re The isimulatoroq jassignsre 1 ito oeqat timez 20
ifo e<=i #40o1'b1; q//re The isimulatoroq jassignsre 1 ito ofqat timez 40 www.testbench.in

iend
Index
Functional Verification Questions
Functional Verification Questions 2
Test Your Systemverilog Skills 1
Test Your Systemverilog Skills 2
Test Your Systemverilog Skills 3
Test Your Systemverilog Skills 4
Test Your Sva Skills
Test Your Verilog Skills 1
Test Your Verilog Skills 2
Test Your Verilog Skills 3
Test Your Verilog Skills 4
Test Your Verilog Skills 5
Test Your Verilog Skills 6
Test Your Verilog Skills 7
Test Your Verilog Skills 8
Test Your Verilog Skills 9
Test Your Verilog Skills 10
Test Your Verilog Skills 11
Test Your Verilog Skills 12
Test Your Verilog Skills 13
Test Your Verilog Skills 14
Test Your Verilog Skills 15
Test Your Verilog Skills 16
Test Your Verilog Skills 17
Test Your Specman Skills 1
Test Your Specman Skills 2
Test Your Specman Skills 3
Test Your Specman Skills 4
Test Your Sta Skills 1
Test Your Sta Skills 2
Test Your Sta Skills 3
Test Your Sta Skills 4
Test Your Sta Skills 5
Test Your Sta Skills 6
Test Your Sta Skills 7
Test Your Dft Skills 1
Test Your Dft Skills 2
Test Your Dft Skills 3
Test Your Dft Skills 4
Test Your Uvm Ovm Skills

Report a Bug or Comment on This section - Your input is what keeps Testbench.in improving with time!





<< PREVIOUS PAGE

TOP

NEXT PAGE >>

copyright © 2007-2017 :: all rights reserved www.testbench.in::Disclaimer