Question: You are given two code snippets ( a and b ) below that perform the same operations to its internal signals, based on an input

You are given two code snippets (a and b) below that perform the same
operations to its internal signals, based on an input signal inp. What is
the difference (if any) in the digital circuit generated by these snippets?
[5 marks]
code a
1 always @ () begin
2 d a t a s t = i n p +3 ;
3 l o o p v a r = d a t a s t +2 ;
4 l o o p e n d =( l o o p v a r >20)?1 b1
: 1 b0 ;
5 end
code b
1 always @ ( posedge c l k ) begin
2 d a t a s t <= i n p +3 ;
3 l o o p v a r <= d a t a s t +2 ;
4 l o o p e n d <=( l o o p v a r >20)?
1 b1 : 1 b0 ;
5 end
Page 3 of 9
Trinity

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!