Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
7c84ddb5
Commit
7c84ddb5
authored
Nov 30, 2020
by
Jialin Li
Browse files
corundum: synchronization mode
parent
f6669016
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
corundum/corundum_verilator.cpp
corundum/corundum_verilator.cpp
+15
-8
No files found.
corundum/corundum_verilator.cpp
View file @
7c84ddb5
...
@@ -888,26 +888,29 @@ int main(int argc, char *argv[])
...
@@ -888,26 +888,29 @@ int main(int argc, char *argv[])
{
{
char
*
vargs
[
2
]
=
{
argv
[
0
],
NULL
};
char
*
vargs
[
2
]
=
{
argv
[
0
],
NULL
};
Verilated
::
commandArgs
(
1
,
vargs
);
Verilated
::
commandArgs
(
1
,
vargs
);
int
sync_mode
=
SYNC_MODES
;
#ifdef TRACE_ENABLED
#ifdef TRACE_ENABLED
Verilated
::
traceEverOn
(
true
);
Verilated
::
traceEverOn
(
true
);
#endif
#endif
if
(
argc
<
4
&&
argc
>
9
)
{
if
(
argc
<
4
&&
argc
>
10
)
{
fprintf
(
stderr
,
"Usage: corundum_verilator PCI-SOCKET ETH-SOCKET "
fprintf
(
stderr
,
"Usage: corundum_verilator PCI-SOCKET ETH-SOCKET "
"SHM [START-TICK] [SYNC-PERIOD] [PCI-LATENCY] [ETH-LATENCY] "
"SHM
[SYNC-MODE]
[START-TICK] [SYNC-PERIOD] [PCI-LATENCY] [ETH-LATENCY] "
"[CLOCK-FREQ-MHZ]
\n
"
);
"[CLOCK-FREQ-MHZ]
\n
"
);
return
EXIT_FAILURE
;
return
EXIT_FAILURE
;
}
}
if
(
argc
>=
5
)
if
(
argc
>=
5
)
main_tim
e
=
strto
ul
l
(
argv
[
4
],
NULL
,
0
);
sync_mod
e
=
strtol
(
argv
[
4
],
NULL
,
0
);
if
(
argc
>=
6
)
if
(
argc
>=
6
)
sync_period
=
strtoull
(
argv
[
5
],
NULL
,
0
)
*
1000ULL
;
main_time
=
strtoull
(
argv
[
5
],
NULL
,
0
);
if
(
argc
>=
7
)
if
(
argc
>=
7
)
pci_latency
=
strtoull
(
argv
[
6
],
NULL
,
0
)
*
1000ULL
;
sync_period
=
strtoull
(
argv
[
6
],
NULL
,
0
)
*
1000ULL
;
if
(
argc
>=
8
)
if
(
argc
>=
8
)
eth
_latency
=
strtoull
(
argv
[
7
],
NULL
,
0
)
*
1000ULL
;
pci
_latency
=
strtoull
(
argv
[
7
],
NULL
,
0
)
*
1000ULL
;
if
(
argc
>=
9
)
if
(
argc
>=
9
)
clock_period
=
1000000ULL
/
strtoull
(
argv
[
8
],
NULL
,
0
);
eth_latency
=
strtoull
(
argv
[
8
],
NULL
,
0
)
*
1000ULL
;
if
(
argc
>=
10
)
clock_period
=
1000000ULL
/
strtoull
(
argv
[
9
],
NULL
,
0
);
struct
cosim_pcie_proto_dev_intro
di
;
struct
cosim_pcie_proto_dev_intro
di
;
memset
(
&
di
,
0
,
sizeof
(
di
));
memset
(
&
di
,
0
,
sizeof
(
di
));
...
@@ -930,6 +933,9 @@ int main(int argc, char *argv[])
...
@@ -930,6 +933,9 @@ int main(int argc, char *argv[])
nsparams
.
pci_latency
=
pci_latency
;
nsparams
.
pci_latency
=
pci_latency
;
nsparams
.
eth_latency
=
eth_latency
;
nsparams
.
eth_latency
=
eth_latency
;
nsparams
.
sync_delay
=
sync_period
;
nsparams
.
sync_delay
=
sync_period
;
assert
(
sync_mode
==
SYNC_MODES
||
sync_mode
==
SYNC_BARRIER
);
nsparams
.
sync_mode
=
sync_mode
;
if
(
nicsim_init
(
&
nsparams
,
&
di
))
{
if
(
nicsim_init
(
&
nsparams
,
&
di
))
{
return
EXIT_FAILURE
;
return
EXIT_FAILURE
;
}
}
...
@@ -1056,12 +1062,13 @@ int main(int argc, char *argv[])
...
@@ -1056,12 +1062,13 @@ int main(int argc, char *argv[])
std
::
cerr
<<
"warn: nicsim_sync failed (t="
<<
main_time
<<
")"
<<
std
::
cerr
<<
"warn: nicsim_sync failed (t="
<<
main_time
<<
")"
<<
std
::
endl
;
std
::
endl
;
}
}
nicsim_advance_epoch
(
&
nsparams
,
main_time
);
do
{
do
{
poll_h2d
(
mmio
);
poll_h2d
(
mmio
);
poll_n2d
(
rx
);
poll_n2d
(
rx
);
}
while
((
nsparams
.
sync_pci
||
nsparams
.
sync_eth
)
&&
}
while
((
nsparams
.
sync_pci
||
nsparams
.
sync_eth
)
&&
n
et
sim_next_timestamp
(
&
nsparams
)
<=
main_time
&&
!
exiting
);
n
ic
sim_next_timestamp
(
&
nsparams
)
<=
main_time
&&
!
exiting
);
/* falling edge */
/* falling edge */
top
->
clk
=
!
top
->
clk
;
top
->
clk
=
!
top
->
clk
;
...
...
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