|
Last change
on this file since 43 was 35, checked in by buchmann, 17 years ago |
|
Code cleanup.
Add --dynamiclink option to systemcass executable.
|
|
File size:
1.1 KB
|
| Rev | Line | |
|---|
| [35] | 1 | #include <systemc.h>
|
|---|
| [1] | 2 | #include <iostream>
|
|---|
| 3 | #include <string>
|
|---|
| 4 |
|
|---|
| 5 | #define ASSERT(x) \
|
|---|
| 6 | { errnum++; \
|
|---|
| 7 | if (!(x)) \
|
|---|
| 8 | { \
|
|---|
| 9 | cerr << "ASSERT : " #x "\n"; \
|
|---|
| 10 | exit (errnum); \
|
|---|
| 11 | } \
|
|---|
| 12 | }
|
|---|
| 13 |
|
|---|
| 14 | using namespace std;
|
|---|
| 15 |
|
|---|
| 16 | static int errnum = 0;
|
|---|
| 17 |
|
|---|
| 18 | struct internal_model : sc_module
|
|---|
| 19 | {
|
|---|
| 20 | sc_in<int> i;
|
|---|
| 21 | sc_out<int> o;
|
|---|
| [35] | 22 | internal_model (sc_module_name n) : sc_module (n),
|
|---|
| [1] | 23 | i("i"),
|
|---|
| [35] | 24 | o("o")
|
|---|
| [1] | 25 | {
|
|---|
| 26 | }
|
|---|
| 27 | };
|
|---|
| 28 |
|
|---|
| 29 | struct model : sc_module
|
|---|
| 30 | {
|
|---|
| 31 | sc_in<int> i1, i2, i3;
|
|---|
| 32 | sc_out<int> o1, o2, o3;
|
|---|
| [35] | 33 | sc_signal<int> r1, r2;
|
|---|
| [1] | 34 | internal_model internal;
|
|---|
| [35] | 35 |
|
|---|
| 36 | model (sc_module_name n) : sc_module (n),
|
|---|
| [1] | 37 | i1("i1"), i2("i2"), i3("i3"),
|
|---|
| [35] | 38 | o1("o1"), o2("o2"), o3("o3"),
|
|---|
| 39 | r1("r1"), r2("r2"),
|
|---|
| [1] | 40 | internal ("internal")
|
|---|
| 41 | {
|
|---|
| 42 | internal.o (o3);
|
|---|
| 43 | internal.i (i3);
|
|---|
| 44 | // o3 (internal.o);
|
|---|
| 45 | }
|
|---|
| 46 | };
|
|---|
| 47 |
|
|---|
| 48 | int
|
|---|
| 49 | sc_main (int argc, char ** argv)
|
|---|
| 50 | {
|
|---|
| 51 | model m("m");
|
|---|
| 52 | sc_clock clk ("clock");
|
|---|
| 53 | sc_signal<int> s1("s1"), s2("s2"), s3("s3"), s4("s4");
|
|---|
| 54 |
|
|---|
| 55 | m.i1 (s1);
|
|---|
| 56 | m.i2 (s1); //
|
|---|
| 57 | m.i3 (s1);
|
|---|
| 58 | m.o1 (s4); //
|
|---|
| 59 | m.o2 (s2);
|
|---|
| 60 | m.o3 (s3);
|
|---|
| 61 |
|
|---|
| 62 | sc_start (0);
|
|---|
| 63 |
|
|---|
| 64 | sc_start (1);
|
|---|
| 65 | sc_start (10);
|
|---|
| 66 |
|
|---|
| 67 | cerr << "Test OK.\n";
|
|---|
| 68 | return 0;
|
|---|
| 69 | }
|
|---|
| 70 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.