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.

[VMM:QUESTION] What's the difference with peek and get?

Status
Not open for further replies.

cnspy

Full Member level 3
Joined
Sep 10, 2002
Messages
151
Helped
5
Reputation
10
Reaction score
1
Trophy points
1,298
Activity points
1,041
try_get vmm

Hi, what's the difference between peek and get of vmm_channel?

I try to use the code like this:

in_chan.peek(tran_data);
do_read(tran_data);
in_chan.get(tran_data);

It works.

But if I try it like this:
in_chan.get(tran_data);
do_read(tran_data);

I think the simulation was blocked. So I don't know why.
 

telantan

Newbie level 6
Joined
Sep 19, 2006
Messages
12
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
1,333
difference between channel get and peek

in_chan.peek(tran_data);
get a copy of tran_data,the original tran_data still stays in channel

in_chan.get(tran_data);
get the tran_data out from channel and the channel is empty now
 

cnspy

Full Member level 3
Joined
Sep 10, 2002
Messages
151
Helped
5
Reputation
10
Reaction score
1
Trophy points
1,298
Activity points
1,041
peek + channel + vmm

Thanks telantan:

But I think the difference is only the data is move out from the channel or not. Why the simulation will be blocked when using the in_chan.get() only?

Does the get() will copy the data to tran_data?
 

vishalvartak

Newbie level 4
Joined
Sep 3, 2007
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,316
channel peek in vmm

In case, tere is only one data in the channel. Get takes it out from the channel. So nothing remains in the channel. Now get is a blocking task. It will be blocked till another data arrives in teh channel. There would be some non-blocking task as well (Something like can_get or some other name). This non-blocking task will not be blocked in case there is no data in the channel
 

vinod_cheedella

Junior Member level 1
Joined
Feb 23, 2007
Messages
16
Helped
4
Reputation
8
Reaction score
0
Trophy points
1,281
Activity points
1,393
blocking get in vmm_channel

.get() will take out the data from the channe,
.peek() will just take the copy of the data,

both the tasks are blocking,
stops simulation unless the channel is again having atleast one data member.

if the channel is empty, and if you are doing .get() on that, obviously simulation will be blocked.

there are non_blocking tasks try_get() and try_peek() which works like get() and peek(), but does't blocks the simulation, if the channel is empty,
simply they returns '0' and continues the simulation further...
 

cnspy

Full Member level 3
Joined
Sep 10, 2002
Messages
151
Helped
5
Reputation
10
Reaction score
1
Trophy points
1,298
Activity points
1,041
how to stop a blocking get vmm

Thanks vishalvartak and vinod_cheedella:

I got where I make the mistake.

Now I have another question. In the program block, I have run the env.run() and I triggered the env.end_test. But the simulation does not stop.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top