Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DEL 1ns 4cha - stand-alone application
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
FMC DEL 1ns 4cha - stand-alone application
Commits
5320bc75
Commit
5320bc75
authored
Oct 06, 2014
by
Jose Jimenez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fdelay-output.c & tools-util.c: Changed to a better division function
Signed-off-by:
Jose Jimenez
<
ppjm@correo.ugr.es
>
parent
fb1cb46f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
fdelay-output.c
debugger_sw/fmc-delay/fine-delay-cmds/fdelay-output.c
+3
-2
tools-util.c
debugger_sw/fmc-delay/fine-delay-cmds/tools-util.c
+5
-5
No files found.
debugger_sw/fmc-delay/fine-delay-cmds/fdelay-output.c
View file @
5320bc75
...
...
@@ -25,6 +25,7 @@
#include <fine-delay.h>
#include "hw/fd_main_regs.h"
#include "hw/fd_channel_regs.h"
#include <linux/math64.h>
#define MAX_EXT_ATTR 32
#define NSEC_PER_SEC 1000*1000*1000
...
...
@@ -56,7 +57,7 @@ static void fdelay_add_ps(struct fdelay_time *p, uint64_t ps)
/* FIXME: this silently fails with ps > 10^12 = 1s */
tmp
=
div64_u64_rem
(
ps
,
8000LLU
,
&
ps
);
coarse
=
(
uint32_t
)
tmp
;
frac
=
div_u64
_rem
((
ps
<<
12
),
8000LLU
,
NULL
);
frac
=
div_u64
((
ps
<<
12
),
8000LLU
);
p
->
frac
+=
frac
;
if
(
p
->
frac
>=
4096
)
...
...
@@ -80,7 +81,7 @@ static void fdelay_sub_ps(struct fdelay_time *p, uint64_t ps)
/* FIXME: this silently fails with ps > 10^12 = 1s */
tmp
=
div64_u64_rem
(
ps
,
8000LLU
,
&
ps
);
coarse_neg
=
(
uint32_t
)
tmp
;
frac_neg
=
div_u64
_rem
((
ps
<<
12
),
8000LLU
,
NULL
);
frac_neg
=
div_u64
((
ps
<<
12
),
8000LLU
);
if
(
p
->
frac
<
frac_neg
)
{
...
...
debugger_sw/fmc-delay/fine-delay-cmds/tools-util.c
View file @
5320bc75
...
...
@@ -3,7 +3,7 @@
* Jose Jimenez <jjimenez.wr@gmail.com>, Copyright (C) 2014 UGR.
* Released according to the GNU GPL version 3 (GPLv3) or later.
*
* Adapted from tools-util
fine-delay-sw
* Adapted from tools-util
.c within fine-delay-sw package
*/
#include <stdio.h>
...
...
@@ -115,7 +115,7 @@ int sscanf_addhoc_replacement(char *str, unsigned long long *var1, unsigned long
/*
* What it should if we had 64 bit printing
* What it should
be,
if we had 64 bit printing
*
* Note: LM32-base cores can not divide LL use functions form linux/math64.c
* I provide you with (that means the fuction donw below has te be fixed)
...
...
@@ -154,14 +154,14 @@ void tools_report_time(char *name, struct fdelay_time *t, int umode)
uint64_t
temp
=
mul_u64
((
u64
)
t
->
frac
,
8000LLU
);
uint64_t
picoseconds
=
mul_u64
((
u64
)
t
->
coarse
,
8000LLU
)
+
div64_u64
_rem
(
temp
,
4096LLU
,
NULL
);
div64_u64
(
temp
,
4096LLU
);
printf
(
"%s "
,
name
);
switch
(
umode
)
{
case
TOOLS_UMODE_USER
:
/*
* This fix make the following looks like shee
t
(at running time).
* It looks way cool
er in the
user space!
* This fix make the following looks like shee
... not so god
(at running time).
* It looks way cool
in
user space!
*
*/
mprint_64bit
((
uint64_t
)(
t
->
utc
));
...
...
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