(原創) 第一个SystemC的程序:Hello World (C/C++) (SystemC) (IC Design)
1
// All systemc modules should include systemc.h header file
2
#include "systemc.h"
3
// Hello_world is module name
4
SC_MODULE (HelloWorld) {
5
SC_CTOR (HelloWorld) {
6
// Nothing in constructor
7
}
8
void sayHello() {
9
//Print "Hello World" to the console.
10
std::cout << "Hello World." << std::endl;
11
}
12
};
13
14
// sc_main in top level function like in C++ main
15
int sc_main(int argc, char* argv[]) {
16
HelloWorld myHelloWorld("HELLO");
17
// Print the hello world
18
myHelloWorld.sayHello();
19
20
return 0;
21
}
22
23
// All systemc modules should include systemc.h header file2
#include "systemc.h"3
// Hello_world is module name4
SC_MODULE (HelloWorld) {5
SC_CTOR (HelloWorld) {6
// Nothing in constructor 7
}8
void sayHello() {9
//Print "Hello World" to the console.10
std::cout << "Hello World." << std::endl;11
}12
};13

14
// sc_main in top level function like in C++ main15
int sc_main(int argc, char* argv[]) {16
HelloWorld myHelloWorld("HELLO");17
// Print the hello world18
myHelloWorld.sayHello();19

20
return 0;21
}22

23



SC_CTOR (HelloWorld)
浙公网安备 33010602011771号