Jump to content
Sign in to follow this  
karandeep963

sc_signal v/s sc_buffer

Recommended Posts

Hello All,

 

It would be really appreciable if anyone could authenticate my learning on difference of sc_signal and sc_buffer?

 

I have found many differences mentioned below , please check and add if I could have missed any important one:

 

1. sc_buffer does not support the specialization supported for sc_signal: 

like

sensitive << signame.posedge_event();

wait << signame.posedge_event();

 

2. sc_buffer does'nt used for sensitivity of process.

 

3. There is difference of evaluate-update phase of sc_buffer to that of sc_signal? if yes, whats that please elaborate.

 

4. sc_signal would only generate update request to scheduler in case of different value needs to be updated , while sc_buffer generates the request all the time if even is the same value is written again on it.

 

Please confirm the above and relevant contents.

 

other queries: 

Qa: what is significance of sc_buffer?

Qb: "sensitive << signame.posedge_event()" , does it mean that the respective process would be sensitive to posedge of signal ? or if something different then what does .posedge_event(); meant for ?

 

Regards,

KS 

Share this post


Link to post
Share on other sites

Hello,

"sensitive" indicates that the thread will always respond to any

changes in the data coming in via a specified port. Note the word

"any". You could restrict what changes the thread would respond

to, e.g., to the positive edge of the signal, by specifying :

"sensitive << <signal_name>.pos();"

As for the other points that you wish to clarify/verify, please

create small examples, compile and run them and see what the

output is, or what the error messages are. This will be the best

way to get a grip on how things work internally. Hope that helps.

 

Share this post


Link to post
Share on other sites

Hi Karandeep,

  sc_buffer is  a derived class of sc_signal, so it supports all of sc_signal's features. The only difference is that the write() method of sc_buffer creates an event even if the buffer hasn't changed (your point 4).

 

As the only change is to override the write() method, I thought you'd still get the correct behaviour in specialisations of the sc_signal class (e.g. sc_signal<sc_logic>, sc_signal(bool)) - but perhaps I should check.

 

Regarding some of your examples

pos() returns an event finder and should only be used on ports e.g. sc_in, sc_inout. It is used only in sensitivity.

 

posedge_event() returns an sc_event, and may be used in wait, e.g.

 

wait(sig.posedge_event());

 

It may also be used in a sensitivity, but only for an instance of sc_signal, not sc_in/inout.

 

posedge() returns a bool and may be used inside a process to see if a signal triggered your process. It should not be used for sensitivity or wait, as it's just a value, not an event.

 

regards

Alan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×