Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libnux
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EBRAINS RI
Tech Hub
Apps
BrainScaleS
libnux
Commits
54729158
Commit
54729158
authored
3 years ago
by
Eric Müller
Committed by
Yannik Stradmann
1 month ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix sleep_cycles for small inputs…
Change-Id: I44f6cdd50f3d13b220294a631f96e897837c0211
parent
56f2efe4
Branches
master
Tags
ebrains-8.0-a1
ebrains-8.0-a2
ebrains-8.0-a3
ebrains-8.0-a4
ebrains-8.0-a5
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/libnux/vx/time.h
+6
-0
6 additions, 0 deletions
include/libnux/vx/time.h
src/libnux/vx/time.cpp
+3
-5
3 additions, 5 deletions
src/libnux/vx/time.cpp
with
9 additions
and
5 deletions
include/libnux/vx/time.h
+
6
−
0
View file @
54729158
...
@@ -12,6 +12,12 @@ namespace libnux::vx {
...
@@ -12,6 +12,12 @@ namespace libnux::vx {
constexpr
static
uint32_t
default_ppu_cycles_per_us
=
250
;
constexpr
static
uint32_t
default_ppu_cycles_per_us
=
250
;
/*
* Idle for (approx.) `cycles` cycles.
*
* The current implementation uses a narrowing conversion of the user-supplied parameter to
* 'int32_t'. Values that don't fit in this data type will wrap.
*/
void
sleep_cycles
(
uint32_t
cycles
)
ATTRIB_LINK_TO_INTERNAL
;
void
sleep_cycles
(
uint32_t
cycles
)
ATTRIB_LINK_TO_INTERNAL
;
/*
/*
...
...
This diff is collapsed.
Click to expand it.
src/libnux/vx/time.cpp
+
3
−
5
View file @
54729158
...
@@ -3,15 +3,13 @@
...
@@ -3,15 +3,13 @@
namespace
libnux
::
vx
{
namespace
libnux
::
vx
{
/*
Idle for (approx.) `cycles` cycles.
*/
void
__attribute__
((
optimize
(
"O2"
)))
sleep_cycles
(
uint32_t
cycles
)
void
__attribute__
((
optimize
(
"O2"
)))
sleep_cycles
(
uint32_t
cycles
)
{
{
static
const
u
int8_t
offset
=
9
;
static
const
int8_t
offset
=
9
;
time_base_t
start
;
time_base_t
start
;
start
=
get_time_base
();
start
=
get_time_base
();
while
((
uint32_t
)(
get_time_base
()
-
start
)
<=
(
cycles
-
offset
));
while
((
int32_t
)(
get_time_base
()
-
start
)
<=
(
static_cast
<
int32_t
>
(
cycles
)
-
offset
))
;
}
}
time_base_t
now
()
time_base_t
now
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment