Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
advLigoRTS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CDS
software
advLigoRTS
Commits
78665a44
Commit
78665a44
authored
3 years ago
by
Ezekiel Dohmen
Browse files
Options
Downloads
Plain Diff
Merge branch 'branch-4.2' into master-branch-4.2-merge
parents
dd1d37f1
92bc8e0d
No related branches found
Branches containing commit
No related tags found
2 merge requests
!439
RCG 5.0 release fro deb 10
,
!350
Merge branch 'branch-4.2' into master-branch-4.2-merge
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/epics/util/feCodeGen.pl
+1
-0
1 addition, 0 deletions
src/epics/util/feCodeGen.pl
src/epics/util/lib/Noise.pm
+43
-29
43 additions, 29 deletions
src/epics/util/lib/Noise.pm
src/epics/util/lib/Parameters.pm
+4
-0
4 additions, 0 deletions
src/epics/util/lib/Parameters.pm
with
48 additions
and
29 deletions
src/epics/util/feCodeGen.pl
+
1
−
0
View file @
78665a44
...
...
@@ -165,6 +165,7 @@ $dkTimesCalled = 0;
$remoteGpsPart
=
0
;
$remoteGPS
=
0
;
$requireIOcnt
=
1
;
$noiseGeneratorSeed
=
"
none
";
#Following provide for non standard IOP clock rates
$adcclock
=
64
;
$modelrate
=
64
;
...
...
This diff is collapsed.
Click to expand it.
src/epics/util/lib/Noise.pm
+
43
−
29
View file @
78665a44
...
...
@@ -4,6 +4,10 @@ use Exporter;
#// \page Noise Noise.pm
#// Documentation for Noise.pm
#// This Noise part generates uniform random noise in the
#// (0, 1) range. This block utilizes the pseudo-random number
#// generator from page 342 (section 7.1) of the third edition
#// of Numerical recipies.
#//
#// \n
...
...
@@ -13,32 +17,33 @@ $init_code_printed = 0;
1
;
sub
partType
{
return
Noise
;
return
Noise
;
}
# Print Epics communication structure into a header file
# Current part number is passed as first argument
sub
printHeaderStruct
{
my
(
$i
)
=
@_
;
my
(
$i
)
=
@_
;
}
# Print Epics variable definitions
# Current part number is passed as first argument
sub
printEpics
{
my
(
$i
)
=
@_
;
my
(
$i
)
=
@_
;
}
# Print variable declarations int front-end file
# Current part number is passed as first argument
sub
printFrontEndVars
{
my
(
$i
)
=
@_
;
print
::
OUT
"
static double
\L
$::xpartName[
$i
];
\n
";
if
(
$printed
)
{
return
;
}
print
::
OUT
<<
"
END
";
static
unsigned
long
noise_seed
=
4101842887655102017
LL
;
\
n
static
unsigned
long
noise_u
,
noise_v
,
noise_w
;
static
inline
unsigned
long
noise_int64
()
{
my
(
$i
)
=
@_
;
print
::
OUT
"
static double
\L
$::xpartName[
$i
];
\n
";
if
(
$printed
)
{
return
;
}
print
::
OUT
<<
"
END
";
static
unsigned
long
noise_seed
=
0
;
static
unsigned
long
noise_u
=
0
,
noise_v
=
0
,
noise_w
=
0
;
static
inline
unsigned
long
noise_int64
(
void
)
{
noise_u
=
noise_u
*
2862933555777941757
LL
+
7046029254386353087
LL
;
noise_v
^=
noise_v
>>
17
;
noise_v
^=
noise_v
<<
31
;
noise_v
^=
noise_v
>>
8
;
noise_w
=
4294957665
U
*
(
noise_w
&
0xffffffff
)
+
(
noise_w
>>
32
);
...
...
@@ -46,11 +51,11 @@ static inline unsigned long noise_int64() {
noise_x
^=
noise_x
>>
35
;
noise_x
^=
noise_x
<<
4
;
return
(
noise_x
+
noise_v
)
^
noise_w
;
}
static
inline
double
noise_doub
()
{
return
5.42101086242752217E-20
*
noise_int64
();
}
static
inline
void
noise_
ran
(
unsigned
long
j
)
{
static
inline
double
noise_doub
(
void
)
{
return
5.42101086242752217E-20
*
noise_int64
();
}
static
inline
noise_
set_seed
(
unsigned
long
seed
)
{
noise_v
=
4101842887655102017
LL
;
noise_w
=
1
;
noise_u
=
j
^
noise_v
;
noise_int64
();
noise_u
=
seed
^
noise_v
;
noise_int64
();
noise_v
=
noise_u
;
noise_int64
();
noise_w
=
noise_v
;
noise_int64
();
}
...
...
@@ -60,8 +65,8 @@ $printed = 1;
# Check inputs are connected
sub
checkInputConnect
{
my
(
$i
)
=
@_
;
return
"";
my
(
$i
)
=
@_
;
return
"";
}
# Figure out part input code
...
...
@@ -69,23 +74,32 @@ sub checkInputConnect {
# Argument 2 is the input number
# Returns calculated input code
sub
fromExp
{
my
(
$i
,
$j
)
=
@_
;
my
$from
=
$
::
partInNum
[
$i
][
$j
];
return
"
\L
$::xpartName[
$from
]
";
my
(
$i
,
$j
)
=
@_
;
my
$from
=
$
::
partInNum
[
$i
][
$j
];
return
"
\L
$::xpartName[
$from
]
";
}
# Return front end initialization code
# Argument 1 is the part number
# Returns calculated code string
sub
frontEndInitCode
{
my
(
$i
)
=
@_
;
if
(
$init_code_printed
)
{
return
"";
}
my
$calcExp
=
"
\L
$::xpartName[
$i
] = 0;
\n
";
$calcExp
.=
"
for (;noise_seed == 4101842887655102017LL;) {
\n
";
$calcExp
.=
"
rdtscl(noise_seed);
\n
";
$calcExp
.=
"
}
\n
";
$init_code_printed
=
1
;
return
$calcExp
;
my
(
$i
)
=
@_
;
if
(
$init_code_printed
)
{
return
"";
}
my
$calcExp
=
"
\L
$::xpartName[
$i
] = 0;
\n
";
#If we don't have an explicit seed set, get one from the tsc register
if
(
$
::
noiseGeneratorSeed
eq
"
none
"
)
{
$calcExp
.=
"
rdtscl(noise_seed);
\n
";
$calcExp
.=
"
rdtscl(noise_w);
\n
";
$calcExp
.=
"
noise_seed |= (noise_w << 32UL);
\n
";
}
else
{
$calcExp
.=
"
noise_seed =
"
.
$
::
noiseGeneratorSeed
.
"
UL;
\n
";
}
$calcExp
.=
"
noise_set_seed(noise_seed);
\n
";
$init_code_printed
=
1
;
return
$calcExp
;
}
...
...
@@ -93,7 +107,7 @@ sub frontEndInitCode {
# Argument 1 is the part number
# Returns calculated code string
sub
frontEndCode
{
my
(
$i
)
=
@_
;
my
$calcExp
=
"
// Noise
\n
";
$calcExp
.=
"
\L
$::xpartName[
$i
] = noise_doub();
\n
";
my
(
$i
)
=
@_
;
my
$calcExp
=
"
// Noise
\n
";
$calcExp
.=
"
\L
$::xpartName[
$i
] = noise_doub();
\n
";
}
This diff is collapsed.
Click to expand it.
src/epics/util/lib/Parameters.pm
+
4
−
0
View file @
78665a44
...
...
@@ -232,6 +232,10 @@ sub parseParams {
{
$
::
requireIOcnt
=
$spp
[
1
];
}
case
"
noiseGeneratorSeed
"
{
$
::
noiseGeneratorSeed
=
$spp
[
1
];
}
case
"
virtualIOP
"
{
$
::
virtualiop
=
$spp
[
1
];
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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