SlideShare a Scribd company logo
1 of 15
SC_MODULE Using
SC_THREAD/SC_METHOD
林敬倫, 蘇文鈺
成大資訊
2010/11
Implementing Modules
• SC_MODULE():
– the smallest container of functionality with states,
behavior and structure
– It may contains
•
•
•
•
•
•
•

Ports
Member channel instance
Member data instance
Member module instance
Constructor
Destructor
Process member function
SystemC Processes
• SC_THREAD:
–
–
–
–
–

similar to software thread
It gains control from the system until it returns it to simulator.
called only once and return
can suspend itself using wait().
Blocked because of blocking operation such as read/write

• Sc_method:
–
–
–
–
–
–

Simpler and more efficient
Run completely and return
Cannot suspend internally
Called by the simulation kernel repeatedly based on sensitivity.
Similar to always@ in Verilog.
Implied waits can be implemented by calling SystemC built-in blocking
methods such as read and write of sc_fifo.
2 Ways to Register and Initialize a
Process
• SC_CTOR:
– C++ uses constructor before the process method.
– In the constructor, the methods of implementing the
process is defined.

• SC_HAS_PROCESS:
– It is a cpp macro.
– It is usually used when one wants to place the
constructor in the implementation.
– Use arguments to specify the specifications of models.
– If you are making an IP, this is the better way to do.
Jobs of SC_CTOR/SC_HAS_PROCESS
•
•
•
•
•

Initialization of its sub-modules
Build connections among sub-modules
Registering processes to simulation kernel
Provide sensitivities
Others
A Simple Example
• Helloworld的範例程式.
– 第一個用SC_CTOR
– 第二個用SC_HAS_PROCESS, 這一個請將
constructor寫在.cpp裡面.

• 其中包含兩個Module, 一個印Hello, 一個印
World. 前一支用sc_thread, 後一支用
sc_method.
• 這是在講concurrency與channel時所使用的
簡單程式, 請參照之後的章節.
SC_CTOR example
Main.cpp
#include <systemc.h>
#include "hello_module.h"
#include "method.h"

Hello_module.h
#include <systemc.h>

int sc_main(int argc, char* argv[])
SC_MODULE(hello_module)
{
{
// signal declaration
// signal declaration
sc_clock
clk("clk", 10, SC_NS, 0.5);
sc_in_clk
clk;
// module declaration
hello_module
module0("hello_word");
method
module1("method");

//Constructor
SC_CTOR(hello_module) {
SC_THREAD(thread_func);
sensitive << clk.pos();
}

// signal connection
module0.clk(clk);
module1.clk(clk);

// run simulation
sc_start(1000, SC_NS);
return 0;
}

// fuction declaration
void thread_func();

};
SC_CTOR example
Hello_module.cpp
#include "hello_module.h"
void hello_module::thread_func()
{
while(1){
wait();
printf(" Word! n");
}
}
Method.cpp

Method.h
#include <systemc.h>
SC_MODULE(method)
{
// signal declaration
sc_in_clk
clk;
// fuction declaration
void method_func();
//Constructor
SC_CTOR(method) {
SC_METHOD(method_func);
sensitive << clk.pos();
}

#include "method.h"
void method::method_func()
{
if(clk){
sc_time_stamp().print();
printf(" Hello! ");
}
}

};
SC_HAS_PROCESS example
Main.cpp
#include <systemc.h>
#include "hello_module.h"
#include "method.h"

Hello_module.h
#include <systemc.h>

SC_MODULE(hello_module)
int sc_main(int argc, char* argv[])
{
{
// signal declaration
// signal declaration
sc_in_clk
clk;
sc_clock
clk("clk", 10, SC_NS, 0.5);
// module declaration
hello_module
module0("hello_word");
method
module1("method");
// signal connection
module0.clk(clk);
module1.clk(clk);
// run simulation
sc_start(1000, SC_NS);
return 0;

}

// fuction declaration
void thread_func();
//Constructor declaration
hello_module(sc_module_name);

};
SC_HAS_PROCESS example
Hello_module.cpp
#include "hello_module.h"

Method.h
#include <systemc.h>

//Constructor
hello_module::hello_module(sc_module_name nm)
: sc_module(nm)
{
//using SC_HAS_PROCESS replace SC_CTOR
SC_HAS_PROCESS(hello_module);
SC_THREAD(thread_func);
sensitive << clk.pos();
}

SC_MODULE(method)
{
// signal declaration
sc_in_clk
clk;

void hello_module::thread_func()
{
while(1){
wait();
printf(" Word! n");
}
}

};

// fuction declaration
void method_func();
//Constructor declaration
method(sc_module_name);
SC_HAS_PROCESS example
Method.cpp
#include "method.h"
//Constructor
method::method(sc_module_name nm) : sc_module(nm)
{
//using SC_HAS_PROCESS replace SC_CTOR
SC_HAS_PROCESS(method);
SC_METHOD(method_func);
sensitive << clk.pos();
}
void method::method_func()
{
if(clk){
sc_time_stamp().print();
printf(" Hello! ");
}
}
Summarized Template For System
Design with SystemC
• pseudo code of templates for:
– Sc_main.cpp
– Module.h
– Module.cpp.
• SC_CTOR;
• SC_HAS_PROCESS.
Main.cpp
#include <systemc.h>
#include “module_name.h”
int sc_main(){
Port/Signal declarations
module declarations
modules linked
sc_start(); /sc_start(time);
return 0;
}
Module.h
SC_CTOR
#ifndef NAME_H
#define NAME_H
#include "submodule.h"
SC_MODULE(NAME) {
Port declarations
Channel/submodule instances
SC_CTOR(NAME)
: Initializations
{
Connectivity
Process registrations
}
Process declarations
Helper declarations
};
#endif

SC_HAS_PROCESS
#ifndef NAME_H
#define NAME_H
#include "submodule.h"
SC_MODULE(NAME) {
Port declarations
Channel/submodule instances
// Constructor declaration:
NAME();
Process declarations
Helper declarations
};
#endif
Module.cpp
SC_CTOR
#include <systemc.h>
#include "NAME.h"
NAME::Process {implementations }
NAME::Helper {implementations }

SC_HAS_PROCESS
#include <systemc.h>
#include "NAME.h"
NAME::NAME(sc_module_name nm)
: sc_module(nm)
, Initializations
{
Channel allocations
Submodule allocations
Connectivity
SC_HAS_PROCESS(NAME);
Process registrations
}
NAME::Process {implementations }
NAME::Helper {implementations }

More Related Content

What's hot

Session 7 code_functional_coverage
Session 7 code_functional_coverageSession 7 code_functional_coverage
Session 7 code_functional_coverageNirav Desai
 
Design Verification Using SystemC
Design Verification Using SystemCDesign Verification Using SystemC
Design Verification Using SystemCDVClub
 
UVM Methodology Tutorial
UVM Methodology TutorialUVM Methodology Tutorial
UVM Methodology TutorialArrow Devices
 
Session 9 advance_verification_features
Session 9 advance_verification_featuresSession 9 advance_verification_features
Session 9 advance_verification_featuresNirav Desai
 
Passes of compilers
Passes of compilersPasses of compilers
Passes of compilersVairavel C
 
System verilog assertions
System verilog assertionsSystem verilog assertions
System verilog assertionsHARINATH REDDY
 
Design & Check Cyclic Redundancy Code using VERILOG HDL
Design & Check Cyclic Redundancy Code using VERILOG HDLDesign & Check Cyclic Redundancy Code using VERILOG HDL
Design & Check Cyclic Redundancy Code using VERILOG HDLijsrd.com
 
How to Connect SystemVerilog with Octave
How to Connect SystemVerilog with OctaveHow to Connect SystemVerilog with Octave
How to Connect SystemVerilog with OctaveAmiq Consulting
 
System verilog coverage
System verilog coverageSystem verilog coverage
System verilog coveragePushpa Yakkala
 
Digital Design With Systemc (with notes)
Digital Design With Systemc (with notes)Digital Design With Systemc (with notes)
Digital Design With Systemc (with notes)Marc Engels
 
Introduction to embedded system design
Introduction to embedded system designIntroduction to embedded system design
Introduction to embedded system designMukesh Bansal
 
Formal Verification - Formality.pdf
Formal Verification - Formality.pdfFormal Verification - Formality.pdf
Formal Verification - Formality.pdfAhmed Abdelazeem
 
Slideshare - PCIe
Slideshare - PCIeSlideshare - PCIe
Slideshare - PCIeJin Wu
 
System On Chip (SOC)
System On Chip (SOC)System On Chip (SOC)
System On Chip (SOC)Shivam Gupta
 
SystemVerilog OOP Ovm Features Summary
SystemVerilog OOP Ovm Features SummarySystemVerilog OOP Ovm Features Summary
SystemVerilog OOP Ovm Features SummaryAmal Khailtash
 

What's hot (20)

Session 7 code_functional_coverage
Session 7 code_functional_coverageSession 7 code_functional_coverage
Session 7 code_functional_coverage
 
Design Verification Using SystemC
Design Verification Using SystemCDesign Verification Using SystemC
Design Verification Using SystemC
 
UVM Methodology Tutorial
UVM Methodology TutorialUVM Methodology Tutorial
UVM Methodology Tutorial
 
Session 9 advance_verification_features
Session 9 advance_verification_featuresSession 9 advance_verification_features
Session 9 advance_verification_features
 
Passes of compilers
Passes of compilersPasses of compilers
Passes of compilers
 
System verilog assertions
System verilog assertionsSystem verilog assertions
System verilog assertions
 
Design & Check Cyclic Redundancy Code using VERILOG HDL
Design & Check Cyclic Redundancy Code using VERILOG HDLDesign & Check Cyclic Redundancy Code using VERILOG HDL
Design & Check Cyclic Redundancy Code using VERILOG HDL
 
How to Connect SystemVerilog with Octave
How to Connect SystemVerilog with OctaveHow to Connect SystemVerilog with Octave
How to Connect SystemVerilog with Octave
 
System verilog coverage
System verilog coverageSystem verilog coverage
System verilog coverage
 
Digital Design With Systemc (with notes)
Digital Design With Systemc (with notes)Digital Design With Systemc (with notes)
Digital Design With Systemc (with notes)
 
Embedded C programming session10
Embedded C programming  session10Embedded C programming  session10
Embedded C programming session10
 
Ovm vs-uvm
Ovm vs-uvmOvm vs-uvm
Ovm vs-uvm
 
Introduction to embedded system design
Introduction to embedded system designIntroduction to embedded system design
Introduction to embedded system design
 
Formal Verification - Formality.pdf
Formal Verification - Formality.pdfFormal Verification - Formality.pdf
Formal Verification - Formality.pdf
 
Slideshare - PCIe
Slideshare - PCIeSlideshare - PCIe
Slideshare - PCIe
 
PCIe DL_layer_3.0.1 (1)
PCIe DL_layer_3.0.1 (1)PCIe DL_layer_3.0.1 (1)
PCIe DL_layer_3.0.1 (1)
 
Microcontroller part 1
Microcontroller part 1Microcontroller part 1
Microcontroller part 1
 
System On Chip (SOC)
System On Chip (SOC)System On Chip (SOC)
System On Chip (SOC)
 
SystemVerilog OOP Ovm Features Summary
SystemVerilog OOP Ovm Features SummarySystemVerilog OOP Ovm Features Summary
SystemVerilog OOP Ovm Features Summary
 
The IEEE 1149.1 Boundary-scan test standard
The IEEE 1149.1 Boundary-scan test standardThe IEEE 1149.1 Boundary-scan test standard
The IEEE 1149.1 Boundary-scan test standard
 

Viewers also liked

Concurrency 2010
Concurrency 2010Concurrency 2010
Concurrency 2010敬倫 林
 
Systemc overview 2010
Systemc overview 2010Systemc overview 2010
Systemc overview 2010敬倫 林
 
C++ process new
C++ process newC++ process new
C++ process new敬倫 林
 
Week1 Electronic System-level ESL Design and SystemC Begin
Week1 Electronic System-level ESL Design and SystemC BeginWeek1 Electronic System-level ESL Design and SystemC Begin
Week1 Electronic System-level ESL Design and SystemC Begin敬倫 林
 
Transaction level modeling an overview
Transaction level modeling an overviewTransaction level modeling an overview
Transaction level modeling an overviewfagunp
 
Track c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eveTrack c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -evechiportal
 
Top five reasons why every DV engineer will love the latest systemverilog 201...
Top five reasons why every DV engineer will love the latest systemverilog 201...Top five reasons why every DV engineer will love the latest systemverilog 201...
Top five reasons why every DV engineer will love the latest systemverilog 201...Srinivasan Venkataramanan
 
A Systematic Approach to Creating Behavioral Models (white paper) v1.0
A Systematic Approach to Creating Behavioral Models (white paper) v1.0A Systematic Approach to Creating Behavioral Models (white paper) v1.0
A Systematic Approach to Creating Behavioral Models (white paper) v1.0Robert O. Peruzzi, PhD, PE, DFE
 
SystemVerilog Assertions (SVA) in the Design/Verification Process
SystemVerilog Assertions (SVA) in the Design/Verification ProcessSystemVerilog Assertions (SVA) in the Design/Verification Process
SystemVerilog Assertions (SVA) in the Design/Verification ProcessDVClub
 
UVM Ral model usage
UVM Ral model usageUVM Ral model usage
UVM Ral model usageParth Pandya
 
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 TutorialSystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 TutorialAmiq Consulting
 
Design and Implementation of an Advanced DMA Controller on AMBA-Based SoC
Design and Implementation of an Advanced DMA Controller on AMBA-Based SoCDesign and Implementation of an Advanced DMA Controller on AMBA-Based SoC
Design and Implementation of an Advanced DMA Controller on AMBA-Based SoCRabindranath Tagore University, Bhopal
 

Viewers also liked (20)

Esl basics
Esl basicsEsl basics
Esl basics
 
Concurrency 2010
Concurrency 2010Concurrency 2010
Concurrency 2010
 
Systemc overview 2010
Systemc overview 2010Systemc overview 2010
Systemc overview 2010
 
C++ process new
C++ process newC++ process new
C++ process new
 
Week1 Electronic System-level ESL Design and SystemC Begin
Week1 Electronic System-level ESL Design and SystemC BeginWeek1 Electronic System-level ESL Design and SystemC Begin
Week1 Electronic System-level ESL Design and SystemC Begin
 
Transaction level modeling an overview
Transaction level modeling an overviewTransaction level modeling an overview
Transaction level modeling an overview
 
Track c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eveTrack c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eve
 
MixedSignal UVM Demo CDNLive
MixedSignal UVM Demo CDNLiveMixedSignal UVM Demo CDNLive
MixedSignal UVM Demo CDNLive
 
Top five reasons why every DV engineer will love the latest systemverilog 201...
Top five reasons why every DV engineer will love the latest systemverilog 201...Top five reasons why every DV engineer will love the latest systemverilog 201...
Top five reasons why every DV engineer will love the latest systemverilog 201...
 
A Systematic Approach to Creating Behavioral Models (white paper) v1.0
A Systematic Approach to Creating Behavioral Models (white paper) v1.0A Systematic Approach to Creating Behavioral Models (white paper) v1.0
A Systematic Approach to Creating Behavioral Models (white paper) v1.0
 
SystemVerilog Assertions (SVA) in the Design/Verification Process
SystemVerilog Assertions (SVA) in the Design/Verification ProcessSystemVerilog Assertions (SVA) in the Design/Verification Process
SystemVerilog Assertions (SVA) in the Design/Verification Process
 
UVM Ral model usage
UVM Ral model usageUVM Ral model usage
UVM Ral model usage
 
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 TutorialSystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
SystemVerilog Assertions verification with SVAUnit - DVCon US 2016 Tutorial
 
stack
stackstack
stack
 
Design and Implementation of an Advanced DMA Controller on AMBA-Based SoC
Design and Implementation of an Advanced DMA Controller on AMBA-Based SoCDesign and Implementation of an Advanced DMA Controller on AMBA-Based SoC
Design and Implementation of an Advanced DMA Controller on AMBA-Based SoC
 
Queue
QueueQueue
Queue
 
Tree
TreeTree
Tree
 
Queue
QueueQueue
Queue
 
Processes and threads
Processes and threadsProcesses and threads
Processes and threads
 
Queuing Theory
Queuing TheoryQueuing Theory
Queuing Theory
 

Similar to Thread and method_2010

Labs_BT_20221017.pptx
Labs_BT_20221017.pptxLabs_BT_20221017.pptx
Labs_BT_20221017.pptxssuserb4d806
 
Reverse engineering - Shellcodes techniques
Reverse engineering - Shellcodes techniquesReverse engineering - Shellcodes techniques
Reverse engineering - Shellcodes techniquesEran Goldstein
 
System verilog important
System verilog importantSystem verilog important
System verilog importantelumalai7
 
Rodrigo Almeida - Microkernel development from project to implementation
Rodrigo Almeida - Microkernel development from project to implementationRodrigo Almeida - Microkernel development from project to implementation
Rodrigo Almeida - Microkernel development from project to implementationFelipe Prado
 
SDC - Programming the CLR in SQL Server 2005.ppt (1.51 MB)
SDC - Programming the CLR in SQL Server 2005.ppt (1.51 MB)SDC - Programming the CLR in SQL Server 2005.ppt (1.51 MB)
SDC - Programming the CLR in SQL Server 2005.ppt (1.51 MB)webhostingguy
 
Microcontroller Based Testing of Digital IP-Core
Microcontroller Based Testing of Digital IP-CoreMicrocontroller Based Testing of Digital IP-Core
Microcontroller Based Testing of Digital IP-CoreVLSICS Design
 
cscript_controller.pdf
cscript_controller.pdfcscript_controller.pdf
cscript_controller.pdfVcTrn1
 
3 Open-Source-SYCL-Intel-Khronos-EVS-Workshop_May19.pdf
3 Open-Source-SYCL-Intel-Khronos-EVS-Workshop_May19.pdf3 Open-Source-SYCL-Intel-Khronos-EVS-Workshop_May19.pdf
3 Open-Source-SYCL-Intel-Khronos-EVS-Workshop_May19.pdfJunZhao68
 
Dan Norris: Exadata security
Dan Norris: Exadata securityDan Norris: Exadata security
Dan Norris: Exadata securityKyle Hailey
 
SMP4 Thread Scheduler (PART 1)======================INS.docx
SMP4 Thread Scheduler (PART 1)======================INS.docxSMP4 Thread Scheduler (PART 1)======================INS.docx
SMP4 Thread Scheduler (PART 1)======================INS.docxpbilly1
 
SMP4 Thread Scheduler (PART 1)======================INSTR.docx
SMP4 Thread Scheduler (PART 1)======================INSTR.docxSMP4 Thread Scheduler (PART 1)======================INSTR.docx
SMP4 Thread Scheduler (PART 1)======================INSTR.docxpbilly1
 
Mod03 linking and accelerating
Mod03 linking and acceleratingMod03 linking and accelerating
Mod03 linking and acceleratingPeter Haase
 
Digital design with Systemc
Digital design with SystemcDigital design with Systemc
Digital design with SystemcMarc Engels
 
LCA14: LCA14-412: GPGPU on ARM SoC session
LCA14: LCA14-412: GPGPU on ARM SoC sessionLCA14: LCA14-412: GPGPU on ARM SoC session
LCA14: LCA14-412: GPGPU on ARM SoC sessionLinaro
 
Lab 4 final report
Lab 4 final reportLab 4 final report
Lab 4 final reportKyle Villano
 
Extending the Mule Runtime - Building a Circuit Breaker Component.pptx
Extending the Mule Runtime - Building a Circuit Breaker Component.pptxExtending the Mule Runtime - Building a Circuit Breaker Component.pptx
Extending the Mule Runtime - Building a Circuit Breaker Component.pptxGuilherme Pereira Silva
 

Similar to Thread and method_2010 (20)

Labs_BT_20221017.pptx
Labs_BT_20221017.pptxLabs_BT_20221017.pptx
Labs_BT_20221017.pptx
 
Reverse engineering - Shellcodes techniques
Reverse engineering - Shellcodes techniquesReverse engineering - Shellcodes techniques
Reverse engineering - Shellcodes techniques
 
01 oracle architecture
01 oracle architecture01 oracle architecture
01 oracle architecture
 
System verilog important
System verilog importantSystem verilog important
System verilog important
 
Rodrigo Almeida - Microkernel development from project to implementation
Rodrigo Almeida - Microkernel development from project to implementationRodrigo Almeida - Microkernel development from project to implementation
Rodrigo Almeida - Microkernel development from project to implementation
 
SDC - Programming the CLR in SQL Server 2005.ppt (1.51 MB)
SDC - Programming the CLR in SQL Server 2005.ppt (1.51 MB)SDC - Programming the CLR in SQL Server 2005.ppt (1.51 MB)
SDC - Programming the CLR in SQL Server 2005.ppt (1.51 MB)
 
Microcontroller Based Testing of Digital IP-Core
Microcontroller Based Testing of Digital IP-CoreMicrocontroller Based Testing of Digital IP-Core
Microcontroller Based Testing of Digital IP-Core
 
cscript_controller.pdf
cscript_controller.pdfcscript_controller.pdf
cscript_controller.pdf
 
3 Open-Source-SYCL-Intel-Khronos-EVS-Workshop_May19.pdf
3 Open-Source-SYCL-Intel-Khronos-EVS-Workshop_May19.pdf3 Open-Source-SYCL-Intel-Khronos-EVS-Workshop_May19.pdf
3 Open-Source-SYCL-Intel-Khronos-EVS-Workshop_May19.pdf
 
Dan Norris: Exadata security
Dan Norris: Exadata securityDan Norris: Exadata security
Dan Norris: Exadata security
 
SMP4 Thread Scheduler (PART 1)======================INS.docx
SMP4 Thread Scheduler (PART 1)======================INS.docxSMP4 Thread Scheduler (PART 1)======================INS.docx
SMP4 Thread Scheduler (PART 1)======================INS.docx
 
Struts2 tutorial
Struts2 tutorialStruts2 tutorial
Struts2 tutorial
 
Struts2 tutorial
Struts2 tutorialStruts2 tutorial
Struts2 tutorial
 
Vhdl new
Vhdl newVhdl new
Vhdl new
 
SMP4 Thread Scheduler (PART 1)======================INSTR.docx
SMP4 Thread Scheduler (PART 1)======================INSTR.docxSMP4 Thread Scheduler (PART 1)======================INSTR.docx
SMP4 Thread Scheduler (PART 1)======================INSTR.docx
 
Mod03 linking and accelerating
Mod03 linking and acceleratingMod03 linking and accelerating
Mod03 linking and accelerating
 
Digital design with Systemc
Digital design with SystemcDigital design with Systemc
Digital design with Systemc
 
LCA14: LCA14-412: GPGPU on ARM SoC session
LCA14: LCA14-412: GPGPU on ARM SoC sessionLCA14: LCA14-412: GPGPU on ARM SoC session
LCA14: LCA14-412: GPGPU on ARM SoC session
 
Lab 4 final report
Lab 4 final reportLab 4 final report
Lab 4 final report
 
Extending the Mule Runtime - Building a Circuit Breaker Component.pptx
Extending the Mule Runtime - Building a Circuit Breaker Component.pptxExtending the Mule Runtime - Building a Circuit Breaker Component.pptx
Extending the Mule Runtime - Building a Circuit Breaker Component.pptx
 

Recently uploaded

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 

Recently uploaded (20)

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 

Thread and method_2010

  • 2. Implementing Modules • SC_MODULE(): – the smallest container of functionality with states, behavior and structure – It may contains • • • • • • • Ports Member channel instance Member data instance Member module instance Constructor Destructor Process member function
  • 3. SystemC Processes • SC_THREAD: – – – – – similar to software thread It gains control from the system until it returns it to simulator. called only once and return can suspend itself using wait(). Blocked because of blocking operation such as read/write • Sc_method: – – – – – – Simpler and more efficient Run completely and return Cannot suspend internally Called by the simulation kernel repeatedly based on sensitivity. Similar to always@ in Verilog. Implied waits can be implemented by calling SystemC built-in blocking methods such as read and write of sc_fifo.
  • 4. 2 Ways to Register and Initialize a Process • SC_CTOR: – C++ uses constructor before the process method. – In the constructor, the methods of implementing the process is defined. • SC_HAS_PROCESS: – It is a cpp macro. – It is usually used when one wants to place the constructor in the implementation. – Use arguments to specify the specifications of models. – If you are making an IP, this is the better way to do.
  • 5. Jobs of SC_CTOR/SC_HAS_PROCESS • • • • • Initialization of its sub-modules Build connections among sub-modules Registering processes to simulation kernel Provide sensitivities Others
  • 6. A Simple Example • Helloworld的範例程式. – 第一個用SC_CTOR – 第二個用SC_HAS_PROCESS, 這一個請將 constructor寫在.cpp裡面. • 其中包含兩個Module, 一個印Hello, 一個印 World. 前一支用sc_thread, 後一支用 sc_method. • 這是在講concurrency與channel時所使用的 簡單程式, 請參照之後的章節.
  • 7. SC_CTOR example Main.cpp #include <systemc.h> #include "hello_module.h" #include "method.h" Hello_module.h #include <systemc.h> int sc_main(int argc, char* argv[]) SC_MODULE(hello_module) { { // signal declaration // signal declaration sc_clock clk("clk", 10, SC_NS, 0.5); sc_in_clk clk; // module declaration hello_module module0("hello_word"); method module1("method"); //Constructor SC_CTOR(hello_module) { SC_THREAD(thread_func); sensitive << clk.pos(); } // signal connection module0.clk(clk); module1.clk(clk); // run simulation sc_start(1000, SC_NS); return 0; } // fuction declaration void thread_func(); };
  • 8. SC_CTOR example Hello_module.cpp #include "hello_module.h" void hello_module::thread_func() { while(1){ wait(); printf(" Word! n"); } } Method.cpp Method.h #include <systemc.h> SC_MODULE(method) { // signal declaration sc_in_clk clk; // fuction declaration void method_func(); //Constructor SC_CTOR(method) { SC_METHOD(method_func); sensitive << clk.pos(); } #include "method.h" void method::method_func() { if(clk){ sc_time_stamp().print(); printf(" Hello! "); } } };
  • 9. SC_HAS_PROCESS example Main.cpp #include <systemc.h> #include "hello_module.h" #include "method.h" Hello_module.h #include <systemc.h> SC_MODULE(hello_module) int sc_main(int argc, char* argv[]) { { // signal declaration // signal declaration sc_in_clk clk; sc_clock clk("clk", 10, SC_NS, 0.5); // module declaration hello_module module0("hello_word"); method module1("method"); // signal connection module0.clk(clk); module1.clk(clk); // run simulation sc_start(1000, SC_NS); return 0; } // fuction declaration void thread_func(); //Constructor declaration hello_module(sc_module_name); };
  • 10. SC_HAS_PROCESS example Hello_module.cpp #include "hello_module.h" Method.h #include <systemc.h> //Constructor hello_module::hello_module(sc_module_name nm) : sc_module(nm) { //using SC_HAS_PROCESS replace SC_CTOR SC_HAS_PROCESS(hello_module); SC_THREAD(thread_func); sensitive << clk.pos(); } SC_MODULE(method) { // signal declaration sc_in_clk clk; void hello_module::thread_func() { while(1){ wait(); printf(" Word! n"); } } }; // fuction declaration void method_func(); //Constructor declaration method(sc_module_name);
  • 11. SC_HAS_PROCESS example Method.cpp #include "method.h" //Constructor method::method(sc_module_name nm) : sc_module(nm) { //using SC_HAS_PROCESS replace SC_CTOR SC_HAS_PROCESS(method); SC_METHOD(method_func); sensitive << clk.pos(); } void method::method_func() { if(clk){ sc_time_stamp().print(); printf(" Hello! "); } }
  • 12. Summarized Template For System Design with SystemC • pseudo code of templates for: – Sc_main.cpp – Module.h – Module.cpp. • SC_CTOR; • SC_HAS_PROCESS.
  • 13. Main.cpp #include <systemc.h> #include “module_name.h” int sc_main(){ Port/Signal declarations module declarations modules linked sc_start(); /sc_start(time); return 0; }
  • 14. Module.h SC_CTOR #ifndef NAME_H #define NAME_H #include "submodule.h" SC_MODULE(NAME) { Port declarations Channel/submodule instances SC_CTOR(NAME) : Initializations { Connectivity Process registrations } Process declarations Helper declarations }; #endif SC_HAS_PROCESS #ifndef NAME_H #define NAME_H #include "submodule.h" SC_MODULE(NAME) { Port declarations Channel/submodule instances // Constructor declaration: NAME(); Process declarations Helper declarations }; #endif
  • 15. Module.cpp SC_CTOR #include <systemc.h> #include "NAME.h" NAME::Process {implementations } NAME::Helper {implementations } SC_HAS_PROCESS #include <systemc.h> #include "NAME.h" NAME::NAME(sc_module_name nm) : sc_module(nm) , Initializations { Channel allocations Submodule allocations Connectivity SC_HAS_PROCESS(NAME); Process registrations } NAME::Process {implementations } NAME::Helper {implementations }