Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
caesr-pub
systemc-clang
Commits
7ce0bc87
Commit
7ce0bc87
authored
May 22, 2019
by
rmrf
Browse files
Test template wait args
parent
7b179cf5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
55 deletions
+55
-55
tests/sanity_tests/template-wait-args.cpp
tests/sanity_tests/template-wait-args.cpp
+55
-55
No files found.
tests/sanity_tests/template-wait-args.cpp
View file @
7ce0bc87
...
...
@@ -3,67 +3,67 @@
template
<
unsigned
D1
,
unsigned
D2
>
SC_MODULE
(
producer
){
int
global
;
sc_out
<
int
>
out
;
void
f1
()
{
int
i
,
j
;
while
(
true
)
{
wait
(
2
,
SC_NS
);
for
(
int
x
=
0
;
x
<
5
;
x
++
)
{
i
=
i
+
x
*
8
;
wait
(
D1
,
SC_NS
);
}
out
.
write
(
i
);
//wait(e1);
i
++
;
wait
(
D2
,
SC_NS
);
global
=
0
;
}
}
void
f3
()
{
while
(
true
)
{
global
=
4
;
wait
(
D1
+
D2
,
SC_NS
);
//e1.notify();
}
}
SC_CTOR
(
producer
)
{
SC_THREAD
(
f1
);
SC_THREAD
(
f3
);
}
int
global
;
sc_out
<
int
>
out
;
void
f1
()
{
int
i
,
j
;
while
(
true
)
{
//
wait(2, SC_NS);
for
(
int
x
=
0
;
x
<
5
;
x
++
)
{
i
=
i
+
x
*
8
;
wait
(
D1
,
SC_NS
);
}
out
.
write
(
i
);
//wait(e1);
i
++
;
wait
(
D2
,
SC_NS
);
global
=
0
;
}
}
void
f3
()
{
while
(
true
)
{
global
=
4
;
wait
(
D1
+
D2
,
SC_NS
);
//e1.notify();
}
}
SC_CTOR
(
producer
)
{
SC_THREAD
(
f1
);
SC_THREAD
(
f3
);
}
};
SC_MODULE
(
consumer
)
{
sc_in
<
int
>
in
;
void
f2
()
{
int
x
;
while
(
true
)
{
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
x
=
i
*
7
;
}
wait
(
5
,
SC_NS
);
if
(
x
>
5
)
{
wait
(
10
,
SC_NS
);
}
x
=
in
.
read
();
wait
(
2
,
SC_NS
);
}
}
SC_CTOR
(
consumer
)
{
SC_THREAD
(
f2
);
}
sc_in
<
int
>
in
;
void
f2
()
{
int
x
;
while
(
true
)
{
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
x
=
i
*
7
;
}
//
wait(5, SC_NS);
if
(
x
>
5
)
{
//
wait(10, SC_NS);
}
x
=
in
.
read
();
//
wait(2, SC_NS);
}
}
SC_CTOR
(
consumer
)
{
SC_THREAD
(
f2
);
}
};
int
sc_main
(
int
argc
,
char
*
argv
[])
{
sc_signal
<
int
>
s1
;
producer
<
5
,
10
>
p1
(
"producer"
);
consumer
c1
(
"consumer"
);
p1
.
out
(
s1
);
c1
.
in
(
s1
);
sc_signal
<
int
>
s1
;
producer
<
222
,
333
>
p1
(
"producer"
);
// consumer c1("consumer");
p1
.
out
(
s1
);
// c1.in(s1);
return
0
;
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment