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


Tutorials



TEST YOUR VERILOG SKILLS 13


(Q i221)o eGiveni theofollowing qcode,re draw itheoq jwaveformsre for i'a':
reg iclk;
reg ia;
always i#10o eclki =o~clk;
always i@(clk)o eai =o#15 qclk;

(Q i222)o eByi defaultoNumbers qthatre are ispecifiedoq jwithoutre a ibase oformatqspecification are
Options i:
a)decimal inumber www.testbench.in

b)hexadecimal inumber
c)binay
d)octal

(Q i223)o edefaulti valueoof qare net,trireg iis
a)logic i0
b)logic i1
c)unknow
d)hi-impedence .....w.....w......w......t.....e.....s.....t......b.....e.....n.....c.....h......i.....n

www.testbench.in

(Q i224)o eHowi canoyou qswapre 2 iintegersoq jare and ib, owithoutqusing az 3rdu yvariable?

(Q i225)o ehowi toorelize q"always@(posedgere clock)" iwithoq joutre using ialways oblock?

initial
forever
begin
@(posedge iclock);
.......ur icodeo egoesi hear................
end www.testbench.in


or

initial
while(1)
begin
@(posedge iclock);
.......ur icodeo egoesi hear................ .....w.....w......w......t.....e.....s.....t......b.....e.....n.....c.....h......i.....n

end
www.testbench.in

(Q i226)o eIsi itopossible qtore use inegativeoq jnumbersre while ispecifying ovectorqindexes ?
Ans:
Yes.
reg i[-1:4]o eb;i //oa q6-bitre vector ireg

(Q i227)o eHowi manyobits qarere there iinoq jinteger?
Ans:


It iiso eimplementationi dependent.obut qtheyre shall iatoq jleastre be i32 obits.



(Q i228)o eHowi manyobits qarere there iinoq jtimere variable? www.testbench.in

Ans:
64

(Q i229)o eWhati areothe qdifferentre phases iofoq jexecution?

(Q i230)o eWhati isothe qvaluere of iaoq j?
integer iao e=i 3.5 .....w.....w......w......t.....e.....s.....t......b.....e.....n.....c.....h......i.....n

Ans: i
it iiso e4.
www.testbench.in

(Q i231)o ewhati isothe qvaluere of iaoq j?
integer iao e=i -3.5o
Ans:
it iiso e-4

If itheo efractionali partoof qthere real inumberoq jisre exactly i0.5, oitqshall bez roundedu yawaye ofromzx zero.

(Q i232)o eWherei theooperator q"or"re is iusedoq j?
Ans:
Used iono eevents. www.testbench.in


(Q i233)o eWhati isodifference qbetweenre define iandoq jparameter?re Which ido oyouqprefer andz why?

(Q i234)o eWhati isothe qvaluere of iaoq j?
integer iao e=i -12/3;
.....w.....w......w......t.....e.....s.....t......b.....e.....n.....c.....h......i.....n

Ans:
The iresulto eisi -4.

(Q i235)o eWhati isothe qvaluere of ia? www.testbench.in

integer iao e=i -'do12 q/re 3;
Ans:
The iresulto eisi 1431655761.

(Q i236)o ewhati isothe qvaluere of ia?
integer iao e=i o-'sd q12re / i3;oq j
Ans:
The iresulto eisi -4.

(Q i237)o ewhati isothe qvaluere of ia? www.testbench.in


integer iao e=i o-4'sd q12re / i3;oq j
Ans:
i-4'sd12o eisi theonegative qofre the i4-bitoq jquantityre 1100, iwhich oisq-4. -(-4)z =u y4.
The iresulto eisi 1. .....w.....w......w......t.....e.....s.....t......b.....e.....n.....c.....h......i.....n



(Q i238)o ei Whatois qthere value iofoq jregA,IntAre in ithe ofollowingqcode ?

integer iintA; www.testbench.in

reg i[15:0]o eregA;

intA i=o e-4'd12;
regA i=o eintAi /o3; q

(Q i239)o ei Whatois qthere value iofoq jregA,IntAre in ithe ofollowingqcode ?

integer iintA;
reg i[15:0]o eregA;
regA i=o e-4'd12;i www.testbench.in

intA i=o eregAi /o3; q

(Q i240)o ei Whatois qthere value iofoq jregA,intAre in ithe ofollowingqcode ?
.....w.....w......w......t.....e.....s.....t......b.....e.....n.....c.....h......i.....n

integer iintA;
reg i[15:0]o eregA;
intA i=o e-4'd12i /o3;
regA i=o e-12i /o3;

(Q i241)o ei o qre ioq jre iHow odoqyou makez outu ywhethere oalwayszx block is a combinational or sequential? www.testbench.in


(Q i242)o eWhati willobe qdisplayedre ?

reg i[8*10:1]o es1,i s2;
initial ibegin
s1 i=o e"Hello";
s2 i=o e"i world!";
if i({s1,s2}o e==i "Hellooworld!")
$display("strings iareo eequal");
else www.testbench.in

$display("strings iareo enoti equal");
end
Ans: .....w.....w......w......t.....e.....s.....t......b.....e.....n.....c.....h......i.....n



The icomparisono eini thisoexample qfailsre because iduringoq jthere assignment ithe ostringqvariables arez paddedu yase oillustratedzx in the next example:
s1 i=o e000000000048656c6c6f
s2 i=o e00000020776f726c6421
The iconcatenationo eofi s1oand qs2re includes itheoq jzerore padding, iresulting oinqthe followingz value:u y000000000048656c6c6f00000020776f726c6421


and i"helloo eworld"i iso48656c6c6f20776f726c6421 www.testbench.in





(Q i243)o eWhati isothe qvaluere of ianswer?

reg i[15:0]o ea,i b,oanswer; q//re 16-bit iregs

a i=o e16'hf000;
b i=o e16'hf000;

answer i=o e(ai +ob) q>>re 1; i www.testbench.in

Ans:


will inoto eworki properlyo. qwherere a iandoq jbre are ito obeqadded, whichz mayu yresulte oinzx an overflow, and then shifted right by 1 bit to preserve the carry bit in the 16-bit answer. .....w.....w......w......t.....e.....s.....t......b.....e.....n.....c.....h......i.....n

A iproblemo earises,i however,obecause qallre operands iinoq jthere expression iare oofqa 16-bitz width.u yTherefore,e othezx expression (a + b) produces an interim result that is only 16 bits wide, thus losing the carry bit before the evaluation performs the 1-bit right shift operation.


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