A Theoretical and Experimental Review of SystemC Front-ends Kevin - - PowerPoint PPT Presentation

a theoretical and experimental review of systemc front
SMART_READER_LITE
LIVE PREVIEW

A Theoretical and Experimental Review of SystemC Front-ends Kevin - - PowerPoint PPT Presentation

SystemC Front-Ends Existing Conclusion A Theoretical and Experimental Review of SystemC Front-ends Kevin Marquet Matthieu Moy Bageshri Karkare Verimag (Grenoble INP) Grenoble France FDL, September 15 th 2010 FDL, September 15 th 2010 <


slide-1
SLIDE 1

SystemC Front-Ends Existing Conclusion

A Theoretical and Experimental Review of SystemC Front-ends

Kevin Marquet Matthieu Moy Bageshri Karkare

Verimag (Grenoble INP) Grenoble France

FDL, September 15th 2010

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 1 / 25 >

slide-2
SLIDE 2

SystemC Front-Ends Existing Conclusion

Summary

1

SystemC

2

SystemC Front-Ends

3

Existing SystemC front-ends

4

Conclusion

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 2 / 25 >

slide-3
SLIDE 3

SystemC Front-Ends Existing Conclusion

SystemC

Industry-standard for high-level modeling (TLM, . . . ) of Systems-on-a-Chip, Library for C++ (compile with g++ -lsystemc. . . )

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 3 / 25 >

slide-4
SLIDE 4

SystemC Front-Ends Existing Conclusion

SystemC: Example

N1 N2

SC_MODULE(not_gate) { sc_in<bool> in; sc_out<bool> out; void compute (void) { // Behavior bool val = in.read();

  • ut.write(!val);

} SC_CTOR(not_gate) { SC_METHOD(compute); sensitive << in; } }; int sc_main(int argc, char **argv) { // Elaboration phase (Architecture) not_gate n1("N1"); not_gate n2("N2"); sc_signal<bool> s1, s2; // Binding n1.out.bind(s1); n2.out.bind(s2); n1.in.bind(s2); n2.in.bind(s1); // Start simulation sc_start(100, SC_NS); return 0; }

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 4 / 25 >

slide-5
SLIDE 5

SystemC Front-Ends Existing Conclusion

Summary

1

SystemC

2

SystemC Front-Ends

3

Existing SystemC front-ends

4

Conclusion

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 5 / 25 >

slide-6
SLIDE 6

SystemC Front-Ends Existing Conclusion

This section

2

SystemC Front-Ends Applications Difficulties Approaches

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 6 / 25 >

slide-7
SLIDE 7

SystemC Front-Ends Existing Conclusion

When you don’t need a front-end

Main application of SystemC: Simulation

◮ Just need a C++ compiler + the library

Testing, run-time verification, monitoring. . .

◮ (Small) modifications of the SystemC library

IDE integration, Debugging . . .

◮ Plain C++ front-ends can do most of the job. Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 7 / 25 >

slide-8
SLIDE 8

SystemC Front-Ends Existing Conclusion

When you don’t need a front-end

Main application of SystemC: Simulation

◮ Just need a C++ compiler + the library

Testing, run-time verification, monitoring. . .

◮ (Small) modifications of the SystemC library

IDE integration, Debugging . . .

◮ Plain C++ front-ends can do most of the job.

No reference front-end available on http://www.systemc.org/

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 7 / 25 >

slide-9
SLIDE 9

SystemC Front-Ends Existing Conclusion

When you really need a front-end

Symbolic formal verification, High-level synthesis Visualization Introspection SystemC-specific Compiler Optimizations Advanced debugging features (architecture → source code, . . . )

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 8 / 25 >

slide-10
SLIDE 10

SystemC Front-Ends Existing Conclusion

When you really need a front-end

Symbolic formal verification, High-level synthesis

◮ Need to extract almost everything about the platform

Visualization Introspection SystemC-specific Compiler Optimizations Advanced debugging features (architecture → source code, . . . )

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 8 / 25 >

slide-11
SLIDE 11

SystemC Front-Ends Existing Conclusion

When you really need a front-end

Symbolic formal verification, High-level synthesis

◮ Need to extract almost everything about the platform

Visualization

◮ Need to extract the architecture. Behavior is less important

Introspection SystemC-specific Compiler Optimizations Advanced debugging features (architecture → source code, . . . )

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 8 / 25 >

slide-12
SLIDE 12

SystemC Front-Ends Existing Conclusion

When you really need a front-end

Symbolic formal verification, High-level synthesis

◮ Need to extract almost everything about the platform

Visualization

◮ Need to extract the architecture. Behavior is less important

Introspection

◮ Information about the module (Architecture) + possibly local

variables (Behavior)

SystemC-specific Compiler Optimizations Advanced debugging features (architecture → source code, . . . )

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 8 / 25 >

slide-13
SLIDE 13

SystemC Front-Ends Existing Conclusion

When you really need a front-end

Symbolic formal verification, High-level synthesis

◮ Need to extract almost everything about the platform

Visualization

◮ Need to extract the architecture. Behavior is less important

Introspection

◮ Information about the module (Architecture) + possibly local

variables (Behavior)

SystemC-specific Compiler Optimizations

◮ Can use architecture information to optimize the behavior

Advanced debugging features (architecture → source code, . . . )

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 8 / 25 >

slide-14
SLIDE 14

SystemC Front-Ends Existing Conclusion

When you really need a front-end

Symbolic formal verification, High-level synthesis

◮ Need to extract almost everything about the platform

Visualization

◮ Need to extract the architecture. Behavior is less important

Introspection

◮ Information about the module (Architecture) + possibly local

variables (Behavior)

SystemC-specific Compiler Optimizations

◮ Can use architecture information to optimize the behavior

Advanced debugging features (architecture → source code, . . . )

◮ Needs the architecture and behavior Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 8 / 25 >

slide-15
SLIDE 15

SystemC Front-Ends Existing Conclusion

This section

2

SystemC Front-Ends Applications Difficulties Approaches

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 9 / 25 >

slide-16
SLIDE 16

SystemC Front-Ends Existing Conclusion

Difficulties Writing SystemC Front-Ends

1

C++ is complex (e.g. clang ≈ 200,000 LOC)

2

Architecture is built at runtime, with C++ code

SC_MODULE(not_gate) { sc_in<bool> in; sc_out<bool> out; void compute (void) { // Behavior bool val = in.read();

  • ut.write(!val);

} SC_CTOR(not_gate) { SC_METHOD(compute); sensitive << in; } }; int sc_main(int argc, char **argv) { // Elaboration phase (Architecture) not_gate n1("N1"); not_gate n2("N2"); sc_signal<bool> s1, s2; // Binding n1.out.bind(s1); n2.out.bind(s2); n1.in.bind(s2); n2.in.bind(s1); // Start simulation sc_start(100, SC_NS); return 0; }

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 10 / 25 >

slide-17
SLIDE 17

SystemC Front-Ends Existing Conclusion

This section

2

SystemC Front-Ends Applications Difficulties Approaches

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 11 / 25 >

slide-18
SLIDE 18

SystemC Front-Ends Existing Conclusion

Dealing with the complexity of C++

Write a new C++ front-end (lex+yac, . . . )

◮ Either huge effort, or many limitations

Reuse one

◮ EDG: Good, expansive C++ front-end ◮ GNU g++: Good C++ support, but hard to use as a front-end ◮ clang (part of LLVM): Good C++ support (recent), modular ◮ . . . Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 12 / 25 >

slide-19
SLIDE 19

SystemC Front-Ends Existing Conclusion

Dealing with the architecture

Static approach: Analyze the elaboration, and find out the architecture

◮ Usually very limited wrt.

complexity of the elaboration code

Dynamic approach: Execute the elaboration, and see the result

◮ Few limitations ◮ Main difficulty: link

Behavior ↔ Architecture.

int sc_main(int argc, char **argv) { // Elaboration phase (Architecture) not_gate n1("N1"); not_gate n2("N2"); sc_signal<bool> s1, s2; // Binding n1.out.bind(s1); n2.out.bind(s2); n1.in.bind(s2); n2.in.bind(s1); // Start simulation sc_start(100, SC_NS); return 0; }

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 13 / 25 >

slide-20
SLIDE 20

SystemC Front-Ends Existing Conclusion

Dealing with the architecture

When it becomes tricky. . .

int sc_main(int argc, char **argv) { int n = atoi(argv[1]); int m = atoi(argv[2]); Node array[n][m]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { array[i][j] = new Node(...); ... } } sc_start(100, SC_NS); return 0; }

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 14 / 25 >

slide-21
SLIDE 21

SystemC Front-Ends Existing Conclusion

Dealing with the architecture

When it becomes tricky. . .

Static approach: cannot deal with such code Dynamic approach: can extract the architecture for individual instances of the system

int sc_main(int argc, char **argv) { int n = atoi(argv[1]); int m = atoi(argv[2]); Node array[n][m]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { array[i][j] = new Node(...); ... } } sc_start(100, SC_NS); return 0; }

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 14 / 25 >

slide-22
SLIDE 22

SystemC Front-Ends Existing Conclusion

Dealing with the architecture

When it becomes very tricky. . .

void compute(void) { for (int i = 0; i < n; i++) { ports[i].write(true); } ... }

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 15 / 25 >

slide-23
SLIDE 23

SystemC Front-Ends Existing Conclusion

Dealing with the architecture

When it becomes very tricky. . .

One can unroll the loop to let i become constant, Undecidable in the general case.

void compute(void) { for (int i = 0; i < n; i++) { ports[i].write(true); } ... }

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 15 / 25 >

slide-24
SLIDE 24

SystemC Front-Ends Existing Conclusion

Summary

1

SystemC

2

SystemC Front-Ends

3

Existing SystemC front-ends

4

Conclusion

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 16 / 25 >

slide-25
SLIDE 25

SystemC Front-Ends Existing Conclusion

Existing SystemC front-ends

An attempt at classification

Static Dynamic Home-made parser KaSCPar, sc2v, ParSyC, Scoot,

  • SystemPerl. . .

Existing parser SystemCXML DATE091, Pinapa, PinaVM Hard to classify: Quiny (purely dynamic approach) Commercial tools (closed, not detailed here): Synopsys, Semantic Design, NC-SystemC (Cadence)

1Overcoming limitations of the SystemC data introspection, Christian Genz and

Rolf Drechsler

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 17 / 25 >

slide-26
SLIDE 26

SystemC Front-Ends Existing Conclusion

Who should read the paper?

Targeted reader: People in need of a SystemC front-end to build a research tool

◮ To use an existing one

⇒ emphasis on available/open tools

◮ To build a new one

⇒ description of the challenges and approaches

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 18 / 25 >

slide-27
SLIDE 27

SystemC Front-Ends Existing Conclusion

Who should read the paper?

Targeted reader: People in need of a SystemC front-end to build a research tool

◮ To use an existing one

⇒ emphasis on available/open tools

◮ To build a new one

⇒ description of the challenges and approaches

Content:

◮ Summary and bibliography for each front-end ◮ A small but representative testsuite (public) ◮ Experimental results Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 18 / 25 >

slide-28
SLIDE 28

SystemC Front-Ends Existing Conclusion

Who should read the paper?

Targeted reader: People in need of a SystemC front-end to build a research tool

◮ To use an existing one

⇒ emphasis on available/open tools

◮ To build a new one

⇒ description of the challenges and approaches

Content:

◮ Summary and bibliography for each front-end ◮ A small but representative testsuite (public) ◮ Experimental results

Disclaimer: paper written by authors of 2 front-ends (Pinapa and PinaVM)

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 18 / 25 >

slide-29
SLIDE 29

SystemC Front-Ends Existing Conclusion

Conclusions of the Review

Very limited front-ends: KaSCPar, sc2v, SystemPerl, SystemCXML, Quiny Not available: ParSyC, DATE09 Remaining candidates for research tools:

◮ Scoot: close-source (but authors opened to discussion), good

SystemC/C++ support

◮ Pinapa: open-source, very few limitations, but painful to install ◮ PinaVM (new, not in the paper): open-source, very few theoretical

limitations, still at prototype stage.

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 19 / 25 >

slide-30
SLIDE 30

SystemC Front-Ends Existing Conclusion

Scoot

Static scheduling based on model-checking and partial order reduction In-house C++ front-end, but good in our experience

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 20 / 25 >

slide-31
SLIDE 31

SystemC Front-Ends Existing Conclusion

Pinapa

Front-end of the tool LusSy: connection of SystemC to various model-checkers Based on GCC to support C++ Executes the elaboration, link the result to the syntax tree

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 21 / 25 >

slide-32
SLIDE 32

SystemC Front-Ends Existing Conclusion

PinaVM

Connection of SystemC to various model-checkers Based on the LLVM compiler infrastructure (uses llvm-g++ as the front-end) Relies on Just-In-Time compilation to link the architecture and the behavior

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 22 / 25 >

slide-33
SLIDE 33

SystemC Front-Ends Existing Conclusion

PinaVM

Connection of SystemC to various model-checkers Based on the LLVM compiler infrastructure (uses llvm-g++ as the front-end) Relies on Just-In-Time compilation to link the architecture and the behavior See you at Emsoft for the details ;-)

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 22 / 25 >

slide-34
SLIDE 34

SystemC Front-Ends Existing Conclusion

Summary

1

SystemC

2

SystemC Front-Ends

3

Existing SystemC front-ends

4

Conclusion

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 23 / 25 >

slide-35
SLIDE 35

SystemC Front-Ends Existing Conclusion

Conclusion

Writing a (good) SystemC front-end = surprisingly difficult task Experimental and theoretical comparison of existing SystemC front-ends presented Lots of candidates, none 100% satisfactory

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 24 / 25 >

slide-36
SLIDE 36

SystemC Front-Ends Existing Conclusion

Questions?

Matthieu Moy (Verimag) Review of SystemC front-ends FDL, September 15th 2010 < 25 / 25 >