Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

What is the difference between x=#5 y and #5 x=y in Verilog?

Status
Not open for further replies.

vikadik

Member level 4
Joined
Dec 3, 2004
Messages
77
Helped
8
Reputation
16
Reaction score
4
Trophy points
1,288
Activity points
593
verilog question

Hi,

what is the difference between x=#5 y and #5 x=y

thanks
 

ami

Member level 3
Joined
Apr 28, 2005
Messages
62
Helped
4
Reputation
8
Reaction score
0
Trophy points
1,286
Location
VN
Activity points
1,952
Re: verilog question

Please see these examples:
1.
Code:
Sum = (A^B)^C;
#4 T= A & C;
The delay in the seccond statement specifies that the execution of the assignment is to be delayed by 4 time units. That is, after the first statement executes, wait for 4 time units, and then execute the seccond assignment.
2.
Code:
Sum = #3 (A^B)^C;
The delay in this asisgnment means that the value of the right-hand side expression is to be computed first, wait for 3 time units, ant then assign the value to the Sum.

Hope this help,
Rgrds
 

    vikadik

    Points: 2
    Helpful Answer Positive Rating

snake_eyes

Member level 3
Joined
May 16, 2002
Messages
56
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
307
Re: verilog question

Good explaination!
Also, these two types are defined to simulate trasitional & inertial delays in digital circuits.

Tejas
 

visualart

Advanced Member level 1
Joined
Dec 21, 2001
Messages
467
Helped
28
Reputation
56
Reaction score
4
Trophy points
1,298
Activity points
3,337
verilog question

recommand to write the #5 x=y ,seconad statement in your design, is is more fitable the fact.
 

vikadik

Member level 4
Joined
Dec 3, 2004
Messages
77
Helped
8
Reputation
16
Reaction score
4
Trophy points
1,288
Activity points
593
Re: verilog question

Thank you AMI, wonderfully explained. It is one of the common test in an interview
 

kelvin_bao

Junior Member level 2
Joined
Sep 14, 2004
Messages
22
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
163
verilog question

I think the #5 a=b is usually used in the behavior model,is it right?
 

haytham

Full Member level 4
Joined
Jun 6, 2004
Messages
229
Helped
16
Reputation
32
Reaction score
2
Trophy points
1,298
Activity points
1,365
Re: verilog question

Hi
I think both will give the same effect finally
but we always use the 1st one

Thanks
Haytham

Added after 3 hours 8 minutes:

Mistake found

Sorry
We always use the 2nd one
 

bangash

Member level 5
Joined
Apr 1, 2006
Messages
83
Helped
6
Reputation
12
Reaction score
2
Trophy points
1,288
Location
London
Activity points
1,770
verilog question

second shows the delay between execution of two statements
while
first shows that when y is computed, there shouild be delay before the assignment is done to x
 

funster

Full Member level 4
Joined
Jun 30, 2005
Messages
233
Helped
19
Reputation
38
Reaction score
4
Trophy points
1,298
Activity points
2,742
Re: verilog question

x = #5 y is delay y current value by 5, then assign to x

#5 x = y is delay 5 firstly, then assign y value to x

best regards




vikadik said:
Hi,

what is the difference between x=#5 y and #5 x=y

thanks
 

stevepre

Member level 4
Joined
May 10, 2001
Messages
78
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
595
Re: verilog question

for example, at time 4, y changes from 0 to 3

for "x = #5 y", at time 5, x gets the value of y at time 0, so at time 5, x becomes 0

for "#5 x = y", at time 5, x gets teh value of y at time 5, so at time 5, x becomes 3
 

beta0

Member level 5
Joined
Nov 24, 2003
Messages
88
Helped
7
Reputation
14
Reaction score
2
Trophy points
1,288
Activity points
393
Re: verilog question

vikadik said:
Hi,

what is the difference between x=#5 y and #5 x=y

thanks
Interesting question, why not you try it in your verilog simulator ,
then you'll find the interesting ans.:D
 

mvkarthik

Newbie level 4
Joined
May 10, 2006
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,321
Re: verilog question

Hi,

This is just a classic example of inter-segment and intra-segment delay statements.

Thanks,
-Karthik
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top