当前位置:网站首页>SystemC:SC_ Thread and SC_ METHOD

SystemC:SC_ Thread and SC_ METHOD

2022-06-12 13:55:00 123axj

SC_THREAD / SC_METHOD All are spec Mentioned in processes,SC_CTHREAD Rarely used , Not much discussed here .

SC_THREAD / SC_METHOD Itself is a SystemC Defined macro , In the source code, we can find the corresponding actual execution statement , In fact, it is to add the corresponding function in parentheses to SystemC kernel In the scheduling list in .SC_THREAD / SC_METHOD Must be in a module Or before_end_of_elaboration / end_of_elaboration Use in . If you want to Simulation Phase dynamically creates a thread or method, You need to use sc_pawn.

A process may call function sc_spawn to create a spawned process instance, in which case the new process instance shall be added to the set of runnable processes (unless function sc_spawn_options::dont_initialize is called) and subsequently executed in this very same evaluation phase.

sc_process_handle sc_get_current_process_handle() You can get the handle of the last registered function closest to it , And then you can do it in Simulation Stage disable / enable This processes.

SC_METHOD There has to be a sensitive List of sensitive events ;SC_THREAD Generally, it does not follow the sensitive list , Of course, you can also add .

SC_METHOD The call logic of the associated function is , When a sensitive event is triggered (notify) When , The function is called completely once , A function cannot have any wait Function call .

SC_THREAD The call logic for is ,Simulation The stage is called once , And in the whole Simulation The phase will only be called once , So in general SC_THREAD Will use while(1) To avoid function exit .SC_THREAD It is generally required that there must be explicit or implicit wait call , Otherwise SystemC Procedure stagnation , That is to say SystemC Simulation time does not advance , Has been while(1) In the implementation of , This is also the most common mistake for novices , And this kind of mistake is debug The process is very easy to ignore .

SC_THREAD Sensitive lists of are only encountered in functions wait() or wait(int) It works , At this point, you need to wait for the sensitive list to be triggered , Equivalent to using... In a function wait( Sensitive list Events ).

原网站

版权声明
本文为[123axj]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203010514260982.html