Jump to content

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: 


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 ?




Link to comment
Share on other sites


"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.


Link to comment
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.




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.




Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...