Chapter 10 -- SystemC From Gound 读书心得
2010-12-01 22:43
316 查看
1. Design Hierarchy
2. How to creat hierarchy
1) Direct/indirect Top-Level Implementation
2) direct submodule
3) indirect submodule -- For IP deliver
注意上例中 Engine.h 没有包括 #include "FuelMix.h", etc..., 而是移到了Engine.cpp中。这就是最大的好处,你只需要提供Engine.h 和 Engine.o 或者 Engine.a就行了,而且 .o, .a都可以方便的更新。
2. How to creat hierarchy
1) Direct/indirect Top-Level Implementation
//=================direct=================== //FILE: main.cpp #include <systemc> #include "Car.h" int sc_main(int argc, char* argv[]) { Car car_i("car_i"); sc_start(); return 0; } //=================indirect=================== //FILE: main.cpp #include <systemc> #include "Car.h" int sc_main(int argc, char* argv[]) { Car* car_iptr; // pointer to Car car_iptr = new Car("car_i"); // create Car sc_start(); delete car_iptr; return 0; }
2) direct submodule
//FILE:Car.h #include "Body.h" #include "Engine.h" SC_MODULE(Car) { Body body_i; Engine eng_i; Car(sc_module_name nm); }; //FILE:Car.cpp #include <systemc> #include "Car.h" // Constructor SC_HAS_PROCESS(Car); Car::Car(sc_module_name nm) : sc_module(nm) , body_i("body_i") , eng_i("eng_i") { // other initialization }
3) indirect submodule -- For IP deliver
//FILE:Engine.h class FuelMix; class Exhaust; class Cylinder; SC_MODULE(Engine) { FuelMix* fuelmix_iptr; Exhaust* exhaust_iptr; Cylinder* cyl1_iptr; Cylinder* cyl2_iptr; Engine(sc_module_name nm); // Constructor }; //FILE: Engine.cpp #include <systemc> #include "FuelMix.h" #include "Exhaust.h" #include "Cylinder.h" // Constructor SC_HAS_PROCESS(Engine); Engine::Engine(sc_module_name nm) : sc_module(nm) { fuelmix_iptr = new FuelMix("fuelmix_i"); exhaust_iptr = new Exhaust("exhaust_i"); cyl1_iptr = new Cylinder("cyl1_i"); cyl2_iptr = new Cylinder("cyl2_i"); // other initialization }
注意上例中 Engine.h 没有包括 #include "FuelMix.h", etc..., 而是移到了Engine.cpp中。这就是最大的好处,你只需要提供Engine.h 和 Engine.o 或者 Engine.a就行了,而且 .o, .a都可以方便的更新。
相关文章推荐
- Chapter 8 -- SystemC From Gound 读书心得
- Chapter 9 -- SystemC From Gound 读书心得
- Chapter 3 -- SystemC From Gound 读书心得
- Chapter 6 -- SystemC From Gound 读书心得
- Chapter 2 -- SystemC From Gound 读书心得
- Chapter 5 -- SystemC From Gound 读书心得
- Chapter 11 -- SystemC From Gound 读书心得
- Chapter 4 -- SystemC From Gound 读书心得
- Chapter 13 -- SystemC From Gound 读书心得
- Chapter 7 -- SystemC From Gound 读书心得
- Chapter 12 -- SystemC From Gound 读书心得
- Thinking in Java from Chapter 10
- 心得10--jsp自定义标签介绍
- Couldn't load gdx from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/ 错误
- APUE——Chapter 10:信号
- 搜索引擎核心读书心得2:暗网抓取
- 《晨间日记的奇迹》内容概要及读书心得
- 【翻译+原创】Deep Learning Face Representation from Predicting 10,000 Classes 论文笔记
- 翻译--Blazing fast node.js: 10 performance tips from LinkedIn Mobile
- How to Perform System Boot and Shutdown Procedures for Solaris 10, Part B