468Lec20_SC_DynamicProcesses

H scmodulemodnm channel instances submodule instances

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ; //File: *.h SC_MODULE(mod_nm) { channel* instances submodule* instances SC_CTOR(); processes }; //File: *.cpp mod_nm::process() { …… } //File: *.cpp SC_HAS_PROCESS(mod_nm); Separation mod_nm::mod_nm() { constructor } mod_nm::process() { …… } ECEN 468 Lecture 20 More flexible 5 SystemC Time Resolution All objects of sc_time use a global time resolution Default 1 picosecond sc_time sc_get_time_resolution(); sc_set_time_resolution(double, sc_time_unit); //Change only once //before creating objects of sc_time and simulation ECEN 468 Lecture 20 6 Dynamic vs. Static Processes Static processes o SC_THREAD and SC_METHOD o Established in the elaboration phase Need for dynamic processes o Design verification Chapter 7, “SystemC: From the Ground Up” ECEN 468 Lecture 20 7 sc_spawn Use a pre-processor macro o #define SC_INCLUDE_DYNAMIC_PROCESSES Or, compile with option o -DSC_INCLUDE_DYNAMIC_PROCESSES Spawned process o Either a module member function or a global function o May have up to 8 arguments and a return value o Thread process by default Invoke spawned process using sc_spawn and sc_bind ECEN 468 Lecture 20 8 Example of sc_spawn class imodule: public sc_module { public: sc_signal clock_sig; SC_HAS_PROCESS(imodule); imodule(sc_module_name nm):sc_module(nm) { SC_THREAD(run); } void spawned_th(bool value) { cout << "spawned with value: " << value << endl; } void run() { sc_spawn( sc_bind(&imodule::spawned_...
View Full Document

This note was uploaded on 09/07/2012 for the course ECEN 468 taught by Professor Jianghu during the Spring '08 term at Texas A&M.

Ask a homework question - tutors are online