Merge branch 'fpga_easy_recover' into 'main'
Recent updates See merge request jungfraujoch/nextgendcu!6
This commit is contained in:
+12
-13
@@ -65,11 +65,11 @@ build:x86:vitis_hls:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "push"'
|
||||
changes:
|
||||
- receiver/hls/*
|
||||
- receiver/hdl/*
|
||||
- receiver/scripts/*
|
||||
- receiver/xdc/*
|
||||
- receiver/microblaze/*
|
||||
- fpga/hls/*
|
||||
- fpga/hdl/*
|
||||
- fpga/scripts/*
|
||||
- fpga/xdc/*
|
||||
- fpga/microblaze/*
|
||||
- common/Definitions.h
|
||||
script:
|
||||
- source /opt/Xilinx/Vitis_HLS/2022.1/settings64.sh
|
||||
@@ -185,8 +185,7 @@ test:x86:xia2.ssx:
|
||||
- source /usr/local/dials-v3-13-0/dials_env.sh
|
||||
- xia2.ssx image=writing_test_master.h5 space_group=P43212 unit_cell=78.551,78.551,36.914,90.000,90.000,90.000
|
||||
|
||||
|
||||
synthesis:vivado_pcie:
|
||||
synthesis:vivado_pcie_100g:
|
||||
stage: synthesis
|
||||
variables:
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
@@ -196,17 +195,17 @@ synthesis:vivado_pcie:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "push"'
|
||||
changes:
|
||||
- receiver/hls/*
|
||||
- receiver/hdl/*
|
||||
- receiver/scripts/*
|
||||
- receiver/xdc/*
|
||||
- fpga/hls/*
|
||||
- fpga/hdl/*
|
||||
- fpga/scripts/*
|
||||
- fpga/xdc/*
|
||||
- common/Definitions.h
|
||||
tags:
|
||||
- vivado
|
||||
artifacts:
|
||||
paths:
|
||||
- build/receiver/*.mcs
|
||||
- build/receiver/*.bit
|
||||
- build/fpga/*.mcs
|
||||
- build/fpga/*.bit
|
||||
expire_in: 1 week
|
||||
script:
|
||||
- source /opt/grpc/grpc.sh
|
||||
|
||||
@@ -11,3 +11,6 @@
|
||||
path = detector_control/slsDetectorPackage
|
||||
url = https://github.com/slsdetectorgroup/slsDetectorPackage
|
||||
branch = "developer"
|
||||
[submodule "compression/bitshuffle_hperf"]
|
||||
path = compression/bitshuffle_hperf
|
||||
url = https://github.com/kalcutter/bitshuffle
|
||||
|
||||
+4
-1
@@ -11,13 +11,15 @@ SET(CMAKE_C_FLAGS_RELEASE "-O3 -march=native -mtune=native")
|
||||
INCLUDE(CheckLanguage)
|
||||
CHECK_LANGUAGE(CUDA)
|
||||
|
||||
SET(CMAKE_CUDA_ARCHITECTURES 70 75 80 86) # V100, T4, A100, RTX A4000
|
||||
SET(CMAKE_CUDA_ARCHITECTURES 70 75 80 86 89) # V100, T4, A100, RTX A4000, L4
|
||||
SET(CMAKE_CUDA_STANDARD 17)
|
||||
SET(CMAKE_CUDA_FLAGS_RELEASE "-O3")
|
||||
|
||||
IF (CMAKE_CUDA_COMPILER)
|
||||
ENABLE_LANGUAGE(CUDA)
|
||||
MESSAGE(STATUS "CUDA VERSION: ${CMAKE_CUDA_COMPILER_VERSION}")
|
||||
ADD_COMPILE_DEFINITIONS(JFJOCH_USE_CUDA)
|
||||
FIND_LIBRARY(CUDART_LIBRARY cudart_static PATHS ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES} REQUIRED)
|
||||
ENDIF()
|
||||
|
||||
SET(JFJOCH_COMPILE_WRITER ON CACHE BOOL "Compile HDF5 writer")
|
||||
@@ -47,6 +49,7 @@ ADD_SUBDIRECTORY(etc)
|
||||
SET(jfjoch_executables jfjoch_broker)
|
||||
|
||||
IF (JFJOCH_COMPILE_TESTS OR JFJOCH_COMPILE_RECEIVER)
|
||||
ADD_SUBDIRECTORY(fpga)
|
||||
ADD_SUBDIRECTORY(receiver)
|
||||
ADD_SUBDIRECTORY(image_analysis)
|
||||
LIST(APPEND jfjoch_executables jfjoch_receiver)
|
||||
|
||||
-674
@@ -1,674 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
-289
@@ -1,289 +0,0 @@
|
||||
CERN Open Hardware Licence Version 2 - Strongly Reciprocal
|
||||
|
||||
|
||||
Preamble
|
||||
|
||||
CERN has developed this licence to promote collaboration among
|
||||
hardware designers and to provide a legal tool which supports the
|
||||
freedom to use, study, modify, share and distribute hardware designs
|
||||
and products based on those designs. Version 2 of the CERN Open
|
||||
Hardware Licence comes in three variants: CERN-OHL-P (permissive); and
|
||||
two reciprocal licences: CERN-OHL-W (weakly reciprocal) and this
|
||||
licence, CERN-OHL-S (strongly reciprocal).
|
||||
|
||||
The CERN-OHL-S is copyright CERN 2020. Anyone is welcome to use it, in
|
||||
unmodified form only.
|
||||
|
||||
Use of this Licence does not imply any endorsement by CERN of any
|
||||
Licensor or their designs nor does it imply any involvement by CERN in
|
||||
their development.
|
||||
|
||||
|
||||
1 Definitions
|
||||
|
||||
1.1 'Licence' means this CERN-OHL-S.
|
||||
|
||||
1.2 'Compatible Licence' means
|
||||
|
||||
a) any earlier version of the CERN Open Hardware licence, or
|
||||
|
||||
b) any version of the CERN-OHL-S, or
|
||||
|
||||
c) any licence which permits You to treat the Source to which
|
||||
it applies as licensed under CERN-OHL-S provided that on
|
||||
Conveyance of any such Source, or any associated Product You
|
||||
treat the Source in question as being licensed under
|
||||
CERN-OHL-S.
|
||||
|
||||
1.3 'Source' means information such as design materials or digital
|
||||
code which can be applied to Make or test a Product or to
|
||||
prepare a Product for use, Conveyance or sale, regardless of its
|
||||
medium or how it is expressed. It may include Notices.
|
||||
|
||||
1.4 'Covered Source' means Source that is explicitly made available
|
||||
under this Licence.
|
||||
|
||||
1.5 'Product' means any device, component, work or physical object,
|
||||
whether in finished or intermediate form, arising from the use,
|
||||
application or processing of Covered Source.
|
||||
|
||||
1.6 'Make' means to create or configure something, whether by
|
||||
manufacture, assembly, compiling, loading or applying Covered
|
||||
Source or another Product or otherwise.
|
||||
|
||||
1.7 'Available Component' means any part, sub-assembly, library or
|
||||
code which:
|
||||
|
||||
a) is licensed to You as Complete Source under a Compatible
|
||||
Licence; or
|
||||
|
||||
b) is available, at the time a Product or the Source containing
|
||||
it is first Conveyed, to You and any other prospective
|
||||
licensees
|
||||
|
||||
i) as a physical part with sufficient rights and
|
||||
information (including any configuration and
|
||||
programming files and information about its
|
||||
characteristics and interfaces) to enable it either to
|
||||
be Made itself, or to be sourced and used to Make the
|
||||
Product; or
|
||||
ii) as part of the normal distribution of a tool used to
|
||||
design or Make the Product.
|
||||
|
||||
1.8 'Complete Source' means the set of all Source necessary to Make
|
||||
a Product, in the preferred form for making modifications,
|
||||
including necessary installation and interfacing information
|
||||
both for the Product, and for any included Available Components.
|
||||
If the format is proprietary, it must also be made available in
|
||||
a format (if the proprietary tool can create it) which is
|
||||
viewable with a tool available to potential licensees and
|
||||
licensed under a licence approved by the Free Software
|
||||
Foundation or the Open Source Initiative. Complete Source need
|
||||
not include the Source of any Available Component, provided that
|
||||
You include in the Complete Source sufficient information to
|
||||
enable a recipient to Make or source and use the Available
|
||||
Component to Make the Product.
|
||||
|
||||
1.9 'Source Location' means a location where a Licensor has placed
|
||||
Covered Source, and which that Licensor reasonably believes will
|
||||
remain easily accessible for at least three years for anyone to
|
||||
obtain a digital copy.
|
||||
|
||||
1.10 'Notice' means copyright, acknowledgement and trademark notices,
|
||||
Source Location references, modification notices (subsection
|
||||
3.3(b)) and all notices that refer to this Licence and to the
|
||||
disclaimer of warranties that are included in the Covered
|
||||
Source.
|
||||
|
||||
1.11 'Licensee' or 'You' means any person exercising rights under
|
||||
this Licence.
|
||||
|
||||
1.12 'Licensor' means a natural or legal person who creates or
|
||||
modifies Covered Source. A person may be a Licensee and a
|
||||
Licensor at the same time.
|
||||
|
||||
1.13 'Convey' means to communicate to the public or distribute.
|
||||
|
||||
|
||||
2 Applicability
|
||||
|
||||
2.1 This Licence governs the use, copying, modification, Conveying
|
||||
of Covered Source and Products, and the Making of Products. By
|
||||
exercising any right granted under this Licence, You irrevocably
|
||||
accept these terms and conditions.
|
||||
|
||||
2.2 This Licence is granted by the Licensor directly to You, and
|
||||
shall apply worldwide and without limitation in time.
|
||||
|
||||
2.3 You shall not attempt to restrict by contract or otherwise the
|
||||
rights granted under this Licence to other Licensees.
|
||||
|
||||
2.4 This Licence is not intended to restrict fair use, fair dealing,
|
||||
or any other similar right.
|
||||
|
||||
|
||||
3 Copying, Modifying and Conveying Covered Source
|
||||
|
||||
3.1 You may copy and Convey verbatim copies of Covered Source, in
|
||||
any medium, provided You retain all Notices.
|
||||
|
||||
3.2 You may modify Covered Source, other than Notices, provided that
|
||||
You irrevocably undertake to make that modified Covered Source
|
||||
available from a Source Location should You Convey a Product in
|
||||
circumstances where the recipient does not otherwise receive a
|
||||
copy of the modified Covered Source. In each case subsection 3.3
|
||||
shall apply.
|
||||
|
||||
You may only delete Notices if they are no longer applicable to
|
||||
the corresponding Covered Source as modified by You and You may
|
||||
add additional Notices applicable to Your modifications.
|
||||
Including Covered Source in a larger work is modifying the
|
||||
Covered Source, and the larger work becomes modified Covered
|
||||
Source.
|
||||
|
||||
3.3 You may Convey modified Covered Source (with the effect that You
|
||||
shall also become a Licensor) provided that You:
|
||||
|
||||
a) retain Notices as required in subsection 3.2;
|
||||
|
||||
b) add a Notice to the modified Covered Source stating that You
|
||||
have modified it, with the date and brief description of how
|
||||
You have modified it;
|
||||
|
||||
c) add a Source Location Notice for the modified Covered Source
|
||||
if You Convey in circumstances where the recipient does not
|
||||
otherwise receive a copy of the modified Covered Source; and
|
||||
|
||||
d) license the modified Covered Source under the terms and
|
||||
conditions of this Licence (or, as set out in subsection
|
||||
8.3, a later version, if permitted by the licence of the
|
||||
original Covered Source). Such modified Covered Source must
|
||||
be licensed as a whole, but excluding Available Components
|
||||
contained in it, which remain licensed under their own
|
||||
applicable licences.
|
||||
|
||||
|
||||
4 Making and Conveying Products
|
||||
|
||||
You may Make Products, and/or Convey them, provided that You either
|
||||
provide each recipient with a copy of the Complete Source or ensure
|
||||
that each recipient is notified of the Source Location of the Complete
|
||||
Source. That Complete Source is Covered Source, and You must
|
||||
accordingly satisfy Your obligations set out in subsection 3.3. If
|
||||
specified in a Notice, the Product must visibly and securely display
|
||||
the Source Location on it or its packaging or documentation in the
|
||||
manner specified in that Notice.
|
||||
|
||||
|
||||
5 Research and Development
|
||||
|
||||
You may Convey Covered Source, modified Covered Source or Products to
|
||||
a legal entity carrying out development, testing or quality assurance
|
||||
work on Your behalf provided that the work is performed on terms which
|
||||
prevent the entity from both using the Source or Products for its own
|
||||
internal purposes and Conveying the Source or Products or any
|
||||
modifications to them to any person other than You. Any modifications
|
||||
made by the entity shall be deemed to be made by You pursuant to
|
||||
subsection 3.2.
|
||||
|
||||
|
||||
6 DISCLAIMER AND LIABILITY
|
||||
|
||||
6.1 DISCLAIMER OF WARRANTY -- The Covered Source and any Products
|
||||
are provided 'as is' and any express or implied warranties,
|
||||
including, but not limited to, implied warranties of
|
||||
merchantability, of satisfactory quality, non-infringement of
|
||||
third party rights, and fitness for a particular purpose or use
|
||||
are disclaimed in respect of any Source or Product to the
|
||||
maximum extent permitted by law. The Licensor makes no
|
||||
representation that any Source or Product does not or will not
|
||||
infringe any patent, copyright, trade secret or other
|
||||
proprietary right. The entire risk as to the use, quality, and
|
||||
performance of any Source or Product shall be with You and not
|
||||
the Licensor. This disclaimer of warranty is an essential part
|
||||
of this Licence and a condition for the grant of any rights
|
||||
granted under this Licence.
|
||||
|
||||
6.2 EXCLUSION AND LIMITATION OF LIABILITY -- The Licensor shall, to
|
||||
the maximum extent permitted by law, have no liability for
|
||||
direct, indirect, special, incidental, consequential, exemplary,
|
||||
punitive or other damages of any character including, without
|
||||
limitation, procurement of substitute goods or services, loss of
|
||||
use, data or profits, or business interruption, however caused
|
||||
and on any theory of contract, warranty, tort (including
|
||||
negligence), product liability or otherwise, arising in any way
|
||||
in relation to the Covered Source, modified Covered Source
|
||||
and/or the Making or Conveyance of a Product, even if advised of
|
||||
the possibility of such damages, and You shall hold the
|
||||
Licensor(s) free and harmless from any liability, costs,
|
||||
damages, fees and expenses, including claims by third parties,
|
||||
in relation to such use.
|
||||
|
||||
|
||||
7 Patents
|
||||
|
||||
7.1 Subject to the terms and conditions of this Licence, each
|
||||
Licensor hereby grants to You a perpetual, worldwide,
|
||||
non-exclusive, no-charge, royalty-free, irrevocable (except as
|
||||
stated in subsections 7.2 and 8.4) patent licence to Make, have
|
||||
Made, use, offer to sell, sell, import, and otherwise transfer
|
||||
the Covered Source and Products, where such licence applies only
|
||||
to those patent claims licensable by such Licensor that are
|
||||
necessarily infringed by exercising rights under the Covered
|
||||
Source as Conveyed by that Licensor.
|
||||
|
||||
7.2 If You institute patent litigation against any entity (including
|
||||
a cross-claim or counterclaim in a lawsuit) alleging that the
|
||||
Covered Source or a Product constitutes direct or contributory
|
||||
patent infringement, or You seek any declaration that a patent
|
||||
licensed to You under this Licence is invalid or unenforceable
|
||||
then any rights granted to You under this Licence shall
|
||||
terminate as of the date such process is initiated.
|
||||
|
||||
|
||||
8 General
|
||||
|
||||
8.1 If any provisions of this Licence are or subsequently become
|
||||
invalid or unenforceable for any reason, the remaining
|
||||
provisions shall remain effective.
|
||||
|
||||
8.2 You shall not use any of the name (including acronyms and
|
||||
abbreviations), image, or logo by which the Licensor or CERN is
|
||||
known, except where needed to comply with section 3, or where
|
||||
the use is otherwise allowed by law. Any such permitted use
|
||||
shall be factual and shall not be made so as to suggest any kind
|
||||
of endorsement or implication of involvement by the Licensor or
|
||||
its personnel.
|
||||
|
||||
8.3 CERN may publish updated versions and variants of this Licence
|
||||
which it considers to be in the spirit of this version, but may
|
||||
differ in detail to address new problems or concerns. New
|
||||
versions will be published with a unique version number and a
|
||||
variant identifier specifying the variant. If the Licensor has
|
||||
specified that a given variant applies to the Covered Source
|
||||
without specifying a version, You may treat that Covered Source
|
||||
as being released under any version of the CERN-OHL with that
|
||||
variant. If no variant is specified, the Covered Source shall be
|
||||
treated as being released under CERN-OHL-S. The Licensor may
|
||||
also specify that the Covered Source is subject to a specific
|
||||
version of the CERN-OHL or any later version in which case You
|
||||
may apply this or any later version of CERN-OHL with the same
|
||||
variant identifier published by CERN.
|
||||
|
||||
8.4 This Licence shall terminate with immediate effect if You fail
|
||||
to comply with any of its terms and conditions.
|
||||
|
||||
8.5 However, if You cease all breaches of this Licence, then Your
|
||||
Licence from any Licensor is reinstated unless such Licensor has
|
||||
terminated this Licence by giving You, while You remain in
|
||||
breach, a notice specifying the breach and requiring You to cure
|
||||
it within 30 days, and You have failed to come into compliance
|
||||
in all material respects by the end of the 30 day period. Should
|
||||
You repeat the breach after receipt of a cure notice and
|
||||
subsequent reinstatement, this Licence will terminate
|
||||
immediately and permanently. Section 6 shall continue to apply
|
||||
after any termination.
|
||||
|
||||
8.6 This Licence shall not be enforceable except by a Licensor
|
||||
acting as such, and third party beneficiary rights are
|
||||
specifically excluded.
|
||||
@@ -6,9 +6,7 @@ Citation: F. Leonarski, M. Bruckner, C. Lopez-Cuenca, A. Mozzanica, H.-C. Stadle
|
||||
|
||||
## License
|
||||
|
||||
Software components are licensed with GNU Public License version 3.
|
||||
|
||||
Hardware components are licensed with Strongly-reciprocal CERN Open Hardware Licence version 2.
|
||||
Operating Jungfraujoch, as well as sharing sources code requires explicit license from PSI.
|
||||
|
||||
## Hardware requirements
|
||||
1. JUNGFRAU detector (optimally 4M with 2 kHz enabled read-out boards)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include "JFJochBroker.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_JFJOCHBROKER_H
|
||||
#define JUNGFRAUJOCH_JFJOCHBROKER_H
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "JFJochBrokerParser.h"
|
||||
#include "JFJochBroker.h"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#ifndef JUNGFRAUJOCH_JFJOCHBROKERPARSER_H
|
||||
#define JUNGFRAUJOCH_JFJOCHBROKERPARSER_H
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include "JFJochServices.h"
|
||||
#include "../common/JFJochException.h"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_JFJOCHSERVICES_H
|
||||
#define JUNGFRAUJOCH_JFJOCHSERVICES_H
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include <thread>
|
||||
|
||||
@@ -64,7 +63,11 @@ void JFJochStateMachine::TakePedestalInternalG0(std::unique_lock<std::mutex> &ul
|
||||
state = JFJochState::Pedestal;
|
||||
DiffractionExperiment local_experiment(experiment);
|
||||
local_experiment.Mode(DetectorMode::PedestalG0);
|
||||
local_experiment.StorageCellStart(16 - local_experiment.GetStorageCellNumber());
|
||||
|
||||
if (local_experiment.GetStorageCellNumber() == 1)
|
||||
local_experiment.StorageCellStart(15);
|
||||
else
|
||||
local_experiment.StorageCellStart(0);
|
||||
|
||||
if (!cancel_sequence && (local_experiment.GetPedestalG0Frames() > 0)) {
|
||||
services.Start(local_experiment, *calibration);
|
||||
@@ -88,6 +91,8 @@ void JFJochStateMachine::TakePedestalInternalG1(std::unique_lock<std::mutex> &ul
|
||||
|
||||
if (local_experiment.GetStorageCellNumber() == 2)
|
||||
local_experiment.StorageCellStart((storage_cell + 15) % 16); // one previous
|
||||
else
|
||||
local_experiment.StorageCellStart(15);
|
||||
|
||||
if (!cancel_sequence && (local_experiment.GetPedestalG1Frames() > 0)) {
|
||||
services.Start(local_experiment, *calibration);
|
||||
@@ -111,6 +116,8 @@ void JFJochStateMachine::TakePedestalInternalG2(std::unique_lock<std::mutex> &ul
|
||||
|
||||
if (local_experiment.GetStorageCellNumber() == 2)
|
||||
local_experiment.StorageCellStart((storage_cell + 15) % 16); // one previous
|
||||
else
|
||||
local_experiment.StorageCellStart(15);
|
||||
|
||||
if (!cancel_sequence && (local_experiment.GetPedestalG2Frames() > 0)) {
|
||||
services.Start(local_experiment, *calibration);
|
||||
@@ -180,7 +187,10 @@ void JFJochStateMachine::Start(const JFJochProtoBuf::DatasetSettings& settings)
|
||||
ClearAndSetMeasurementStatistics();
|
||||
|
||||
cancel_sequence = false;
|
||||
experiment.StorageCellStart(16 - experiment.GetStorageCellNumber());
|
||||
if (experiment.GetStorageCellNumber() == 1)
|
||||
experiment.StorageCellStart(15);
|
||||
else
|
||||
experiment.StorageCellStart(0);
|
||||
|
||||
try {
|
||||
state = JFJochState::Busy;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_JFJOCHSTATEMACHINE_H
|
||||
#define JUNGFRAUJOCH_JFJOCHSTATEMACHINE_H
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include <fstream>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
+17
-4
@@ -43,11 +43,24 @@ ADD_LIBRARY( CommonFunctions STATIC
|
||||
grpcToJson.h jsonToGrpc.h to_fixed.h
|
||||
DetectorGeometry.cpp DetectorGeometry.h
|
||||
DetectorModuleGeometry.cpp DetectorModuleGeometry.h
|
||||
DetectorSetup.h DetectorSetup.cpp ZeroCopyReturnValue.h Histogram.h)
|
||||
DetectorSetup.h DetectorSetup.cpp ZeroCopyReturnValue.h Histogram.h DiffractionGeometry.h
|
||||
ROIFilter.h
|
||||
CUDAWrapper.cpp
|
||||
CUDAWrapper.h
|
||||
NUMAHWPolicy.cpp
|
||||
NUMAHWPolicy.h)
|
||||
|
||||
TARGET_LINK_LIBRARIES(CommonFunctions Compression FrameSerialize libzmq JFCalibration JFJochProtoBuf -lrt)
|
||||
|
||||
IF(HAS_NUMAIF AND NUMA_LIBRARY)
|
||||
TARGET_COMPILE_DEFINITIONS(CommonFunctions PRIVATE -DJFJOCH_USE_NUMA)
|
||||
TARGET_LINK_LIBRARIES(CommonFunctions ${NUMA_LIBRARY})
|
||||
IF (CMAKE_CUDA_COMPILER)
|
||||
TARGET_SOURCES(CommonFunctions PRIVATE CUDAWrapper.cu )
|
||||
TARGET_LINK_LIBRARIES(CommonFunctions ${CUDART_LIBRARY} ${CMAKE_DL_LIBS} rt)
|
||||
ENDIF()
|
||||
|
||||
IF(HAS_NUMAIF AND HAS_NUMA_H AND NUMA_LIBRARY)
|
||||
TARGET_COMPILE_DEFINITIONS(CommonFunctions PUBLIC JFJOCH_USE_NUMA)
|
||||
TARGET_LINK_LIBRARIES(CommonFunctions ${NUMA_LIBRARY})
|
||||
MESSAGE(STATUS "NUMA memory/CPU pinning enabled")
|
||||
ELSE()
|
||||
MESSAGE(WARNING "NUMA memory/CPU pinning disabled")
|
||||
ENDIF()
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JFJOCH_USE_CUDA
|
||||
|
||||
#include "CUDAWrapper.h"
|
||||
|
||||
int32_t get_gpu_count() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void set_gpu(int32_t dev_id) {}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include "CUDAWrapper.h"
|
||||
#include "JFJochException.h"
|
||||
|
||||
inline void cuda_err(cudaError_t val) {
|
||||
if (val != cudaSuccess)
|
||||
throw JFJochException(JFJochExceptionCategory::GPUCUDAError, cudaGetErrorString(val));
|
||||
}
|
||||
|
||||
int32_t get_gpu_count() {
|
||||
int device_count;
|
||||
cuda_err(cudaGetDeviceCount(&device_count));
|
||||
return device_count;
|
||||
}
|
||||
|
||||
void set_gpu(int32_t dev_id) {
|
||||
auto dev_count = get_gpu_count();
|
||||
|
||||
if ((dev_id < 0) || (dev_id >= dev_count))
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Device ID cannot be negative");
|
||||
|
||||
cuda_err(cudaSetDevice(dev_id));
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_CUDAWRAPPER_H
|
||||
#define JUNGFRAUJOCH_CUDAWRAPPER_H
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
int32_t get_gpu_count();
|
||||
void set_gpu(int32_t dev_id);
|
||||
|
||||
#endif //JUNGFRAUJOCH_CUDAWRAPPER_H
|
||||
+1
-2
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include <cmath>
|
||||
#include "Coord.h"
|
||||
|
||||
+1
-2
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef INDEX_COORD_H
|
||||
#define INDEX_COORD_H
|
||||
|
||||
+13
-7
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef DEFINITIONS_H
|
||||
#define DEFINITIONS_H
|
||||
@@ -18,12 +17,12 @@
|
||||
|
||||
#define FPGA_BUFFER_LOCATION_SIZE (RAW_MODULE_SIZE * sizeof(short))
|
||||
|
||||
#define MIN_COUNT_TIME_IN_US 10
|
||||
#define MIN_COUNT_TIME_IN_US 5
|
||||
#define MIN_FRAME_TIME_HALF_SPEED_IN_US 1000
|
||||
#define MIN_FRAME_TIME_FULL_SPEED_IN_US 470
|
||||
#define MAX_FRAME_TIME 2000
|
||||
#define MAX_SUMMATION 5000
|
||||
|
||||
#define MIN_STORAGE_CELL_DELAY_IN_NS 2100
|
||||
#define READOUT_TIME_IN_US 20
|
||||
|
||||
#define GRPC_MAX_MESSAGE_SIZE (1000L*1000L*1000L)
|
||||
@@ -49,12 +48,11 @@
|
||||
#define DEFAULT_G2_FACTOR (-0.1145)
|
||||
|
||||
// For FPGA
|
||||
/* This number is unique and is declared in ~snap/ActionTypes.md */
|
||||
#define ACTION_TYPE 0x52324158
|
||||
#define RELEASE_LEVEL 0x0035
|
||||
#define RELEASE_LEVEL 0x003C
|
||||
|
||||
#define MODE_CONV 0x0001L
|
||||
#define MODE_INTERNAL_PACKET_GEN 0x0002L
|
||||
#define MODE_NONBLOCKING_ON_WR 0x0002L // Don't block acquisition if there is no WR available
|
||||
|
||||
#define TASK_NO_DATA_STREAM UINT16_MAX
|
||||
|
||||
@@ -117,4 +115,12 @@
|
||||
|
||||
#define CTRL_REGISTER_IDLE (1<<1u)
|
||||
|
||||
#define HANDLE_START (UINT32_MAX - 1)
|
||||
#define HANDLE_SKIP_FRAME (UINT32_MAX - 2)
|
||||
#define HANDLE_END (UINT32_MAX )
|
||||
|
||||
#define INT_PKT_GEN_DEBUG 0x0
|
||||
#define INT_PKT_GEN_TIMESTAMP 0xABCDEFABCDEF
|
||||
#define INT_PKT_GEN_BUNCHID 0xCACACACACA
|
||||
#define INT_PKT_GEN_EXPTTIME 10000
|
||||
#endif //DEFINITIONS_H
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include "DetectorGeometry.h"
|
||||
#include "JFJochException.h"
|
||||
@@ -29,6 +28,8 @@ DetectorGeometry::DetectorGeometry(int32_t nmodules, int32_t horizontal_stacking
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Gap x has to be non-negative");
|
||||
if (gap_y < 0)
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Gap y has to be non-negative");
|
||||
if (nmodules < horizontal_stacking)
|
||||
horizontal_stacking = nmodules;
|
||||
|
||||
width = horizontal_stacking * CONVERTED_MODULE_COLS + (horizontal_stacking - 1) * gap_x;
|
||||
int64_t conv_lines = nmodules / horizontal_stacking + (nmodules % horizontal_stacking > 0 ? 1 : 0);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_DETECTORGEOMETRY_H
|
||||
#define JUNGFRAUJOCH_DETECTORGEOMETRY_H
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "DetectorModuleGeometry.h"
|
||||
#include "JFJochException.h"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#ifndef JUNGFRAUJOCH_DETECTORMODULEGEOMETRY_H
|
||||
#define JUNGFRAUJOCH_DETECTORMODULEGEOMETRY_H
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "DetectorSetup.h"
|
||||
#include "JFJochException.h"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#ifndef JUNGFRAUJOCH_DETECTORSETUP_H
|
||||
#define JUNGFRAUJOCH_DETECTORSETUP_H
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include <numeric>
|
||||
#include <cmath>
|
||||
|
||||
#include "NetworkAddressConvert.h"
|
||||
@@ -37,9 +35,6 @@ DiffractionExperiment::DiffractionExperiment() : DiffractionExperiment(DetectorG
|
||||
DiffractionExperiment::DiffractionExperiment(const DetectorSetup& det_setup) {
|
||||
dataset.set_photon_energy_kev(WVL_1A_IN_KEV);
|
||||
dataset.set_detector_distance_mm(100);
|
||||
dataset.mutable_scattering_vector()->set_x(0);
|
||||
dataset.mutable_scattering_vector()->set_y(0);
|
||||
dataset.mutable_scattering_vector()->set_z(1);
|
||||
|
||||
dataset.set_data_file_count(1);
|
||||
dataset.set_file_prefix("test");
|
||||
@@ -51,6 +46,12 @@ DiffractionExperiment::DiffractionExperiment(const DetectorSetup& det_setup) {
|
||||
|
||||
dataset.set_compression(JFJochProtoBuf::BSHUF_LZ4);
|
||||
|
||||
dataset.set_rad_int_polarization_corr(false);
|
||||
dataset.set_rad_int_solid_angle_corr(false);
|
||||
dataset.set_save_calibration(false);
|
||||
|
||||
internal.set_debug_pixel_mask(false);
|
||||
|
||||
internal.set_ndatastreams(1);
|
||||
|
||||
internal.set_frame_time_us(MIN_FRAME_TIME_HALF_SPEED_IN_US);
|
||||
@@ -73,7 +74,7 @@ DiffractionExperiment::DiffractionExperiment(const DetectorSetup& det_setup) {
|
||||
|
||||
internal.set_storage_cells(1);
|
||||
internal.set_storage_cell_start(15);
|
||||
|
||||
internal.set_storage_cell_delay_ns(10*1000);
|
||||
Detector(det_setup);
|
||||
Mode(DetectorMode::Conversion);
|
||||
}
|
||||
@@ -106,7 +107,7 @@ DiffractionExperiment &DiffractionExperiment::Mode(DetectorMode input) {
|
||||
}
|
||||
|
||||
DiffractionExperiment &DiffractionExperiment::DataStreams(int64_t input) {
|
||||
check_max("Number of data streams", input, 7);
|
||||
check_max("Number of data streams", input, 16);
|
||||
check_min("Number of data streams", input, 1);
|
||||
internal.set_ndatastreams(input);
|
||||
return *this;
|
||||
@@ -209,19 +210,6 @@ DiffractionExperiment &DiffractionExperiment::DetectorDistance_mm(float input) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
DiffractionExperiment &DiffractionExperiment::ScatteringVector(Coord input) {
|
||||
auto c = input.Normalize();
|
||||
dataset.mutable_scattering_vector()->set_x(c.x);
|
||||
dataset.mutable_scattering_vector()->set_y(c.y);
|
||||
dataset.mutable_scattering_vector()->set_z(c.z);
|
||||
return *this;
|
||||
}
|
||||
|
||||
DiffractionExperiment &DiffractionExperiment::ScatteringVector() {
|
||||
dataset.clear_scattering_vector();
|
||||
return *this;
|
||||
}
|
||||
|
||||
DiffractionExperiment &DiffractionExperiment::FilePrefix(std::string input) {
|
||||
// File prefix with front slash is not allowed for security reasons
|
||||
if (input.front() == '/')
|
||||
@@ -349,9 +337,9 @@ DiffractionExperiment &DiffractionExperiment::SpaceGroupNumber(int64_t input) {
|
||||
DiffractionExperiment &DiffractionExperiment::StorageCells(int64_t input) {
|
||||
check_min("Storage cell number", input, 1);
|
||||
check_max("Storage cell number", input, 16);
|
||||
if ((input != 1) && (input != 2) && (input != 4) && (input != 8) && (input != 16))
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
|
||||
"Storage cell count invalid, must be power of 2");
|
||||
//if ((input != 1) && (input != 2) && (input != 4) && (input != 8) && (input != 16))
|
||||
// throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
|
||||
// "Storage cell count invalid, must be power of 2");
|
||||
internal.set_storage_cells(input);
|
||||
return *this;
|
||||
}
|
||||
@@ -551,11 +539,7 @@ float DiffractionExperiment::GetDetectorDistance_mm() const {
|
||||
}
|
||||
|
||||
Coord DiffractionExperiment::GetScatteringVector() const {
|
||||
if (dataset.has_scattering_vector())
|
||||
return Coord(dataset.scattering_vector().x(), dataset.scattering_vector().y(), dataset.scattering_vector().z())
|
||||
* (dataset.photon_energy_kev() / WVL_1A_IN_KEV);
|
||||
else
|
||||
return {0,0,dataset.photon_energy_kev() / WVL_1A_IN_KEV};
|
||||
return {0,0,dataset.photon_energy_kev() / WVL_1A_IN_KEV};
|
||||
}
|
||||
|
||||
std::string DiffractionExperiment::GetFilePrefix() const {
|
||||
@@ -773,23 +757,6 @@ bool DiffractionExperiment::HasUnitCell() const {
|
||||
return dataset.has_unit_cell();
|
||||
}
|
||||
|
||||
float DiffractionExperiment::ResToPxl(float resolution) const {
|
||||
if (resolution == 0)
|
||||
return INFINITY;
|
||||
|
||||
float sin_theta = GetWavelength_A() / (2 * resolution);
|
||||
float theta = asinf(sin_theta);
|
||||
float tan_2theta = tanf(2 * theta);
|
||||
return tan_2theta * GetDetectorDistance_mm() / GetPixelSize_mm();
|
||||
}
|
||||
|
||||
float DiffractionExperiment::CalcRadIntSolidAngleCorr(float q) const {
|
||||
float sin_theta = q * GetWavelength_A() / (4 * static_cast<float>(M_PI));
|
||||
float cos_two_theta = 1.0f - 2.0f * sin_theta * sin_theta; // cos(2*alpha) = 1 - 2 * sin(alpha)^2
|
||||
float cos_two_theta_3 = cos_two_theta * cos_two_theta * cos_two_theta;
|
||||
return cos_two_theta_3;
|
||||
}
|
||||
|
||||
Coord DiffractionExperiment::LabCoord(float detector_x, float detector_y) const {
|
||||
// Assumes planar detector, 90 deg towards beam
|
||||
return {(detector_x - GetBeamX_pxl()) * GetPixelSize_mm() ,
|
||||
@@ -797,20 +764,6 @@ Coord DiffractionExperiment::LabCoord(float detector_x, float detector_y) const
|
||||
GetDetectorDistance_mm()};
|
||||
}
|
||||
|
||||
float DiffractionExperiment::PxlToRes(float detector_x, float detector_y) const {
|
||||
auto lab = LabCoord(detector_x, detector_y);
|
||||
|
||||
float beam_path = lab.Length();
|
||||
if (beam_path == GetDetectorDistance_mm()) return std::numeric_limits<float>::infinity();
|
||||
|
||||
float cos_2theta = GetDetectorDistance_mm() / beam_path;
|
||||
// cos(2theta) = cos(theta)^2 - sin(theta)^2
|
||||
// cos(2theta) = 1 - 2*sin(theta)^2
|
||||
// Technically two solutions for two theta, but it makes sense only to take positive one in this case
|
||||
float sin_theta = sqrtf((1-cos_2theta)/2);
|
||||
return GetWavelength_A() / (2 * sin_theta);
|
||||
}
|
||||
|
||||
int64_t DiffractionExperiment::GetSpaceGroupNumber() const {
|
||||
return dataset.space_group_number();
|
||||
}
|
||||
@@ -880,7 +833,7 @@ DiffractionExperiment::operator JFJochProtoBuf::DetectorInput() const {
|
||||
}
|
||||
ret.set_storage_cell_start(GetStorageCellStart());
|
||||
ret.set_storage_cell_number(GetStorageCellNumber());
|
||||
ret.set_storage_cell_delay(7.5);
|
||||
ret.set_storage_cell_delay_ns(GetStorageCellDelay().count());
|
||||
|
||||
if (GetStorageCellNumber() > 1) {
|
||||
ret.set_period_us((GetFrameTime().count() +10) * GetStorageCellNumber());
|
||||
@@ -946,11 +899,9 @@ void DiffractionExperiment::LoadDatasetSettings(const JFJochProtoBuf::DatasetSet
|
||||
SetUnitCell();
|
||||
SpaceGroupNumber(settings.space_group_number());
|
||||
SampleName(settings.sample_name());
|
||||
if (settings.has_scattering_vector())
|
||||
ScatteringVector({0,0,1});
|
||||
Compression(settings.compression());
|
||||
ApplyPixelMaskInFPGA(settings.apply_pixel_mask());
|
||||
Binning2x2(settings.binning2x2());
|
||||
SaveCalibration(settings.save_calibration());
|
||||
} catch (...) {
|
||||
dataset = tmp;
|
||||
throw;
|
||||
@@ -982,7 +933,8 @@ void DiffractionExperiment::LoadDetectorSettings(const JFJochProtoBuf::DetectorS
|
||||
|
||||
if (settings.has_pedestal_g2_frames())
|
||||
PedestalG2Frames(settings.pedestal_g2_frames());
|
||||
|
||||
if (settings.has_storage_cell_delay_ns())
|
||||
StorageCellDelay(std::chrono::nanoseconds(settings.storage_cell_delay_ns()));
|
||||
ConversionOnCPU(settings.conversion_on_cpu());
|
||||
} catch (...) {
|
||||
internal = tmp;
|
||||
@@ -1000,6 +952,7 @@ JFJochProtoBuf::DetectorSettings DiffractionExperiment::GetDetectorSettings() co
|
||||
ret.set_pedestal_g0_frames(GetPedestalG0Frames());
|
||||
ret.set_pedestal_g1_frames(GetPedestalG1Frames());
|
||||
ret.set_pedestal_g2_frames(GetPedestalG2Frames());
|
||||
ret.set_storage_cell_delay_ns(GetStorageCellDelay().count());
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1079,6 +1032,7 @@ void DiffractionExperiment::FillMessage(StartMessage &message) const {
|
||||
message.compression_block_size = JFJochBitShuffleCompressor::DefaultBlockSize;
|
||||
message.pixel_bit_depth = GetPixelDepth() * 8;
|
||||
message.storage_cell_number = GetStorageCellNumber();
|
||||
message.storage_cell_delay_ns = GetStorageCellDelay().count();
|
||||
message.file_prefix = GetFilePrefix();
|
||||
message.pixel_signed = IsPixelSigned();
|
||||
message.sample_name = GetSampleName();
|
||||
@@ -1111,13 +1065,13 @@ void DiffractionExperiment::FillMessage(StartMessage &message) const {
|
||||
}
|
||||
|
||||
DiffractionExperiment &DiffractionExperiment::ApplyPixelMaskInFPGA(bool input) {
|
||||
dataset.set_apply_pixel_mask(input);
|
||||
internal.set_debug_pixel_mask(!input);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool DiffractionExperiment::GetApplyPixelMaskInFPGA() const {
|
||||
if (GetDetectorMode() == DetectorMode::Conversion)
|
||||
return dataset.apply_pixel_mask();
|
||||
return !internal.debug_pixel_mask();
|
||||
else
|
||||
return false;
|
||||
}
|
||||
@@ -1204,3 +1158,77 @@ bool DiffractionExperiment::GetPedestalWithExternalTrigger() const {
|
||||
return (GetStorageCellNumber() > 1);
|
||||
}
|
||||
|
||||
DiffractionExperiment &DiffractionExperiment::ApplySolidAngleCorr(bool input) {
|
||||
dataset.set_rad_int_solid_angle_corr(input);
|
||||
return *this;
|
||||
}
|
||||
|
||||
DiffractionExperiment &DiffractionExperiment::ApplyPolarizationCorr(bool input) {
|
||||
dataset.set_rad_int_polarization_corr(input);
|
||||
return *this;
|
||||
}
|
||||
|
||||
DiffractionExperiment &DiffractionExperiment::PolarizationFactor(float input) {
|
||||
dataset.set_rad_int_polarization_factor(input);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool DiffractionExperiment::GetApplySolidAngleCorr() const {
|
||||
return dataset.rad_int_solid_angle_corr();
|
||||
}
|
||||
|
||||
bool DiffractionExperiment::GetApplyPolarizationCorr() const {
|
||||
return dataset.rad_int_polarization_corr();
|
||||
}
|
||||
|
||||
float DiffractionExperiment::GetPolarizationFactor() const {
|
||||
return dataset.rad_int_polarization_factor();
|
||||
}
|
||||
|
||||
DiffractionExperiment &DiffractionExperiment::ApplyROI(bool input) {
|
||||
internal.set_roi_apply(input);
|
||||
return *this;
|
||||
}
|
||||
|
||||
DiffractionExperiment &DiffractionExperiment::AddROIRectangle(int32_t x, int32_t y, int32_t width, int32_t height) {
|
||||
auto *tmp = internal.add_roi_rectangle();
|
||||
tmp->set_x0(x);
|
||||
tmp->set_y0(y);
|
||||
tmp->set_width(width);
|
||||
tmp->set_height(height);
|
||||
return *this;
|
||||
}
|
||||
|
||||
DiffractionExperiment &DiffractionExperiment::ClearROI() {
|
||||
internal.clear_roi_rectangle();
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool DiffractionExperiment::GetApplyROI() const {
|
||||
return internal.roi_apply();
|
||||
}
|
||||
|
||||
void DiffractionExperiment::SetupROIFilter(ROIFilter &filter) {
|
||||
for (const auto& i: internal.roi_rectangle())
|
||||
filter.SetRectangle(i.x0(), i.y0(), i.width(), i.height());
|
||||
}
|
||||
|
||||
DiffractionExperiment &DiffractionExperiment::SaveCalibration(bool input) {
|
||||
dataset.set_save_calibration(input);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool DiffractionExperiment::GetSaveCalibration() const {
|
||||
return dataset.save_calibration();
|
||||
}
|
||||
|
||||
DiffractionExperiment &DiffractionExperiment::StorageCellDelay(std::chrono::nanoseconds input) {
|
||||
check_min("Storage cell delay [ns]", input.count(), MIN_STORAGE_CELL_DELAY_IN_NS);
|
||||
internal.set_storage_cell_delay_ns(input.count());
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::chrono::nanoseconds DiffractionExperiment::GetStorageCellDelay() const {
|
||||
return std::chrono::nanoseconds(internal.storage_cell_delay_ns());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef DIFFRACTIONEXPERIMENT_H
|
||||
#define DIFFRACTIONEXPERIMENT_H
|
||||
@@ -15,9 +14,9 @@
|
||||
#include "UnitCell.h"
|
||||
#include "Coord.h"
|
||||
#include "Definitions.h"
|
||||
#include "../frame_serialize/StartMessage.h"
|
||||
#include "../frame_serialize/EndMessage.h"
|
||||
#include "../frame_serialize/CBORMessages.h"
|
||||
#include "DetectorSetup.h"
|
||||
#include "ROIFilter.h"
|
||||
|
||||
enum class DetectorMode : int {
|
||||
Conversion, Raw, PedestalG0, PedestalG1, PedestalG2
|
||||
@@ -59,8 +58,6 @@ public:
|
||||
DiffractionExperiment& BeamY_pxl(float input);
|
||||
DiffractionExperiment& DetectorDistance_mm(float input);
|
||||
|
||||
DiffractionExperiment& ScatteringVector(Coord input);
|
||||
DiffractionExperiment& ScatteringVector();
|
||||
DiffractionExperiment& FilePrefix(std::string input);
|
||||
DiffractionExperiment& DataFileCount(int64_t input);
|
||||
|
||||
@@ -131,6 +128,9 @@ public:
|
||||
std::chrono::microseconds GetImageCountTime() const;
|
||||
std::chrono::microseconds GetFrameCountTime() const;
|
||||
|
||||
DiffractionExperiment& StorageCellDelay(std::chrono::nanoseconds input);
|
||||
std::chrono::nanoseconds GetStorageCellDelay() const;
|
||||
|
||||
float GetPhotonEnergy_keV() const;
|
||||
float GetWavelength_A() const;
|
||||
float GetBeamX_pxl() const;
|
||||
@@ -184,10 +184,7 @@ public:
|
||||
UnitCell GetUnitCell() const;
|
||||
bool HasUnitCell() const;
|
||||
|
||||
float ResToPxl(float resolution) const;
|
||||
Coord LabCoord(float detector_x, float detector_y) const;
|
||||
float PxlToRes(float detector_x, float detector_y) const;
|
||||
float CalcRadIntSolidAngleCorr(float q) const;
|
||||
|
||||
float GetLowQForRadialInt_recipA() const;
|
||||
float GetHighQForRadialInt_recipA() const;
|
||||
@@ -217,6 +214,22 @@ public:
|
||||
|
||||
void GetDetectorModuleHostname(std::vector<std::string>& output) const;
|
||||
bool GetPedestalWithExternalTrigger() const;
|
||||
|
||||
DiffractionExperiment& ApplySolidAngleCorr(bool input);
|
||||
DiffractionExperiment& ApplyPolarizationCorr(bool input);
|
||||
DiffractionExperiment& PolarizationFactor(float input);
|
||||
bool GetApplySolidAngleCorr() const;
|
||||
bool GetApplyPolarizationCorr() const;
|
||||
float GetPolarizationFactor() const;
|
||||
|
||||
DiffractionExperiment& ApplyROI(bool input);
|
||||
DiffractionExperiment& AddROIRectangle(int32_t x, int32_t y, int32_t width, int32_t height);
|
||||
DiffractionExperiment& ClearROI();
|
||||
bool GetApplyROI() const;
|
||||
void SetupROIFilter(ROIFilter& filter);
|
||||
|
||||
DiffractionExperiment& SaveCalibration(bool input);
|
||||
bool GetSaveCalibration() const;
|
||||
};
|
||||
|
||||
inline int64_t CalculateStride(const std::chrono::microseconds &frame_time, const std::chrono::microseconds &preview_time) {
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_DIFFRACTIONGEOMETRY_H
|
||||
#define JUNGFRAUJOCH_DIFFRACTIONGEOMETRY_H
|
||||
|
||||
#include "DiffractionExperiment.h"
|
||||
#include <cmath>
|
||||
|
||||
inline Coord DetectorToRecip(const DiffractionExperiment &experiment, float x, float y) {
|
||||
return experiment.LabCoord(x, y).Normalize() / experiment.GetWavelength_A() - experiment.GetScatteringVector();
|
||||
}
|
||||
|
||||
inline std::pair<float, float> RecipToDector(const DiffractionExperiment &experiment, const Coord &recip) {
|
||||
auto S = recip + experiment.GetScatteringVector();
|
||||
float coeff = experiment.GetDetectorDistance_mm() / (S.z * experiment.GetPixelSize_mm());
|
||||
float x = experiment.GetBeamX_pxl() + S.x * coeff;
|
||||
float y = experiment.GetBeamY_pxl() + S.y * coeff;
|
||||
return {x, y};
|
||||
}
|
||||
|
||||
inline float CosTwoTheta(const DiffractionExperiment& experiment, float x, float y) {
|
||||
auto lab = experiment.LabCoord(x, y);
|
||||
return experiment.GetDetectorDistance_mm() / lab.Length();
|
||||
}
|
||||
|
||||
inline float Phi(const DiffractionExperiment& experiment, float x, float y) {
|
||||
auto lab = experiment.LabCoord(x, y);
|
||||
return atan2f(lab.y, lab.x);
|
||||
}
|
||||
|
||||
inline float PxlToRes(const DiffractionExperiment& experiment, float x, float y) {
|
||||
float cos_2theta = CosTwoTheta(experiment, x, y);
|
||||
if (cos_2theta == 1.0f)
|
||||
return std::numeric_limits<float>::infinity();
|
||||
|
||||
// cos(2theta) = cos(theta)^2 - sin(theta)^2
|
||||
// cos(2theta) = 1 - 2*sin(theta)^2
|
||||
// Technically two solutions for two theta, but it makes sense only to take positive one in this case
|
||||
float sin_theta = sqrtf((1 - cos_2theta)/2);
|
||||
return experiment.GetWavelength_A() / (2 * sin_theta);
|
||||
}
|
||||
|
||||
inline float ResToPxl(const DiffractionExperiment& experiment, float d) {
|
||||
if (d == 0)
|
||||
return INFINITY;
|
||||
|
||||
float sin_theta = experiment.GetWavelength_A() / (2 * d);
|
||||
float theta = asinf(sin_theta);
|
||||
float tan_2theta = tanf(2 * theta);
|
||||
return tan_2theta * experiment.GetDetectorDistance_mm() / experiment.GetPixelSize_mm();
|
||||
}
|
||||
|
||||
inline float DistFromEwaldSphere(const DiffractionExperiment& experiment, const Coord& recip) {
|
||||
auto S = recip + experiment.GetScatteringVector();
|
||||
return fabsf(S.Length() - (1.0f/experiment.GetWavelength_A()));
|
||||
}
|
||||
|
||||
inline float CalcRadIntSolidAngleCorr(const DiffractionExperiment& experiment, float q) {
|
||||
float sin_theta = q * experiment.GetWavelength_A() / (4 * static_cast<float>(M_PI));
|
||||
float cos_2theta = 1.0f - 2.0f * sin_theta * sin_theta; // cos(2*alpha) = 1 - 2 * sin(alpha)^2
|
||||
float cos_2theta_3 = cos_2theta * cos_2theta * cos_2theta;
|
||||
return cos_2theta_3;
|
||||
}
|
||||
|
||||
inline float CalcRadIntSolidAngleCorr(const DiffractionExperiment& experiment, float x, float y) {
|
||||
float cos_2theta = CosTwoTheta(experiment, x, y);
|
||||
float cos_2theta_3 = cos_2theta * cos_2theta * cos_2theta;
|
||||
return cos_2theta_3;
|
||||
}
|
||||
|
||||
inline float CalcRadIntPolarizationCorr(const DiffractionExperiment& experiment, float x, float y) {
|
||||
auto cos_2theta = CosTwoTheta(experiment, x, y);
|
||||
float cos_2theta_2 = cos_2theta * cos_2theta;
|
||||
float cos_2phi = cosf(2.0f * Phi(experiment, x, y));
|
||||
return 0.5f * (1.0f + cos_2theta_2 - experiment.GetPolarizationFactor() * cos_2phi * (1.0f - cos_2theta_2));
|
||||
}
|
||||
|
||||
inline std::vector<float> CalcRadIntCorr(const DiffractionExperiment& experiment) {
|
||||
std::vector<float> corr(experiment.GetPixelsNum(), 1.0);
|
||||
auto xpixels = experiment.GetXPixelsNum();
|
||||
auto ypixels = experiment.GetYPixelsNum();
|
||||
|
||||
for (int y = 0; y < ypixels; y++) {
|
||||
for (int x = 0; x < xpixels; x++) {
|
||||
if (experiment.GetApplySolidAngleCorr())
|
||||
corr[y * xpixels + x] *= CalcRadIntSolidAngleCorr(experiment,
|
||||
static_cast<float>(x),
|
||||
static_cast<float>(y));
|
||||
if (experiment.GetApplyPolarizationCorr())
|
||||
corr[y * xpixels + x] *= CalcRadIntPolarizationCorr(experiment,
|
||||
static_cast<float>(x),
|
||||
static_cast<float>(y));
|
||||
}
|
||||
}
|
||||
|
||||
return corr;
|
||||
}
|
||||
|
||||
#endif //JUNGFRAUJOCH_DIFFRACTIONGEOMETRY_H
|
||||
@@ -1,8 +1,7 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include "DiffractionSpot.h"
|
||||
#include "RawToConvertedGeometry.h"
|
||||
#include "DiffractionGeometry.h"
|
||||
|
||||
DiffractionSpot::DiffractionSpot(uint32_t col, uint32_t line, int64_t in_photons) {
|
||||
if (in_photons < 0) in_photons = 0;
|
||||
@@ -38,17 +37,16 @@ int64_t DiffractionSpot::PixelCount() const {
|
||||
return pixel_count;
|
||||
}
|
||||
|
||||
Coord DiffractionSpot::LabCoord(const DiffractionExperiment &experiment, uint16_t data_stream) const {
|
||||
Coord DiffractionSpot::LabCoord(const DiffractionExperiment &experiment) const {
|
||||
return experiment.LabCoord(x / (float)photons, y / (float)photons);
|
||||
}
|
||||
|
||||
Coord DiffractionSpot::ReciprocalCoord(const DiffractionExperiment &experiment, uint16_t data_stream) const {
|
||||
return LabCoord(experiment, data_stream).Normalize() / experiment.GetWavelength_A()
|
||||
- experiment.GetScatteringVector();
|
||||
Coord DiffractionSpot::ReciprocalCoord(const DiffractionExperiment &experiment) const {
|
||||
return DetectorToRecip(experiment, x / (float)photons, y / (float)photons);
|
||||
}
|
||||
|
||||
double DiffractionSpot::GetResolution(const DiffractionExperiment &experiment, uint16_t data_stream) const {
|
||||
return experiment.PxlToRes(x / (float)photons, y / (float)photons);
|
||||
double DiffractionSpot::GetResolution(const DiffractionExperiment &experiment) const {
|
||||
return PxlToRes(experiment, x / (float)photons, y / (float)photons);
|
||||
}
|
||||
|
||||
DiffractionSpot::operator SpotToSave() const {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_DIFFRACTIONSPOT_H
|
||||
#define JUNGFRAUJOCH_DIFFRACTIONSPOT_H
|
||||
@@ -23,9 +22,9 @@ public:
|
||||
int64_t Count() const;
|
||||
int64_t MaxCount() const;
|
||||
Coord RawCoord() const;
|
||||
Coord LabCoord(const DiffractionExperiment &experiment, uint16_t data_stream = TASK_NO_DATA_STREAM) const;
|
||||
double GetResolution(const DiffractionExperiment &experiment, uint16_t data_stream = TASK_NO_DATA_STREAM) const;
|
||||
Coord ReciprocalCoord(const DiffractionExperiment &experiment, uint16_t data_stream = TASK_NO_DATA_STREAM) const;
|
||||
Coord LabCoord(const DiffractionExperiment &experiment) const;
|
||||
double GetResolution(const DiffractionExperiment &experiment) const;
|
||||
Coord ReciprocalCoord(const DiffractionExperiment &experiment) const;
|
||||
operator SpotToSave() const;
|
||||
void AddPixel(uint32_t col, uint32_t line, int64_t photons);
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include <cstring>
|
||||
|
||||
@@ -12,7 +11,7 @@
|
||||
FrameTransformation::FrameTransformation(const DiffractionExperiment &in_experiment) :
|
||||
experiment(in_experiment), summation(experiment.GetSummation()),
|
||||
pixel_depth(experiment.GetPixelDepth()), compressor(in_experiment.GetCompressionAlgorithmEnum()),
|
||||
binning_2x2(experiment.GetBinning2x2()) {
|
||||
binning_2x2(experiment.GetBinning2x2()), conversion_buffer(RAW_MODULE_SIZE) {
|
||||
|
||||
if ((experiment.GetDetectorMode() == DetectorMode::Conversion) && (summation > 1)) {
|
||||
for (int i = 0; i < experiment.GetModulesNum(); i++)
|
||||
@@ -143,6 +142,13 @@ void FrameTransformation::ProcessModule(const int16_t *input, uint16_t module_nu
|
||||
}
|
||||
}
|
||||
|
||||
void FrameTransformation::ApplyROI(const ROIFilter &filter) {
|
||||
if (pixel_depth == 2)
|
||||
filter.Apply((int16_t *) precompression_buffer.data(), static_cast<int16_t>(INT16_MIN));
|
||||
else
|
||||
filter.Apply((int32_t *) precompression_buffer.data(), static_cast<int32_t>(INT32_MIN));
|
||||
}
|
||||
|
||||
int16_t *FrameTransformation::GetPreview16BitImage() {
|
||||
if (pixel_depth == 2)
|
||||
return (int16_t *) precompression_buffer.data();
|
||||
@@ -163,11 +169,15 @@ void FrameTransformation::ProcessModule(JFConversion &conv, const int16_t *input
|
||||
|
||||
if (experiment.GetDetectorMode() != DetectorMode::Conversion)
|
||||
memcpy(output + RAW_MODULE_SIZE * module_number_abs, input, RAW_MODULE_SIZE * experiment.GetPixelDepth());
|
||||
else
|
||||
conv.ConvertAdjustGeom((int16_t *) output, (uint16_t *) input,
|
||||
experiment.GetModuleSlowDirectionStep(module_number_abs),
|
||||
experiment.GetModuleFastDirectionStep(module_number_abs),
|
||||
experiment.GetPixel0OfModule(module_number_abs));
|
||||
else {
|
||||
conv.ConvertModule(conversion_buffer.data(), (uint16_t *) input);
|
||||
TransferModuleAdjustMultipixels(output, conversion_buffer.data(),
|
||||
experiment.GetModuleSlowDirectionStep(module_number_abs),
|
||||
static_cast<int16_t>(INT16_MIN),
|
||||
static_cast<int16_t>(INT16_MAX),
|
||||
experiment.GetModuleFastDirectionStep(module_number_abs),
|
||||
experiment.GetPixel0OfModule(module_number_abs));
|
||||
}
|
||||
} else {
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
|
||||
"Summation with CPU conversion not supported at the moment");
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_FRAMETRANSFORMATION_H
|
||||
#define JUNGFRAUJOCH_FRAMETRANSFORMATION_H
|
||||
@@ -7,6 +6,7 @@
|
||||
#include "DiffractionExperiment.h"
|
||||
#include "../compression/JFJochCompressor.h"
|
||||
#include "../jungfrau/JFConversion.h"
|
||||
#include "ROIFilter.h"
|
||||
|
||||
class FrameTransformation {
|
||||
const DiffractionExperiment& experiment;
|
||||
@@ -14,6 +14,7 @@ class FrameTransformation {
|
||||
|
||||
std::vector<std::vector<int32_t> > summation_buffer;
|
||||
std::vector<char> precompression_buffer;
|
||||
std::vector<int16_t> conversion_buffer;
|
||||
std::vector<int16_t> image16bit;
|
||||
|
||||
const size_t summation;
|
||||
@@ -30,6 +31,7 @@ public:
|
||||
int data_stream);
|
||||
void Pack(); // transfer summed image to converted coordinates, clear summation buffer
|
||||
size_t SaveCompressedImage(void *output);
|
||||
void ApplyROI(const ROIFilter &filter);
|
||||
int16_t *GetPreview16BitImage();
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
+1
-2
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_GITINFO_H
|
||||
#define JUNGFRAUJOCH_GITINFO_H
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#ifndef JUNGFRAUJOCH_HISTOGRAM_H
|
||||
#define JUNGFRAUJOCH_HISTOGRAM_H
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include "ImagePusher.h"
|
||||
|
||||
@@ -12,6 +11,7 @@ void PrepareCBORImage(DataMessage& message,
|
||||
message.image.ypixel = experiment.GetYPixelsNum();
|
||||
message.image.pixel_depth_bytes = experiment.GetPixelDepth();
|
||||
message.image.pixel_is_signed = experiment.IsPixelSigned();
|
||||
message.image.pixel_is_float = false;
|
||||
message.image.algorithm = experiment.GetCompressionAlgorithmEnum();
|
||||
message.image.channel = "default";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_IMAGEPUSHER_H
|
||||
#define JUNGFRAUJOCH_IMAGEPUSHER_H
|
||||
@@ -10,8 +9,7 @@
|
||||
#include "DiffractionExperiment.h"
|
||||
#include "DiffractionSpot.h"
|
||||
#include "../frame_serialize/JFJochFrameSerializer.h"
|
||||
#include "../frame_serialize/StartMessage.h"
|
||||
#include "../frame_serialize/EndMessage.h"
|
||||
#include "../frame_serialize/CBORMessages.h"
|
||||
#include "ZeroCopyReturnValue.h"
|
||||
|
||||
void PrepareCBORImage(DataMessage& message,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef SLSEXCEPTION_H
|
||||
#define SLSEXCEPTION_H
|
||||
|
||||
+1
-2
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include "spdlog/sinks/daily_file_sink.h"
|
||||
#include "spdlog/sinks/stdout_color_sinks.h"
|
||||
|
||||
+1
-2
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_LOGGER_H
|
||||
#define JUNGFRAUJOCH_LOGGER_H
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include "NUMAHWPolicy.h"
|
||||
|
||||
#include "../common/CUDAWrapper.h"
|
||||
#include "JFJochException.h"
|
||||
|
||||
#ifdef JFJOCH_USE_NUMA
|
||||
#include <numa.h>
|
||||
#endif
|
||||
|
||||
NUMAHWPolicy::NUMAHWPolicy(const std::string &policy) : name(policy) {
|
||||
if ((policy.empty()) || (policy == "none")) {
|
||||
name = "none";
|
||||
} else if (policy == "n2g2") {
|
||||
bindings.emplace_back(NUMABinding{.cpu_node = 0, .mem_node = 0, .gpu = 0});
|
||||
bindings.emplace_back(NUMABinding{.cpu_node = 1, .mem_node = 1, .gpu = 1});
|
||||
} else if (policy == "n2g4") {
|
||||
bindings.emplace_back(NUMABinding{.cpu_node = 0, .mem_node = 0, .gpu = 0});
|
||||
bindings.emplace_back(NUMABinding{.cpu_node = 1, .mem_node = 1, .gpu = 2});
|
||||
bindings.emplace_back(NUMABinding{.cpu_node = 0, .mem_node = 0, .gpu = 1});
|
||||
bindings.emplace_back(NUMABinding{.cpu_node = 1, .mem_node = 1, .gpu = 3});
|
||||
} else if (policy == "n2g4_hbm") {
|
||||
bindings.emplace_back(NUMABinding{.cpu_node = 0, .mem_node = 2, .gpu = 0});
|
||||
bindings.emplace_back(NUMABinding{.cpu_node = 1, .mem_node = 3, .gpu = 2});
|
||||
bindings.emplace_back(NUMABinding{.cpu_node = 0, .mem_node = 2, .gpu = 1});
|
||||
bindings.emplace_back(NUMABinding{.cpu_node = 1, .mem_node = 3, .gpu = 3});
|
||||
} else if (policy == "n8g4") {
|
||||
for (int32_t i = 0; i < 8; i++)
|
||||
bindings.emplace_back(NUMABinding{.cpu_node = i, .mem_node = i, .gpu = i/2});
|
||||
} else if (policy == "n8g4_hbm") {
|
||||
for (int32_t i = 0; i < 8; i++)
|
||||
bindings.emplace_back(NUMABinding{.cpu_node = i, .mem_node = i + 8, .gpu = i / 2});
|
||||
} else if (policy == "g2") {
|
||||
bindings.emplace_back(NUMABinding{.cpu_node = -1, .mem_node = -1, .gpu = 0});
|
||||
bindings.emplace_back(NUMABinding{.cpu_node = -1, .mem_node = -1, .gpu = 1});
|
||||
} else if (policy == "g4") {
|
||||
bindings.emplace_back(NUMABinding{.cpu_node = -1, .mem_node = -1, .gpu = 0});
|
||||
bindings.emplace_back(NUMABinding{.cpu_node = -1, .mem_node = -1, .gpu = 1});
|
||||
bindings.emplace_back(NUMABinding{.cpu_node = -1, .mem_node = -1, .gpu = 2});
|
||||
bindings.emplace_back(NUMABinding{.cpu_node = -1, .mem_node = -1, .gpu = 3});
|
||||
} else
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Unknown NUMA policy");
|
||||
}
|
||||
|
||||
NUMAHWPolicy::NUMAHWPolicy(const NUMAHWPolicy &other) : bindings(other.bindings), name(other.name), curr_thread(0) {}
|
||||
|
||||
NUMAHWPolicy &NUMAHWPolicy::operator=(const NUMAHWPolicy &other) {
|
||||
bindings = other.bindings;
|
||||
name = other.name;
|
||||
curr_thread = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
NUMABinding NUMAHWPolicy::GetBinding(uint32_t thread) {
|
||||
if (bindings.empty())
|
||||
return NUMABinding{.cpu_node = -1, .mem_node = -1, .gpu = -1};
|
||||
else
|
||||
return bindings.at(thread % bindings.size());
|
||||
}
|
||||
|
||||
NUMABinding NUMAHWPolicy::GetBinding() {
|
||||
return GetBinding(curr_thread++);
|
||||
}
|
||||
|
||||
void NUMAHWPolicy::Bind() {
|
||||
Bind(GetBinding());
|
||||
}
|
||||
|
||||
void NUMAHWPolicy::Bind(uint32_t thread) {
|
||||
Bind(GetBinding(thread));
|
||||
}
|
||||
|
||||
void NUMAHWPolicy::Bind(const NUMABinding &binding) {
|
||||
RunOnNode(binding.cpu_node);
|
||||
MemOnNode(binding.mem_node);
|
||||
SelectGPU(binding.gpu);
|
||||
}
|
||||
|
||||
void NUMAHWPolicy::RunOnNode(int32_t cpu_node) {
|
||||
#ifdef JFJOCH_USE_NUMA
|
||||
if (numa_available() != -1) {
|
||||
auto max_nodes = numa_num_configured_nodes();
|
||||
|
||||
if (cpu_node >= 0) {
|
||||
if (cpu_node < max_nodes)
|
||||
numa_run_on_node(cpu_node);
|
||||
else
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "CPU NUMA node out of bounds");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void NUMAHWPolicy::MemOnNode(int32_t mem_node) {
|
||||
#ifdef JFJOCH_USE_NUMA
|
||||
if (numa_available() != -1) {
|
||||
auto max_nodes = numa_num_configured_nodes();
|
||||
|
||||
if (mem_node >= 0) {
|
||||
if (mem_node < max_nodes) {
|
||||
struct bitmask *mask = numa_allocate_nodemask();
|
||||
numa_bitmask_setbit(mask, mem_node);
|
||||
numa_set_membind(mask);
|
||||
numa_bitmask_free(mask);
|
||||
} else
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Memory NUMA node out of bounds");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void NUMAHWPolicy::SelectGPU(int32_t gpu) {
|
||||
#ifdef JFJOCH_USE_CUDA
|
||||
if (gpu > 0) {
|
||||
if (gpu < get_gpu_count())
|
||||
set_gpu(gpu);
|
||||
else
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "GPU device out of bounds");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
const std::string &NUMAHWPolicy::GetName() const {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_NUMAHWPOLICY_H
|
||||
#define JUNGFRAUJOCH_NUMAHWPOLICY_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <atomic>
|
||||
|
||||
struct NUMABinding {
|
||||
int32_t cpu_node;
|
||||
int32_t mem_node;
|
||||
int32_t gpu;
|
||||
};
|
||||
|
||||
class NUMAHWPolicy {
|
||||
std::string name;
|
||||
std::vector<NUMABinding> bindings;
|
||||
std::atomic<uint32_t> curr_thread = 0;
|
||||
public:
|
||||
NUMAHWPolicy() = default;
|
||||
explicit NUMAHWPolicy(const std::string& policy);
|
||||
NUMAHWPolicy(const NUMAHWPolicy& other);
|
||||
NUMAHWPolicy& operator=(const NUMAHWPolicy& other);
|
||||
NUMABinding GetBinding(uint32_t thread);
|
||||
NUMABinding GetBinding(); // round-robin
|
||||
|
||||
const std::string &GetName() const;
|
||||
|
||||
void Bind(uint32_t thread);
|
||||
void Bind(); // round-robin
|
||||
static void Bind(const NUMABinding &binding);
|
||||
static void RunOnNode(int32_t cpu_node);
|
||||
static void MemOnNode(int32_t mem_node);
|
||||
static void SelectGPU(int32_t gpu);
|
||||
};
|
||||
|
||||
#endif //JUNGFRAUJOCH_NUMAHWPOLICY_H
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <sstream>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_NETWORKADDRESSCONVERT_H
|
||||
#define JUNGFRAUJOCH_NETWORKADDRESSCONVERT_H
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_ROIFILTER_H
|
||||
#define JUNGFRAUJOCH_ROIFILTER_H
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include "JFJochException.h"
|
||||
|
||||
class ROIFilter {
|
||||
int32_t width, height;
|
||||
std::vector<uint8_t> mask;
|
||||
public:
|
||||
ROIFilter(int32_t in_width, int32_t in_height, uint8_t fill_value = 0)
|
||||
: width(in_width), height(in_height) {
|
||||
if ((width < 0) || (height < 0))
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Negative dimensions are wrong");
|
||||
mask = std::vector<uint8_t>(in_width * in_height, fill_value);
|
||||
}
|
||||
|
||||
void SetRectangle(int32_t x0, int32_t y0, int32_t in_width, int32_t in_height, uint8_t mask_value = 1) {
|
||||
if (x0 < 0) { in_width += x0; x0 = 0; }
|
||||
if (in_width <= 0) return;
|
||||
|
||||
if (x0 >= width) return;
|
||||
if (x0 + in_width >= width) in_width = width - x0;
|
||||
|
||||
if (y0 < 0) { in_height += y0; y0 = 0; }
|
||||
if (in_height <= 0) return;
|
||||
|
||||
if (y0 >= height) return;
|
||||
if (y0 + in_height >= height) in_height = height - y0;
|
||||
|
||||
for (size_t y = y0; y < y0 + in_height; y++) {
|
||||
for (size_t x = x0; x < x0 + in_width; x++) {
|
||||
mask[y * width + x] |= mask_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ClearRectangle(int32_t x0, int32_t y0, int32_t in_width, int32_t in_height, uint8_t mask_value = 1) {
|
||||
if (x0 < 0) { in_width += x0; x0 = 0; }
|
||||
if (in_width <= 0) return;
|
||||
|
||||
if (x0 >= width) return;
|
||||
if (x0 + in_width >= width) in_width = width - x0;
|
||||
|
||||
if (y0 < 0) { in_height += y0; y0 = 0; }
|
||||
if (in_height <= 0) return;
|
||||
|
||||
if (y0 >= height) return;
|
||||
if (y0 + in_height >= height) in_height = height - y0;
|
||||
|
||||
for (size_t y = y0; y < y0 + in_height; y++) {
|
||||
for (size_t x = x0; x < x0 + in_width; x++) {
|
||||
mask[y * width + x] &= ~mask_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void Apply(T* data, T fill_value) const {
|
||||
for (size_t i = 0; i < mask.size(); i++) {
|
||||
if (mask[i] == 0)
|
||||
data[i] = fill_value;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void Apply(std::vector<T> &data, T fill_value) const {
|
||||
if (data.size() != mask.size())
|
||||
throw JFJochException(JFJochExceptionCategory::ArrayOutOfBounds, "Mismatch in array size");
|
||||
Apply(data.data(), fill_value);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif //JUNGFRAUJOCH_ROIFILTER_H
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_RAWTOCONVERTEDGEOMETRY_H
|
||||
#define JUNGFRAUJOCH_RAWTOCONVERTEDGEOMETRY_H
|
||||
|
||||
+1
-2
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_SPOTTOSAVE_H
|
||||
#define JUNGFRAUJOCH_SPOTTOSAVE_H
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_STATUSVECTOR_H
|
||||
#define JUNGFRAUJOCH_STATUSVECTOR_H
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include "TestImagePusher.h"
|
||||
#include "../tests/FPGAUnitTest.h"
|
||||
@@ -106,13 +105,13 @@ bool TestImagePusher::CheckImage(const DiffractionExperiment &x, const std::vect
|
||||
decompressed_image.data(),
|
||||
storage_cell);
|
||||
if (x.GetBinning2x2() && (result > 1.5)) {
|
||||
logger.Error("Mean conversion error ({}) larger than threshold", result);
|
||||
logger.Error("Mean conversion error ({:.3f}) larger than threshold", result);
|
||||
no_errors = false;
|
||||
} else if (!x.GetBinning2x2() && (result > 0.5)) {
|
||||
logger.Error("Mean conversion error ({}) larger than threshold", result);
|
||||
logger.Error("Mean conversion error ({:.3f}) larger than threshold", result);
|
||||
no_errors = false;
|
||||
} else
|
||||
logger.Info("Mean conversion error: {}", result);
|
||||
logger.Info("Mean conversion error: {:.3f}", result);
|
||||
} else if (x.GetDetectorMode() == DetectorMode::Raw) {
|
||||
if (memcmp(raw_reference_image.data(), decompressed_image.data(), sizeof(uint16_t) * x.GetPixelsNum()) !=
|
||||
0) {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_TESTIMAGEPUSHER_H
|
||||
#define JUNGFRAUJOCH_TESTIMAGEPUSHER_H
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_THREADSAFEFIFO_H
|
||||
#define JUNGFRAUJOCH_THREADSAFEFIFO_H
|
||||
|
||||
+1
-2
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_UNITCELL_H
|
||||
#define JUNGFRAUJOCH_UNITCELL_H
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include "ZMQImagePusher.h"
|
||||
#include "JFJochException.h"
|
||||
@@ -56,7 +55,7 @@ void ZMQImagePusher::SendImage(const uint8_t *image_data, size_t image_size, int
|
||||
}
|
||||
|
||||
void ZMQImagePusher::StartDataCollection(const StartMessage& message) {
|
||||
std::vector<uint8_t> serialization_buffer(80*1024*1024);
|
||||
std::vector<uint8_t> serialization_buffer(message.approx_size);
|
||||
JFJochFrameSerializer serializer(serialization_buffer.data(), serialization_buffer.size()); // 80 MiB should be safe even for 16M
|
||||
|
||||
if (message.data_file_count < 1)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_ZMQIMAGEPUSHER_H
|
||||
#define JUNGFRAUJOCH_ZMQIMAGEPUSHER_H
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include "ZMQPreviewPublisher.h"
|
||||
#include "grpcToJson.h"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_ZMQPREVIEWPUBLISHER_H
|
||||
#define JUNGFRAUJOCH_ZMQPREVIEWPUBLISHER_H
|
||||
@@ -9,7 +8,7 @@
|
||||
#include "ZMQWrappers.h"
|
||||
#include "DiffractionExperiment.h"
|
||||
#include "../jungfrau/JFCalibration.h"
|
||||
#include "../frame_serialize/ImageMessage.h"
|
||||
#include "../frame_serialize/CBORMessages.h"
|
||||
|
||||
class ZMQPreviewPublisher {
|
||||
ZMQSocket socket;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include "ZMQWrappers.h"
|
||||
#include <cerrno>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_ZMQWRAPPERS_H
|
||||
#define JUNGFRAUJOCH_ZMQWRAPPERS_H
|
||||
@@ -9,7 +8,6 @@
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <zmq.h>
|
||||
#include <semaphore>
|
||||
|
||||
#include "JFJochException.h"
|
||||
#include "ZeroCopyReturnValue.h"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#ifndef JUNGFRAUJOCH_ZEROCOPYRETURNVALUE_H
|
||||
#define JUNGFRAUJOCH_ZEROCOPYRETURNVALUE_H
|
||||
|
||||
+2
-3
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_GRPCTOJSON_H
|
||||
#define JUNGFRAUJOCH_GRPCTOJSON_H
|
||||
@@ -18,7 +17,7 @@ inline std::string grpcToJson(const google::protobuf::Message &message) {
|
||||
std::string s;
|
||||
auto status = google::protobuf::util::MessageToJsonString(message, &s, opts);
|
||||
if (!status.ok())
|
||||
throw JFJochException(JFJochExceptionCategory::JSON, "Error in generating JSON from ProtoBuf: " + status.message().ToString());
|
||||
throw JFJochException(JFJochExceptionCategory::JSON, "Error in generating JSON from ProtoBuf");
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
+2
-3
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_JSONTOGRPC_H
|
||||
#define JUNGFRAUJOCH_JSONTOGRPC_H
|
||||
@@ -18,7 +17,7 @@ T jsonToGrpc(const std::string& json) {
|
||||
|
||||
auto status = google::protobuf::util::JsonStringToMessage(json, &output, opts);
|
||||
if (!status.ok())
|
||||
throw JFJochException(JFJochExceptionCategory::JSON, "Error in generating ProtoBuf from JSON: " + status.message().ToString());
|
||||
throw JFJochException(JFJochExceptionCategory::JSON, "Error in generating ProtoBuf from JSON");
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_TO_FIXED_H
|
||||
#define JUNGFRAUJOCH_TO_FIXED_H
|
||||
|
||||
@@ -4,6 +4,8 @@ ADD_LIBRARY(Compression STATIC
|
||||
bitshuffle/bitshuffle.c
|
||||
bitshuffle/bitshuffle_core.c
|
||||
bitshuffle/iochain.c
|
||||
bitshuffle_hperf/src/bitshuffle.c
|
||||
bitshuffle_hperf/src/bitshuffle.h
|
||||
JFJochZstdCompressor.cpp
|
||||
JFJochZstdCompressor.h
|
||||
JFJochCompressor.cpp
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_COMPRESSIONALGORITHMENUM_H
|
||||
#define JUNGFRAUJOCH_COMPRESSIONALGORITHMENUM_H
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include "JFJochCompressor.h"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <cstring>
|
||||
#include <bitshuffle/bitshuffle_internals.h>
|
||||
#include <bitshuffle_hperf/src/bitshuffle.h>
|
||||
#include <zstd.h>
|
||||
#include <lz4/lz4.h>
|
||||
|
||||
@@ -22,8 +22,7 @@ JFJochBitShuffleCompressor::JFJochBitShuffleCompressor(CompressionAlgorithm in_a
|
||||
size_t JFJochBitShuffleCompressor::CompressBlock(char *dest, const char *source, size_t nelements, size_t elem_size) {
|
||||
// Assert nelements < block_size
|
||||
const char *src_ptr;
|
||||
|
||||
int64_t bshuf_ret = bshuf_trans_bit_elem(source, tmp_space.data(), nelements, elem_size);
|
||||
int64_t bshuf_ret = bitshuf_encode_block(tmp_space.data(), source, scratch, nelements, elem_size);
|
||||
if (bshuf_ret < 0)
|
||||
throw JFJochException(JFJochExceptionCategory::Compression, "bshuf_trans_bit_elem error");
|
||||
src_ptr = tmp_space.data();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_JFJOCHCOMPRESSOR_H
|
||||
#define JUNGFRAUJOCH_JFJOCHCOMPRESSOR_H
|
||||
@@ -10,6 +9,7 @@
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
#include "CompressionAlgorithmEnum.h"
|
||||
#include "MaxCompressedSize.h"
|
||||
|
||||
#include "JFJochZstdCompressor.h"
|
||||
|
||||
@@ -17,16 +17,29 @@ class JFJochBitShuffleCompressor {
|
||||
JFJochZstdCompressor zstd_compressor;
|
||||
CompressionAlgorithm algorithm;
|
||||
std::vector<char> tmp_space;
|
||||
|
||||
size_t CompressBlock(char *dest, const char * source, size_t nelements, size_t elem_size);
|
||||
public:
|
||||
constexpr static const size_t DefaultBlockSize = 4096;
|
||||
|
||||
JFJochBitShuffleCompressor(CompressionAlgorithm algorithm);
|
||||
explicit JFJochBitShuffleCompressor(CompressionAlgorithm algorithm);
|
||||
|
||||
template<class T>
|
||||
size_t Compress(void *dest, const std::vector<T> &src) {
|
||||
return Compress((char *) dest, (char *) src.data(), src.size(), sizeof(T));
|
||||
};
|
||||
|
||||
template<class T>
|
||||
std::vector<uint8_t> Compress(const std::vector<T> &src) {
|
||||
std::vector<uint8_t> tmp(MaxCompressedSize(algorithm, src.size(), sizeof(T)));
|
||||
size_t tmp_size = Compress(tmp.data(), src);
|
||||
tmp.resize(tmp_size);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
size_t Compress(char *dest, const char* source, size_t nelements, size_t elem_size);
|
||||
private:
|
||||
char scratch[DefaultBlockSize * sizeof(uint64_t)];
|
||||
};
|
||||
|
||||
template <class T> std::vector<T> bitshuffle(const std::vector<T> &input, size_t block_size) {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_JFJOCHDECOMPRESS_H
|
||||
#define JUNGFRAUJOCH_JFJOCHDECOMPRESS_H
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include "JFJochZstdCompressor.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_JFJOCHZSTDCOMPRESSOR_H
|
||||
#define JUNGFRAUJOCH_JFJOCHZSTDCOMPRESSOR_H
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include <bitshuffle/bitshuffle.h>
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_MAXCOMPRESSEDSIZE_H
|
||||
#define JUNGFRAUJOCH_MAXCOMPRESSEDSIZE_H
|
||||
|
||||
Submodule
+1
Submodule compression/bitshuffle_hperf added at be844a76f4
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include <thread>
|
||||
|
||||
@@ -10,8 +9,17 @@
|
||||
void DetectorWrapper::Configure(const JFJochProtoBuf::DetectorConfig &request) {
|
||||
logger.Info("Configure");
|
||||
try {
|
||||
if (det.size() > 0)
|
||||
if (det.size() > 0) {
|
||||
// Only if the detector is already defined
|
||||
|
||||
// Stop the detector
|
||||
InternalStop();
|
||||
|
||||
// Clear synchronization prior to reconfiguring the detector
|
||||
det.setMaster(false, 0);
|
||||
det.setSynchronization(false);
|
||||
}
|
||||
|
||||
if (request.module_hostname_size() > 0) {
|
||||
std::vector<std::string> module_hostname;
|
||||
for (const auto &iter: request.module_hostname())
|
||||
@@ -100,7 +108,7 @@ void DetectorWrapper::Start(const JFJochProtoBuf::DetectorInput &request) {
|
||||
det.setNumberOfTriggers(request.num_triggers());
|
||||
det.setStorageCellStart(request.storage_cell_start());
|
||||
det.setNumberOfAdditionalStorageCells(request.storage_cell_number() - 1);
|
||||
det.setStorageCellDelay(std::chrono::nanoseconds(static_cast<uint64_t>(request.storage_cell_delay() * 1000)));
|
||||
det.setStorageCellDelay(std::chrono::nanoseconds(request.storage_cell_delay_ns() - MIN_STORAGE_CELL_DELAY_IN_NS));
|
||||
|
||||
if (request.period_us() < MIN_FRAME_TIME_HALF_SPEED_IN_US)
|
||||
det.setReadoutSpeed(slsDetectorDefs::speedLevel::FULL_SPEED);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_DETECTORWRAPPER_H
|
||||
#define JUNGFRAUJOCH_DETECTORWRAPPER_H
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include "JFJochDetector.h"
|
||||
#include "../common/JFJochException.h"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef DETECTORWRAPPER_H
|
||||
#define DETECTORWRAPPER_H
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include <fstream>
|
||||
#include <grpcpp/server.h>
|
||||
|
||||
Submodule detector_control/slsDetectorPackage updated: 77c558a7be...f761046bfc
@@ -0,0 +1,30 @@
|
||||
FIND_PROGRAM(VIVADO vivado DOC "Xilinx Vivado")
|
||||
IF (VIVADO)
|
||||
MESSAGE(STATUS "Xilinx Vivado found: ${VIVADO}")
|
||||
ELSE()
|
||||
MESSAGE(STATUS "Xilinx Vivado not found")
|
||||
ENDIF()
|
||||
|
||||
FIND_PROGRAM(VIVADO_HLS NAMES vitis_hls DOC "Xilinx HLS")
|
||||
IF (VIVADO_HLS)
|
||||
MESSAGE(STATUS "Xilinx HLS compiler found: ${VIVADO_HLS}")
|
||||
ELSE()
|
||||
MESSAGE(STATUS "Xilinx HLS compiler not found")
|
||||
ENDIF()
|
||||
|
||||
INCLUDE_DIRECTORIES(include)
|
||||
|
||||
ADD_SUBDIRECTORY(hls)
|
||||
ADD_SUBDIRECTORY(pcie_driver)
|
||||
|
||||
IF(VIVADO_HLS AND VIVADO)
|
||||
ADD_CUSTOM_COMMAND(OUTPUT action/hw/hdl/action_config.v
|
||||
COMMAND ${CMAKE_COMMAND} -E env SRC_DIR=${CMAKE_CURRENT_SOURCE_DIR} HLS_IP_DIR=${CMAKE_CURRENT_BINARY_DIR}/action/ip/hls bash ${CMAKE_CURRENT_SOURCE_DIR}/scripts/setup_action.sh
|
||||
DEPENDS hls hdl/action_config.v hdl/check_datamover_error.v hdl/check_eth_busy.v hdl/gen_xdma_descriptor.v hdl/refclk300to100.v hdl/action_wrapper.v hdl/resetn_sync.v scripts/bd_pcie.tcl scripts/jfjoch.tcl scripts/network_stack.tcl scripts/hbm_u55c.tcl scripts/mac_100g_pcie.tcl scripts/pcie_dma.tcl scripts/setup_action.sh
|
||||
)
|
||||
|
||||
ADD_CUSTOM_TARGET(action_pcie DEPENDS action/hw/hdl/action_config.v hls
|
||||
COMMAND ${VIVADO} -notrace -mode batch -source ${CMAKE_CURRENT_SOURCE_DIR}/scripts/build_pcie_design.tcl
|
||||
COMMAND ${CMAKE_COMMAND} -E env FLOW=pcie_100gbit VIV_PROJECT_PATH=${CMAKE_CURRENT_BINARY_DIR}/vivado/jfjoch_pcie.xpr ${VIVADO} -notrace -mode batch -source ${CMAKE_CURRENT_BINARY_DIR}/action/scripts/synth_and_impl.tcl
|
||||
)
|
||||
ENDIF()
|
||||
+136
@@ -0,0 +1,136 @@
|
||||
# FPGA Smart Network Interface Card
|
||||
|
||||
## Hardware
|
||||
Currently supported FPGA is only Xilinx Alveo U55C
|
||||
|
||||
## Content of directories
|
||||
|
||||
CPU Part:
|
||||
|
||||
* `pcie_driver` Linux kernel driver for PCIe version of the FPGA board
|
||||
|
||||
FPGA part:
|
||||
|
||||
* `scripts` Scripts for FPGA synthesis
|
||||
* `xdc` Constraints for FPGA
|
||||
* `hdl` FPGA design parts developed in Verilog
|
||||
* `hls` FPGA design parts developed in C++ with high-level synthesis
|
||||
|
||||
Dependencies:
|
||||
|
||||
* `include` External (Xilinx) headers for high-level synthesis code
|
||||
|
||||
|
||||
## HLS compilation
|
||||
Make HLS routines:
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
cmake3 ..
|
||||
make hls
|
||||
```
|
||||
|
||||
## Synthesis
|
||||
Create PCIe bitstream with 2 data stream (200 Gbit/s) and bifurcated 2 x Gen4x8 PCIe design:
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
cmake3 ..
|
||||
make action_pcie
|
||||
```
|
||||
|
||||
Create PCIe bitstream with 1 data stream (100 Gbit/s) and single Gen4x8 PCIe interface:
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
cmake3 ..
|
||||
make action_pcie_100g
|
||||
```
|
||||
|
||||
## Hardware verification
|
||||
|
||||
To test that FPGA board is working properly without access to a JUNGFRAU detector, you can use `jfjoch_action_test` tool.
|
||||
|
||||
## FPGA reference
|
||||
FPGA setup can be done via 32-bit registers:
|
||||
|
||||
| Address | Bits | Meaning | Mode | Notes |
|
||||
|---------------------|------|------------------------------------------------------------------------------------------------------|:-----|----------------------------------------------|
|
||||
| 0x00000 - 0x0FFFF | | Reserved (in case using MicroBlaze in the future, this has to reserved for internal memory) | | |
|
||||
| 0x010000 | 32 | Action Control Register | | |
|
||||
| | | Bit 0 - Action start | R/W | |
|
||||
| | | Bit 1 - Action idle | R | |
|
||||
| | | Bit 2 - Action cancel | R/W | cleared on reset or action start |
|
||||
| | | Bit 3 - Clear network counters | R/W | cleared on reset or action start |
|
||||
| | | Bit 4 - Host writer idle | R | cleared on reset |
|
||||
| | | Bit 7 - Design number | R | 0 = PCIe #0, 1 = PCIe #1 |
|
||||
| | | Bit 16 - AXI Mailbox interrupt 0 | R | |
|
||||
| | | Bit 17 - AXI Mailbox interrupt 1 | R | |
|
||||
| | | Bits 24-27 - Various errors in host memory writer | R | cleared on reset or action start |
|
||||
| 0x010004 | 32 | Reserved | - | |
|
||||
| 0x01000C | 32 | Action GIT SHA1 | R | |
|
||||
| 0x010010 | 32 | Action Type | R | |
|
||||
| 0x010014 | 32 | Action Release Level | R | |
|
||||
| 0x010020 | 32 | Max. number supported detector modules | R | constant |
|
||||
| 0x010024 | 32 | Number of modules in internal packet generator memory | R | constant |
|
||||
| 0x010028 | 64 | Pipeline stalls before writing to host memory | R | reset on action start |
|
||||
| 0x010030 | 64 | Pipeline stalls before accessing HBM | R | reset on action start |
|
||||
| 0x010038 | 32 | FIFO status (see action_config.v for details) | R | |
|
||||
| 0x01003C | 32 | Size of single HBM channel in bytes (default value for the particular card) | R/W | should not be altered for standard operation |
|
||||
| 0x010040 | 64 | Packets processed by the action | R | cleared on reset or action start |
|
||||
| 0x010048 | 64 | Valid ethernet packets | R | cleared on reset |
|
||||
| 0x010050 | 64 | Valid ICMP packets | R | cleared on reset |
|
||||
| 0x010058 | 64 | Valid UDP packets | R | cleared on reset |
|
||||
| 0x010060 | 64 | MAC address of FPGA card | R/W | network byte order |
|
||||
| 0x010068 | 32 | IPv4 address of FPGA card | R/W | network byte order |
|
||||
| 0x01006C | 32 | Number of detector modules | R/W | |
|
||||
| 0x010070 | 32 | Data collection mode | R/W | |
|
||||
| | | Bit 0 - Conversion to photons | | |
|
||||
| | | Bit 1 - Use internal packet generator | | |
|
||||
| | | Bit 2 - Nonblocking operation (host writer will ignore frames if there is no available work request) | | |
|
||||
| | | Bit 16:31 - Data collection ID (carried with completions) | | |
|
||||
| 0x010074 | 32 | One over energy in keV (in fixed-point:12 int. + 24 frac. bit format) | R/W | |
|
||||
| 0x010078 | 32 | Number of frames to be generated by internal packet generator | R/W | |
|
||||
| 0x01007C | 32 | Number of storage cells | R/W | |
|
||||
| | | | | |
|
||||
| 0x020000 - 0x02FFFF | | CMAC 100G | | See Xilinx PG203 for register map |
|
||||
| 0x030000 - 0x03FFFF | | AXI Mailbox for Work Request / Work Completion | | See Xilinx PG114 for register map |
|
||||
| 0x040000 - 0x04FFFF | | QuadSPI flash | | See Xilinx PG153 for register map |
|
||||
| 0x060000 - 0x060FFF | 64 | Input calibration memory addresses block RAM | | |
|
||||
| 0x070000 - 0x07FFFF | | AXI Firewall | | See Xilinx PG293 for register map |
|
||||
| 0x090000 - 0x09FFFF | | PCIe DMA control | | See Xilinx PG195 for register map |
|
||||
| 0x0A0000 - 0x0AFFFF | | Transfer between UltraRAM buffer <-> HBM (HLS registers) | | |
|
||||
| 0x0C0000 - 0x0FFFFF | | Xilinx Card Management Solution Subsystem management subsystem | | See Xilinx PG348 for register map |
|
||||
| 0x100000 - 0x1FFFFF | 16 | Internal packet generator frame | | |
|
||||
| 0x200000 - 0x2FFFFF | | UltraRAM buffer for transfers to/from HBM | | |
|
||||
|
||||
### AXI Mailbox
|
||||
|
||||
AXI mailbox is used to send work request from host to action, and receive work completions. Messages are always multiple of 128-bit. See Xilinx PG114 on how to operate AXI Mailbox.
|
||||
|
||||
Work request has the following structure:
|
||||
|
||||
| Bit start | Bit end | Meaning |
|
||||
|-----------|---------|----------------------------------------------------|
|
||||
| 0 | 31 | Work request ID (handle) |
|
||||
| 32 | 95 | Address (Virt: OpenCAPI, DMA: PCIe) |
|
||||
| 96 | 127 | Includes parity bit, so bits 0-127 are even parity |
|
||||
|
||||
Work completion has the following structure:
|
||||
|
||||
| Bit start | Bit end | Meaning |
|
||||
|-----------|---------|--------------------------------------------------------------------|
|
||||
| 0 | 31 | Work request ID (handle) |
|
||||
| 32 | 39 | Module number |
|
||||
| 40 | 40 | All packets for the module arrived OK |
|
||||
| 41 | 41 | Trigger signal high |
|
||||
| 42 | 62 | Reserved |
|
||||
| 63 | 63 | Parity bit - bits 0-127 are even parity |
|
||||
| 64 | 127 | Frame number |
|
||||
| 128 | 191 | JF Timestamp |
|
||||
| 192 | 255 | Bunch ID |
|
||||
| 256 | 287 | Exptime |
|
||||
| 288 | 319 | JF debug |
|
||||
| 320 | 351 | Reserved |
|
||||
| 352 | 383 | Data collection ID (16-bit) |
|
||||
| 384 | 511 | Packet mask (1 bit per packet: 0 packet missing, 1 packet arrived) |
|
||||
@@ -1,21 +1,20 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: CERN-OHL-S-2.0
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
`timescale 1ns/1ps
|
||||
|
||||
// parameters imported from source files
|
||||
`define ACTION_TYPE 32'h52324158
|
||||
`define RELEASE_LEVEL 32'h00000000
|
||||
`define GIT_SHA1 32'h00000000
|
||||
`define MAX_MODULES_FPGA 32'd8
|
||||
`define RELEASE_LEVEL 32'h
|
||||
`define GIT_SHA1 32'h
|
||||
`define MAX_MODULES_FPGA 32'd16
|
||||
`define HBM_SIZE_BYTES 32'h20000000
|
||||
|
||||
`define ADDR_AP_CTRL 16'h0000
|
||||
`define ADDR_SET_LED 16'h0008
|
||||
`define ADDR_GIT_SHA1 16'h000C
|
||||
|
||||
`define ADDR_ACTION_TYPE 32'h0010
|
||||
`define ADDR_RELEASE_LEVEL 32'h0014
|
||||
`define ADDR_HBM_TEMP 16'h0018
|
||||
`define ADDR_ACTION_TYPE 16'h0010
|
||||
`define ADDR_RELEASE_LEVEL 16'h0014
|
||||
`define ADDR_MAX_MODULES_FPGA 16'h0020
|
||||
`define ADDR_MODS_INT_PKT_GEN 16'h0024
|
||||
|
||||
@@ -24,6 +23,7 @@
|
||||
`define ADDR_STALLS_HBM_LO 16'h0030
|
||||
`define ADDR_STALLS_HBM_HI 16'h0034
|
||||
`define ADDR_FIFO_STATUS 16'h0038
|
||||
`define ADDR_HBM_SIZE 16'h003C
|
||||
|
||||
`define ADDR_PACKETS_PROC_LO 16'h0040
|
||||
`define ADDR_PACKETS_PROC_HI 16'h0044
|
||||
@@ -89,14 +89,13 @@ module action_config
|
||||
output reg [31:0] nframes ,
|
||||
output reg [7:0] nmodules ,
|
||||
output reg [3:0] nstorage_cells ,
|
||||
output reg [31:0] hbm_size_bytes ,
|
||||
|
||||
output reg data_collection_start ,
|
||||
output reg data_collection_cancel ,
|
||||
input data_collection_idle ,
|
||||
input [6:0] hbm_temperature ,
|
||||
input hbm_temp_trip ,
|
||||
input apb_complete_0 ,
|
||||
|
||||
input host_writer_idle ,
|
||||
input calib_data_fifo_empty ,
|
||||
input calib_data_fifo_full ,
|
||||
input calib_addr_fifo_empty ,
|
||||
@@ -104,10 +103,14 @@ module action_config
|
||||
|
||||
input udp_fifo_empty ,
|
||||
input udp_fifo_full ,
|
||||
input host_mem_data_fifo_empty ,
|
||||
input host_mem_data_fifo_full ,
|
||||
input host_mem_cmd_fifo_empty ,
|
||||
input host_mem_cmd_fifo_full ,
|
||||
input c2h_data_fifo_empty ,
|
||||
input c2h_data_fifo_full ,
|
||||
input c2h_cmd_fifo_empty ,
|
||||
input c2h_cmd_fifo_full ,
|
||||
input h2c_data_fifo_empty ,
|
||||
input h2c_data_fifo_full ,
|
||||
input h2c_cmd_fifo_empty ,
|
||||
input h2c_cmd_fifo_full ,
|
||||
input work_req_fifo_empty ,
|
||||
input work_req_fifo_full ,
|
||||
input work_compl_fifo_empty ,
|
||||
@@ -116,7 +119,10 @@ module action_config
|
||||
input last_data_fifo_full ,
|
||||
input last_addr_fifo_empty ,
|
||||
input last_addr_fifo_full ,
|
||||
|
||||
input frame_generator_fifo_empty ,
|
||||
input frame_generator_fifo_full ,
|
||||
input eth_in_fifo_empty ,
|
||||
input eth_in_fifo_full ,
|
||||
input mailbox_interrupt_0 ,
|
||||
input mailbox_interrupt_1 ,
|
||||
|
||||
@@ -140,16 +146,8 @@ module action_config
|
||||
input [31:0] udp_err_len ,
|
||||
input udp_err_len_valid ,
|
||||
|
||||
input [3:0] host_writer_err ,
|
||||
input host_writer_err_valid ,
|
||||
input eth_stat_rx_status ,
|
||||
input eth_stat_rx_aligned ,
|
||||
input eth_busy ,
|
||||
input eth_stat_rx_packet_bad_fcs ,
|
||||
input mm2s_error ,
|
||||
input s2mm_error ,
|
||||
output qsfp_led_busy ,
|
||||
output qsfp_led_conn ,
|
||||
input [7:0] host_writer_err ,
|
||||
input host_writer_err_valid ,
|
||||
output reg clear_counters
|
||||
);
|
||||
//------------------------Parameter----------------------
|
||||
@@ -178,33 +176,8 @@ localparam
|
||||
wire [ADDR_BITS-1:0] raddr;
|
||||
|
||||
// JFJoch signals
|
||||
(* ASYNC_REG = "TRUE" *) reg [6:0] reg_hbm_temperature_1;
|
||||
(* ASYNC_REG = "TRUE" *) reg [6:0] reg_hbm_temperature_2;
|
||||
|
||||
(* ASYNC_REG = "TRUE" *) reg reg_hbm_temp_trip_1;
|
||||
(* ASYNC_REG = "TRUE" *) reg reg_hbm_temp_trip_2;
|
||||
|
||||
(* ASYNC_REG = "TRUE" *) reg reg_apb_complete_0_1;
|
||||
(* ASYNC_REG = "TRUE" *) reg reg_apb_complete_0_2;
|
||||
|
||||
(* ASYNC_REG = "TRUE" *) reg reg_eth_busy_1;
|
||||
(* ASYNC_REG = "TRUE" *) reg reg_eth_busy_2;
|
||||
|
||||
(* ASYNC_REG = "TRUE" *) reg reg_eth_stat_rx_status_1;
|
||||
(* ASYNC_REG = "TRUE" *) reg reg_eth_stat_rx_aligned_1;
|
||||
|
||||
(* ASYNC_REG = "TRUE" *) reg reg_eth_stat_rx_status_2;
|
||||
(* ASYNC_REG = "TRUE" *) reg reg_eth_stat_rx_aligned_2;
|
||||
|
||||
(* ASYNC_REG = "TRUE" *) reg reg_eth_stat_rx_packet_bad_fcs_1;
|
||||
(* ASYNC_REG = "TRUE" *) reg reg_eth_stat_rx_packet_bad_fcs_2;
|
||||
reg reg_eth_stat_rx_packet_bad_fcs_ever;
|
||||
reg [31:0] reg_ctrl;
|
||||
|
||||
reg [6:0] reg_hbm_temperature;
|
||||
reg reg_hbm_temp_trip;
|
||||
reg reg_hbm_temp_trip_ever;
|
||||
|
||||
reg [63:0] reg_stalls_hbm;
|
||||
reg [63:0] reg_stalls_host;
|
||||
reg [63:0] reg_packets_processed;
|
||||
@@ -217,7 +190,7 @@ localparam
|
||||
reg [31:0] reg_udp_err_eth;
|
||||
|
||||
reg [31:0] reg_fifo_status;
|
||||
reg [3:0] reg_host_writer_err;
|
||||
reg [7:0] reg_host_writer_err;
|
||||
reg reg_data_collection_idle;
|
||||
//------------------------Instantiation------------------
|
||||
|
||||
@@ -347,9 +320,6 @@ always @(posedge clk) begin
|
||||
`ADDR_MODS_INT_PKT_GEN: begin
|
||||
rdata <= 32'd1;
|
||||
end
|
||||
`ADDR_HBM_TEMP: begin
|
||||
rdata <= reg_hbm_temperature;
|
||||
end
|
||||
`ADDR_STALLS_HBM_HI: begin
|
||||
rdata <= reg_stalls_hbm[63:32];
|
||||
end
|
||||
@@ -398,6 +368,9 @@ always @(posedge clk) begin
|
||||
`ADDR_PACKETS_ERR_ETH: begin
|
||||
rdata <= reg_udp_err_eth;
|
||||
end
|
||||
`ADDR_HBM_SIZE: begin
|
||||
rdata <= hbm_size_bytes;
|
||||
end
|
||||
`ADDR_FIFO_STATUS: begin
|
||||
rdata <= reg_fifo_status;
|
||||
end
|
||||
@@ -414,6 +387,17 @@ initial data_collection_start = 1'b0;
|
||||
initial data_collection_cancel = 1'b0;
|
||||
initial reg_ctrl = 32'b0;
|
||||
|
||||
initial hbm_size_bytes = `HBM_SIZE_BYTES;
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (!resetn)
|
||||
hbm_size_bytes = `HBM_SIZE_BYTES;
|
||||
else if (reg_data_collection_idle) begin
|
||||
if (w_hs && waddr == `ADDR_HBM_SIZE)
|
||||
hbm_size_bytes <= (s_axi_WDATA[31:0] & wmask) | (hbm_size_bytes & !wmask);
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (!resetn)
|
||||
reg_ctrl <= 32'b0;
|
||||
@@ -422,17 +406,8 @@ always @(posedge clk) begin
|
||||
reg_ctrl[1] <= reg_data_collection_idle;
|
||||
reg_ctrl[2] <= data_collection_cancel;
|
||||
reg_ctrl[3] <= clear_counters;
|
||||
reg_ctrl[4] <= host_writer_idle;
|
||||
reg_ctrl[7] <= DESIGN_NUMBER;
|
||||
reg_ctrl[8] <= reg_eth_stat_rx_status_2;
|
||||
reg_ctrl[9] <= reg_eth_stat_rx_aligned_2;
|
||||
if (mm2s_error)
|
||||
reg_ctrl[10] <= 1;
|
||||
if (s2mm_error)
|
||||
reg_ctrl[11] <= 1;
|
||||
reg_ctrl[12] <= reg_hbm_temp_trip;
|
||||
reg_ctrl[13] <= reg_hbm_temp_trip_ever;
|
||||
reg_ctrl[14] <= reg_apb_complete_0_2;
|
||||
reg_ctrl[15] <= reg_eth_stat_rx_packet_bad_fcs_ever;
|
||||
reg_ctrl[16] <= mailbox_interrupt_0;
|
||||
reg_ctrl[17] <= mailbox_interrupt_1;
|
||||
reg_ctrl[31:24] <= reg_host_writer_err;
|
||||
@@ -542,31 +517,6 @@ always @(posedge clk) begin
|
||||
end
|
||||
end
|
||||
|
||||
always @ (posedge clk) begin
|
||||
reg_eth_stat_rx_status_1 <= eth_stat_rx_status;
|
||||
reg_eth_stat_rx_status_2 <= reg_eth_stat_rx_status_1;
|
||||
|
||||
reg_eth_stat_rx_aligned_1 <= eth_stat_rx_aligned;
|
||||
reg_eth_stat_rx_aligned_2 <= reg_eth_stat_rx_aligned_1;
|
||||
|
||||
reg_eth_stat_rx_packet_bad_fcs_1 <= eth_stat_rx_packet_bad_fcs;
|
||||
reg_eth_stat_rx_packet_bad_fcs_2 <= reg_eth_stat_rx_packet_bad_fcs_1;
|
||||
|
||||
reg_eth_busy_1 <= eth_busy;
|
||||
reg_eth_busy_2 <= reg_eth_busy_1;
|
||||
|
||||
reg_apb_complete_0_1 <= apb_complete_0;
|
||||
reg_apb_complete_0_2 <= reg_apb_complete_0_1;
|
||||
|
||||
reg_hbm_temperature_1 <= hbm_temperature;
|
||||
reg_hbm_temperature_2 <= reg_hbm_temperature_1;
|
||||
reg_hbm_temperature <= reg_hbm_temperature_2;
|
||||
|
||||
reg_hbm_temp_trip_1 <= hbm_temp_trip;
|
||||
reg_hbm_temp_trip_2 <= reg_hbm_temp_trip_1;
|
||||
reg_hbm_temp_trip <= reg_hbm_temp_trip_2;
|
||||
end
|
||||
|
||||
always @ (posedge clk) begin
|
||||
if (!resetn)
|
||||
begin
|
||||
@@ -604,22 +554,6 @@ always @ (posedge clk) begin
|
||||
end
|
||||
end
|
||||
|
||||
// HBM temperature trip is only cleared on card restart to protect the card
|
||||
always @ (posedge clk) begin
|
||||
if (!resetn)
|
||||
reg_hbm_temp_trip_ever <= 0;
|
||||
else if (reg_hbm_temp_trip_2)
|
||||
reg_hbm_temp_trip_ever <= 1;
|
||||
end
|
||||
|
||||
// Ethernet RX packet bad FCS is kept from last reset
|
||||
always @ (posedge clk) begin
|
||||
if (!resetn)
|
||||
reg_eth_stat_rx_packet_bad_fcs_ever <= 0;
|
||||
else if (reg_eth_stat_rx_packet_bad_fcs_2)
|
||||
reg_eth_stat_rx_packet_bad_fcs_ever <= 1;
|
||||
end
|
||||
|
||||
// FIFO status
|
||||
always @(posedge clk) begin
|
||||
if (!resetn)
|
||||
@@ -632,10 +566,10 @@ always @(posedge clk) begin
|
||||
reg_fifo_status[3] <= calib_addr_fifo_full;
|
||||
reg_fifo_status[6] <= udp_fifo_empty;
|
||||
reg_fifo_status[7] <= udp_fifo_full;
|
||||
reg_fifo_status[8] <= host_mem_data_fifo_empty;
|
||||
reg_fifo_status[9] <= host_mem_data_fifo_full;
|
||||
reg_fifo_status[10] <= host_mem_cmd_fifo_empty;
|
||||
reg_fifo_status[11] <= host_mem_cmd_fifo_full;
|
||||
reg_fifo_status[8] <= c2h_data_fifo_empty;
|
||||
reg_fifo_status[9] <= c2h_data_fifo_full;
|
||||
reg_fifo_status[10] <= c2h_cmd_fifo_empty;
|
||||
reg_fifo_status[11] <= c2h_cmd_fifo_full;
|
||||
reg_fifo_status[12] <= work_req_fifo_empty;
|
||||
reg_fifo_status[13] <= work_req_fifo_full;
|
||||
reg_fifo_status[14] <= work_compl_fifo_empty;
|
||||
@@ -644,10 +578,15 @@ always @(posedge clk) begin
|
||||
reg_fifo_status[17] <= last_data_fifo_full;
|
||||
reg_fifo_status[18] <= last_addr_fifo_empty;
|
||||
reg_fifo_status[19] <= last_addr_fifo_full;
|
||||
reg_fifo_status[20] <= h2c_data_fifo_empty;
|
||||
reg_fifo_status[21] <= h2c_data_fifo_full;
|
||||
reg_fifo_status[22] <= h2c_cmd_fifo_empty;
|
||||
reg_fifo_status[23] <= h2c_cmd_fifo_full;
|
||||
reg_fifo_status[24] <= frame_generator_fifo_full;
|
||||
reg_fifo_status[25] <= frame_generator_fifo_empty;
|
||||
reg_fifo_status[26] <= eth_in_fifo_full;
|
||||
reg_fifo_status[27] <= eth_in_fifo_empty;
|
||||
end
|
||||
end
|
||||
|
||||
assign qsfp_led_conn = !reg_eth_stat_rx_status_2;
|
||||
assign qsfp_led_busy = !reg_eth_busy_2;
|
||||
|
||||
endmodule
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: CERN-OHL-S-2.0
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
`timescale 1 ps / 1 ps
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: CERN-OHL-S-2.0
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
`timescale 1ns / 1ps
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: CERN-OHL-S-2.0
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
`timescale 1ns / 1ps
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: CERN-OHL-S-2.0
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
`timescale 1ns / 1ps
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: CERN-OHL-S-2.0
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
`timescale 1ns / 1ps
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: CERN-OHL-S-2.0
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
`timescale 1ns / 1ps
|
||||
|
||||
@@ -5,14 +5,15 @@ ADD_LIBRARY( HLSSimulation STATIC
|
||||
hls_jfjoch.h
|
||||
../../common/Definitions.h
|
||||
load_calibration.cpp
|
||||
internal_packet_generator.cpp
|
||||
host_writer.cpp
|
||||
ethernet.cpp
|
||||
ipv4.cpp
|
||||
icmp.cpp arp.cpp
|
||||
ip_header_checksum.h
|
||||
udp.cpp
|
||||
sls_detector.cpp)
|
||||
sls_detector.cpp
|
||||
frame_generator.cpp
|
||||
stream_merge.cpp)
|
||||
|
||||
TARGET_INCLUDE_DIRECTORIES(HLSSimulation PUBLIC ../include)
|
||||
TARGET_LINK_LIBRARIES(HLSSimulation CommonFunctions)
|
||||
@@ -34,31 +35,31 @@ ENDFUNCTION(MAKE_HLS_MODULE)
|
||||
|
||||
MAKE_HLS_MODULE(data_collection_fsm.cpp data_collection_fsm)
|
||||
MAKE_HLS_MODULE(timer.cpp timer_host)
|
||||
MAKE_HLS_MODULE(timer.cpp timer_hbm)
|
||||
MAKE_HLS_MODULE(jf_conversion.cpp jf_conversion)
|
||||
MAKE_HLS_MODULE(load_calibration.cpp load_calibration)
|
||||
MAKE_HLS_MODULE(host_writer.cpp host_writer)
|
||||
MAKE_HLS_MODULE(internal_packet_generator.cpp internal_packet_generator)
|
||||
MAKE_HLS_MODULE(icmp.cpp icmp)
|
||||
MAKE_HLS_MODULE(ipv4.cpp ipv4)
|
||||
MAKE_HLS_MODULE(ethernet.cpp ethernet)
|
||||
MAKE_HLS_MODULE(arp.cpp arp)
|
||||
MAKE_HLS_MODULE(udp.cpp udp)
|
||||
MAKE_HLS_MODULE(sls_detector.cpp sls_detector)
|
||||
MAKE_HLS_MODULE(frame_generator.cpp frame_generator)
|
||||
MAKE_HLS_MODULE(stream_merge.cpp stream_merge)
|
||||
|
||||
SET (HLS_IPS psi_ch_hls_data_collection_fsm_1_0.zip
|
||||
psi_ch_hls_timer_host_1_0.zip
|
||||
psi_ch_hls_timer_hbm_1_0.zip
|
||||
psi_ch_hls_jf_conversion_1_0.zip
|
||||
psi_ch_hls_load_calibration_1_0.zip
|
||||
psi_ch_hls_internal_packet_generator_1_0.zip
|
||||
psi_ch_hls_ethernet_1_0.zip
|
||||
psi_ch_hls_ipv4_1_0.zip
|
||||
psi_ch_hls_arp_1_0.zip
|
||||
psi_ch_hls_udp_1_0.zip
|
||||
psi_ch_hls_sls_detector_1_0.zip
|
||||
psi_ch_hls_icmp_1_0.zip
|
||||
psi_ch_hls_host_writer_1_0.zip)
|
||||
psi_ch_hls_host_writer_1_0.zip
|
||||
psi_ch_hls_frame_generator_1_0.zip
|
||||
psi_ch_hls_stream_merge_1_0.zip)
|
||||
|
||||
SET (HLS_IPS ${HLS_IPS} PARENT_SCOPE)
|
||||
ADD_CUSTOM_TARGET(hls DEPENDS ${HLS_IPS})
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: CERN-OHL-S-2.0 or GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
|
||||
#include "hls_jfjoch.h"
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: CERN-OHL-S-2.0 or GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include "hls_jfjoch.h"
|
||||
|
||||
void data_collection_fsm(AXI_STREAM ð_in,
|
||||
STREAM_512 &data_out,
|
||||
hls::stream<ap_uint<ADDR_STREAM_WIDTH> > &addr_in,
|
||||
hls::stream<ap_uint<ADDR_STREAM_WIDTH> > &addr_out,
|
||||
hls::stream<axis_addr> &addr_in,
|
||||
hls::stream<axis_addr> &addr_out,
|
||||
volatile ap_uint<1> &in_run,
|
||||
volatile ap_uint<1> &in_cancel,
|
||||
volatile ap_uint<1> &out_idle,
|
||||
@@ -15,7 +14,8 @@ void data_collection_fsm(AXI_STREAM ð_in,
|
||||
ap_uint<32> one_over_energy,
|
||||
ap_uint<32> nframes,
|
||||
ap_uint<8> nmodules,
|
||||
ap_uint<4> nstorage_cells) {
|
||||
ap_uint<4> nstorage_cells,
|
||||
ap_uint<32> hbm_size_bytes) {
|
||||
#pragma HLS INTERFACE ap_ctrl_none port=return
|
||||
|
||||
#pragma HLS INTERFACE axis register both port=eth_in
|
||||
@@ -31,12 +31,13 @@ void data_collection_fsm(AXI_STREAM ð_in,
|
||||
#pragma HLS INTERFACE ap_none register port=nframes
|
||||
#pragma HLS INTERFACE ap_none register port=nmodules
|
||||
#pragma HLS INTERFACE ap_none register port=nstorage_cells
|
||||
#pragma HLS INTERFACE ap_none register port=hbm_size_bytes
|
||||
|
||||
#pragma HLS PIPELINE II=1 style=flp
|
||||
|
||||
packet_512_t packet_in;
|
||||
packet_512_t packet_out;
|
||||
ap_uint<ADDR_STREAM_WIDTH> addr;
|
||||
axis_addr addr;
|
||||
|
||||
enum rcv_state_t {RCV_WAIT_FOR_START = 0, RCV_WAIT_FOR_START_LOW = 1, RCV_START = 2, RCV_INIT = 3, RCV_GOOD = 4,
|
||||
RCV_FLUSH = 5, RCV_LAST = 6, RCV_FLUSH_IDLE = 7, RCV_IGNORE = 8};
|
||||
@@ -76,21 +77,18 @@ void data_collection_fsm(AXI_STREAM ð_in,
|
||||
ACT_REG_NFRAMES(packet_out.data) = nframes;
|
||||
ACT_REG_NMODULES(packet_out.data) = nmodules;
|
||||
ACT_REG_NSTORAGE_CELLS(packet_out.data) = nstorage_cells + 1;
|
||||
ACT_REG_HBM_SIZE_256b(packet_out.data) = hbm_size_bytes / 32;
|
||||
|
||||
packet_out.user = 0;
|
||||
packet_out.last = 0;
|
||||
packet_out.dest = 0;
|
||||
packet_out.id = 1;
|
||||
data_out << packet_out;
|
||||
|
||||
addr = 0;
|
||||
addr(63, 0) = mode;
|
||||
addr(79,64) = nmodules;
|
||||
addr.last = 0;
|
||||
addr_out << addr;
|
||||
|
||||
if (mode & MODE_INTERNAL_PACKET_GEN)
|
||||
rcv_state = RCV_LAST;
|
||||
else
|
||||
rcv_state = RCV_INIT;
|
||||
rcv_state = RCV_INIT;
|
||||
break;
|
||||
case RCV_INIT:
|
||||
out_idle = 0;
|
||||
@@ -99,7 +97,7 @@ void data_collection_fsm(AXI_STREAM ð_in,
|
||||
else if (!addr_in.empty()) {
|
||||
addr_in >> addr;
|
||||
|
||||
if (addr_frame_number(addr) >= nframes + DELAY_FRAMES_STOP_AND_QUIT)
|
||||
if (addr.frame_number >= nframes + DELAY_FRAMES_STOP_AND_QUIT)
|
||||
rcv_state = RCV_FLUSH;
|
||||
else {
|
||||
addr_out << addr;
|
||||
@@ -130,8 +128,7 @@ void data_collection_fsm(AXI_STREAM ð_in,
|
||||
break;
|
||||
case RCV_LAST:
|
||||
out_idle = 0;
|
||||
addr = 0;
|
||||
addr_last_flag(addr) = 1;
|
||||
addr.last = 1;
|
||||
addr_out << addr;
|
||||
|
||||
// Finish data collection
|
||||
@@ -1,11 +1,10 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#ifndef JUNGFRAUJOCH_DATAMOVER_MODEL_H
|
||||
#define JUNGFRAUJOCH_DATAMOVER_MODEL_H
|
||||
|
||||
#include "../hls/hls_jfjoch.h"
|
||||
#include <thread>
|
||||
#include "hls_jfjoch.h"
|
||||
|
||||
enum class Direction {Input, Output};
|
||||
|
||||
@@ -84,4 +83,5 @@ public:
|
||||
hls::stream<ap_axiu<N,1,1,1> >& GetDataStream() { return data; }
|
||||
~Datamover() { Stop(); }
|
||||
};
|
||||
|
||||
#endif //JUNGFRAUJOCH_DATAMOVER_MODEL_H
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: CERN-OHL-S-2.0 or GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
|
||||
#include "hls_jfjoch.h"
|
||||
|
||||
@@ -37,10 +37,9 @@ void ethernet(AXI_STREAM ð_in,
|
||||
if (state == INSPECT_HEADER) {
|
||||
dest = DEST_IGNORE;
|
||||
if (fpga_mac_addr != 0) {
|
||||
ap_uint < 48 > dest_mac = get_mac_addr(packet_in.data, 0);
|
||||
ap_uint < 48 > src_mac = get_mac_addr(packet_in.data, 48);
|
||||
|
||||
ap_uint < 16 > ether_type = get_header_field_16(packet_in.data, 12 * 8);
|
||||
ap_uint<48> dest_mac = packet_in.data(47, 0);
|
||||
ap_uint<48> src_mac = packet_in.data(95, 48);
|
||||
ap_uint<16> ether_type = get_header_field_16(packet_in.data, 12 * 8);
|
||||
|
||||
if ((dest_mac == fpga_mac_addr) && (ether_type == ETHER_IP)) {
|
||||
state = FORWARD;
|
||||
@@ -0,0 +1,117 @@
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
#include "hls_jfjoch.h"
|
||||
#include "ip_header_checksum.h"
|
||||
|
||||
void generate_packet(STREAM_512 &data_out,
|
||||
ap_uint<512> *uram,
|
||||
ap_uint<32> frame,
|
||||
ap_uint<8> module,
|
||||
ap_uint<7> eth_packet,
|
||||
ap_uint<48> src_mac_addr,
|
||||
ap_uint<48> dest_mac_addr,
|
||||
ap_uint<32> src_ipv4_addr,
|
||||
ap_uint<32> dest_ipv4_addr,
|
||||
ap_uint<64> bunchid,
|
||||
ap_uint<32> exptime,
|
||||
ap_uint<64> timestamp,
|
||||
ap_uint<32> debug) {
|
||||
#pragma HLS PIPELINE II=130
|
||||
ap_uint<720> header = 0;
|
||||
|
||||
header(47 , 0) = dest_mac_addr;
|
||||
header(95 , 48) = src_mac_addr;
|
||||
header(111, 96) = 0x0008; // ETHER_IP = IPv4
|
||||
header(eth_payload_pos+3 , eth_payload_pos ) = 0x5; // header len of 5
|
||||
header(eth_payload_pos+7 , eth_payload_pos+4 ) = 0x4; // IPv4
|
||||
header(eth_payload_pos+31 , eth_payload_pos+16 ) = 0x4C20; // total length = 8268
|
||||
header(eth_payload_pos+79 , eth_payload_pos+72 ) = PROTOCOL_UDP; // UDP
|
||||
header(eth_payload_pos+127, eth_payload_pos+96 ) = src_ipv4_addr;
|
||||
header(eth_payload_pos+159, eth_payload_pos+128) = dest_ipv4_addr;
|
||||
header(eth_payload_pos+95 , eth_payload_pos+80 ) = computeCheckSum20B(header(eth_payload_pos + 159, eth_payload_pos));
|
||||
|
||||
header(ipv4_payload_pos+47, ipv4_payload_pos+32) = 0x3820; // UDP length = 8248
|
||||
header(udp_payload_pos+63, udp_payload_pos) = frame + 1;
|
||||
header(udp_payload_pos+95, udp_payload_pos+64) = exptime;
|
||||
header(udp_payload_pos+127, udp_payload_pos+96) = eth_packet;
|
||||
header(udp_payload_pos+2*64+63, udp_payload_pos+2*64) = bunchid;
|
||||
header(udp_payload_pos+3*64+63, udp_payload_pos+3*64) = timestamp;
|
||||
header(udp_payload_pos+4*64+31, udp_payload_pos+4*64+16) = 2 * module;
|
||||
header(udp_payload_pos+5*64+31, udp_payload_pos+5*64) = debug;
|
||||
|
||||
packet_512_t packet;
|
||||
packet.data = header(511 ,0);
|
||||
packet.last = 0;
|
||||
packet.dest = 0;
|
||||
packet.id = 0;
|
||||
packet.strb = UINT64_MAX;
|
||||
packet.keep = UINT64_MAX;
|
||||
packet.user = 0;
|
||||
|
||||
data_out << packet;
|
||||
|
||||
ap_uint<208> remainder = header(719, 512);
|
||||
for (int i = 0; i < 128; i++) {
|
||||
ap_uint<512> tmp = uram[eth_packet * 128 + i];
|
||||
//tmp(255, 0) = d_hbm_p0[eth_packet * 128 + i];
|
||||
//tmp(511, 256) = d_hbm_p1[eth_packet * 128 + i];
|
||||
packet.data(207, 0) = remainder;
|
||||
packet.data(511, 208) = tmp(303, 0);
|
||||
data_out << packet;
|
||||
remainder = tmp(511, 304);
|
||||
}
|
||||
packet.data(207, 0) = remainder;
|
||||
packet.data(511, 208) = 0;
|
||||
packet.keep(63, 26) = 0;
|
||||
packet.last = 1;
|
||||
data_out << packet;
|
||||
}
|
||||
|
||||
void frame_generator(STREAM_512 &data_out,
|
||||
ap_uint<512> *uram,
|
||||
ap_uint<32> frames,
|
||||
ap_uint<5> modules,
|
||||
ap_uint<48> src_mac_addr,
|
||||
ap_uint<48> dest_mac_addr,
|
||||
ap_uint<32> src_ipv4_addr,
|
||||
ap_uint<32> dest_ipv4_addr,
|
||||
ap_uint<64> bunchid,
|
||||
ap_uint<32> exptime,
|
||||
ap_uint<32> debug) {
|
||||
#pragma HLS INTERFACE mode=s_axilite port=return
|
||||
#pragma HLS INTERFACE mode=s_axilite port=frames
|
||||
#pragma HLS INTERFACE mode=s_axilite port=modules
|
||||
#pragma HLS INTERFACE mode=s_axilite port=bunchid
|
||||
#pragma HLS INTERFACE mode=s_axilite port=exptime
|
||||
#pragma HLS INTERFACE mode=s_axilite port=debug
|
||||
#pragma HLS INTERFACE mode=s_axilite port=dest_mac_addr
|
||||
#pragma HLS INTERFACE mode=s_axilite port=dest_ipv4_addr
|
||||
#pragma HLS INTERFACE mode=ap_none port=src_mac_addr
|
||||
#pragma HLS INTERFACE mode=ap_none port=src_ipv4_addr
|
||||
|
||||
#pragma HLS INTERFACE register both axis port=data_out
|
||||
#pragma HLS INTERFACE m_axi port=uram bundle=uram depth=512 offset=off \
|
||||
max_read_burst_length=64 max_write_burst_length=2 latency=5 num_write_outstanding=2 num_read_outstanding=2
|
||||
//#pragma HLS INTERFACE m_axi port=d_hbm_p0 bundle=d_hbm_p0 depth=512 offset=off \
|
||||
// max_read_burst_length=16 max_write_burst_length=2 latency=120 num_write_outstanding=2 num_read_outstanding=9
|
||||
//#pragma HLS INTERFACE m_axi port=d_hbm_p1 bundle=d_hbm_p1 depth=512 offset=off \
|
||||
// max_read_burst_length=16 max_write_burst_length=2 latency=120 num_write_outstanding=2 num_read_outstanding=9
|
||||
|
||||
for (uint32_t f = 0; f < frames; f++) {
|
||||
for (uint32_t p = 0; p < 128; p++) {
|
||||
for (uint32_t m = 0; m < modules; m++) {
|
||||
generate_packet(data_out,
|
||||
uram,
|
||||
f, m, p,
|
||||
src_mac_addr,
|
||||
dest_mac_addr,
|
||||
src_ipv4_addr,
|
||||
dest_ipv4_addr,
|
||||
bunchid + f,
|
||||
exptime,
|
||||
exptime * f,
|
||||
debug);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: CERN-OHL-S-2.0 or GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
|
||||
#ifndef JUNGFRAUJOCH_HLS_JFJOCH_H
|
||||
#define JUNGFRAUJOCH_HLS_JFJOCH_H
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <hls_burst_maxi.h>
|
||||
#else
|
||||
#include "../include/hls_burst_maxi.h"
|
||||
#include <parallel_stream.h>
|
||||
#include "parallel_stream.h"
|
||||
#endif
|
||||
|
||||
#include "../../common/Definitions.h"
|
||||
@@ -22,8 +22,6 @@
|
||||
// Number of modules that can be simultaneously handled by the FPGA
|
||||
#define MAX_MODULES_FPGA 16
|
||||
|
||||
#define ADDR_STREAM_WIDTH 320
|
||||
|
||||
typedef ap_ufixed<16,2, AP_RND_CONV> gainG0_t;
|
||||
typedef ap_ufixed<16,4, AP_RND_CONV> gainG1_t;
|
||||
typedef ap_ufixed<16,6, AP_RND_CONV> gainG2_t;
|
||||
@@ -50,48 +48,68 @@ typedef ap_axiu<512,1, 1, 1> packet_512_t;
|
||||
typedef hls::stream<packet_512_t> AXI_STREAM;
|
||||
typedef hls::stream<packet_512_t> STREAM_512;
|
||||
|
||||
#define addr_frame_number(x) x(63, 0)
|
||||
#define addr_eth_packet(x) x(70, 64)
|
||||
#define addr_module(x) x(76, 72)
|
||||
#define addr_last_flag(x) x[79]
|
||||
#define addr_jf_debug(x) x(127, 96)
|
||||
#define addr_timestamp(x) x(191,128)
|
||||
#define addr_bunch_id(x) x(255,192)
|
||||
#define addr_exptime(x) x(256+63, 256)
|
||||
|
||||
#define ACT_REG_MODE(x) ((x)(63, 0)) // 64 bit
|
||||
#define ACT_REG_ONE_OVER_ENERGY(x) ((x)(95, 64)) // 32 bit
|
||||
#define ACT_REG_NFRAMES(x) ((x)(127, 96)) // 32 bit
|
||||
#define ACT_REG_MODE(x) ((x)(32 , 0)) // 32 bit
|
||||
#define ACT_REG_ONE_OVER_ENERGY(x) ((x)(63 , 32)) // 32 bit
|
||||
#define ACT_REG_NFRAMES(x) ((x)(95 , 64)) // 32 bit
|
||||
#define ACT_REG_NMODULES(x) ((x)(132, 128)) // 5 bit (0..31)
|
||||
#define ACT_REG_NSTORAGE_CELLS(x) ((x)(148, 144)) // 5 bit
|
||||
#define ACT_REG_HBM_SIZE_256b(x) ((x)(191, 160)) // 32 bit
|
||||
|
||||
struct axis_datamover_ctrl {
|
||||
ap_uint<40+64> data;
|
||||
};
|
||||
|
||||
struct axis_addr {
|
||||
ap_uint<64> frame_number;
|
||||
ap_uint<64> exptime;
|
||||
ap_uint<64> timestamp;
|
||||
ap_uint<64> bunchid;
|
||||
ap_uint<32> debug;
|
||||
ap_uint<5> module;
|
||||
ap_uint<7> eth_packet;
|
||||
ap_uint<1> last;
|
||||
};
|
||||
|
||||
void setup_datamover (hls::stream<axis_datamover_ctrl> &datamover_cmd_stream, uint64_t address, size_t bytes_to_write);
|
||||
|
||||
void data_collection_fsm(AXI_STREAM ð_in,
|
||||
STREAM_512 &data_out,
|
||||
hls::stream<ap_uint<ADDR_STREAM_WIDTH> > &addr_in,
|
||||
hls::stream<ap_uint<ADDR_STREAM_WIDTH> > &addr_out,
|
||||
hls::stream<axis_addr> &addr_in,
|
||||
hls::stream<axis_addr> &addr_out,
|
||||
volatile ap_uint<1> &in_run,
|
||||
volatile ap_uint<1> &in_cancel,
|
||||
volatile ap_uint<1> &out_idle,
|
||||
ap_uint<32> mode,
|
||||
ap_uint<32> one_over_energy,
|
||||
ap_uint<32> frames_per_trigger,
|
||||
ap_uint<32> nframes,
|
||||
ap_uint<8> nmodules,
|
||||
ap_uint<4> nstorage_cells);
|
||||
ap_uint<4> nstorage_cells,
|
||||
ap_uint<32> hbm_size_bytes);
|
||||
|
||||
void load_calibration(STREAM_512 &data_in, STREAM_512 &data_out,
|
||||
void load_calibration(ap_uint<256> *d_hbm_p0,
|
||||
ap_uint<256> *d_hbm_p1,
|
||||
ap_uint<8> modules,
|
||||
ap_uint<5> storage_cells,
|
||||
ap_uint<32> hbm_size_bytes,
|
||||
hls::stream<axis_datamover_ctrl> &datamover_in_cmd,
|
||||
hls::stream<ap_axiu<512,1,1,1> > &host_memory_in,
|
||||
uint64_t in_mem_location[LOAD_CALIBRATION_BRAM_SIZE]);
|
||||
|
||||
void frame_generator(STREAM_512 &data_out,
|
||||
ap_uint<512> *uram,
|
||||
ap_uint<32> frames,
|
||||
ap_uint<5> modules,
|
||||
ap_uint<48> src_mac_addr,
|
||||
ap_uint<48> dest_mac_addr,
|
||||
ap_uint<32> src_ipv4_addr,
|
||||
ap_uint<32> dest_ipv4_addr,
|
||||
ap_uint<64> bunchid,
|
||||
ap_uint<32> exptime,
|
||||
ap_uint<32> debug);
|
||||
|
||||
void jf_conversion(STREAM_512 &data_in, STREAM_512 &data_out,
|
||||
hls::stream<ap_uint<ADDR_STREAM_WIDTH> > &addr_in,
|
||||
hls::stream<ap_uint<ADDR_STREAM_WIDTH> > &addr_out,
|
||||
hls::stream<axis_addr> &addr_in,
|
||||
hls::stream<axis_addr> &addr_out,
|
||||
hls::burst_maxi<hbm256_t> d_hbm_p0, hls::burst_maxi<hbm256_t> d_hbm_p1,
|
||||
hls::burst_maxi<hbm256_t> d_hbm_p2, hls::burst_maxi<hbm256_t> d_hbm_p3,
|
||||
hls::burst_maxi<hbm256_t> d_hbm_p4, hls::burst_maxi<hbm256_t> d_hbm_p5,
|
||||
@@ -100,21 +118,22 @@ void jf_conversion(STREAM_512 &data_in, STREAM_512 &data_out,
|
||||
hls::burst_maxi<hbm256_t> d_hbm_p10, hls::burst_maxi<hbm256_t> d_hbm_p11);
|
||||
|
||||
void host_writer(STREAM_512 &data_in,
|
||||
hls::stream<ap_uint<ADDR_STREAM_WIDTH> > &addr_in,
|
||||
hls::stream<axis_addr> &addr_in,
|
||||
hls::stream<ap_axiu<512,1,1,1> > &host_memory_out,
|
||||
hls::stream<axis_datamover_ctrl> &datamover_out_cmd,
|
||||
hls::stream<ap_uint<32> > &s_axis_work_request,
|
||||
hls::stream<ap_uint<32> > &m_axis_completion,
|
||||
volatile uint64_t &packets_processed,
|
||||
volatile ap_uint<1> &idle,
|
||||
ap_uint<8> &err_reg);
|
||||
|
||||
void timer_hbm(STREAM_512 &in, STREAM_512 &data_out, uint64_t &counter);
|
||||
void timer_host(STREAM_512 &data_in, STREAM_512 &data_out, uint64_t &counter);
|
||||
void timer_host(STREAM_512 &data_in,
|
||||
STREAM_512 &data_out,
|
||||
volatile uint64_t &counter);
|
||||
|
||||
void internal_packet_generator(STREAM_512 &data_in, STREAM_512 &data_out,
|
||||
hls::stream<ap_uint<ADDR_STREAM_WIDTH> > &addr_in,
|
||||
hls::stream<ap_uint<ADDR_STREAM_WIDTH> > &addr_out,
|
||||
volatile ap_uint<1> &in_cancel);
|
||||
void stream_merge(AXI_STREAM &input_0,
|
||||
AXI_STREAM &input_1,
|
||||
AXI_STREAM &output);
|
||||
|
||||
template<int N> ap_uint<N*32> pack32(ap_int<N> in[32]) {
|
||||
#pragma HLS INLINE
|
||||
@@ -144,25 +163,6 @@ inline void setup_datamover (hls::stream<axis_datamover_ctrl> &datamover_cmd_str
|
||||
datamover_cmd_stream << msg;
|
||||
}
|
||||
|
||||
inline ap_uint<ADDR_STREAM_WIDTH> addr_packet(ap_uint<8> eth_packet,
|
||||
ap_uint<5> module,
|
||||
ap_uint<64> frame,
|
||||
ap_uint<32> jf_debug,
|
||||
ap_uint<64> timestamp,
|
||||
ap_uint<64> bunchid,
|
||||
ap_uint<32> expttime) {
|
||||
#pragma HLS INLINE
|
||||
ap_uint<ADDR_STREAM_WIDTH> retval = 0;
|
||||
addr_eth_packet(retval) = eth_packet;
|
||||
addr_module(retval) = module;
|
||||
addr_frame_number(retval) = frame;
|
||||
addr_jf_debug(retval) = jf_debug;
|
||||
addr_timestamp(retval) = timestamp;
|
||||
addr_bunch_id(retval) = bunchid;
|
||||
addr_exptime(retval) = expttime;
|
||||
return retval;
|
||||
}
|
||||
|
||||
inline ap_uint<16> get_header_field_16(ap_uint<512> data, size_t position) {
|
||||
ap_uint<16> tmp = data(position+15, position);
|
||||
ap_uint<16> retval;
|
||||
@@ -172,14 +172,6 @@ inline ap_uint<16> get_header_field_16(ap_uint<512> data, size_t position) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
inline ap_uint<48> get_mac_addr(ap_uint<512> data, size_t position) {
|
||||
return data(position+47,position);
|
||||
}
|
||||
|
||||
inline ap_uint<32> get_header_field_32_network_order(ap_uint<512> data, size_t position) {
|
||||
return data(position+31, position);
|
||||
}
|
||||
|
||||
static const uint8_t ECHO_REQUEST = 0x08;
|
||||
static const uint8_t ECHO_REPLY = 0x00;
|
||||
static const uint8_t PROTOCOL_ICMP = 0x01;
|
||||
@@ -192,7 +184,6 @@ static const uint32_t eth_payload_pos = 14 * 8; // 112 bits
|
||||
static const uint32_t ipv4_payload_pos = eth_payload_pos + 160; // 112 + 160 = 272 bits
|
||||
static const uint32_t udp_payload_pos = ipv4_payload_pos + 64; // 112 + 160 + 64 = 336 bits (42 bytes)
|
||||
|
||||
|
||||
// Network cores
|
||||
#define UDP_METADATA_STREAM_WIDTH 48
|
||||
#define udp_metadata_dest_port(x) x(15, 0)
|
||||
@@ -231,10 +222,9 @@ void udp(AXI_STREAM ð_in,
|
||||
void sls_detector(AXI_STREAM &udp_payload_in,
|
||||
hls::stream<ap_uint<UDP_METADATA_STREAM_WIDTH> > &udp_metadata_in,
|
||||
AXI_STREAM &data_out,
|
||||
hls::stream<ap_uint<ADDR_STREAM_WIDTH> > &addr_out,
|
||||
hls::stream<axis_addr> &addr_out,
|
||||
uint64_t& counter,
|
||||
uint32_t& counter_eth_error,
|
||||
uint32_t& counter_len_error,
|
||||
volatile ap_uint<1> &in_clear_counters);
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: CERN-OHL-S-2.0 or GPL-3.0-or-later
|
||||
// Copyright (2019-2023) Paul Scherrer Institute
|
||||
|
||||
|
||||
#include "hls_jfjoch.h"
|
||||
|
||||
@@ -10,44 +10,48 @@
|
||||
#define PACKET_SIZE 8192
|
||||
|
||||
inline void write_completion(hls::stream<ap_uint<32> > &m_axis_completion,
|
||||
const ap_uint<32> &handle,
|
||||
const ap_uint<8> &module,
|
||||
const ap_uint<64> &frame_num,
|
||||
const ap_uint<256> &packet_mask,
|
||||
const ap_uint<16> &packet_count,
|
||||
const ap_uint<32> &debug,
|
||||
const ap_uint<64> ×tamp,
|
||||
const ap_uint<64> &bunchid,
|
||||
const ap_uint<32> &exptime) {
|
||||
const ap_uint<32> &handle,
|
||||
const ap_uint<8> &module_number,
|
||||
const ap_uint<64> &frame_num,
|
||||
const ap_uint<128> &packet_mask,
|
||||
const ap_uint<16> &packet_count,
|
||||
const ap_uint<32> &debug,
|
||||
const ap_uint<64> ×tamp,
|
||||
const ap_uint<64> &bunchid,
|
||||
const ap_uint<32> &exptime,
|
||||
const ap_uint<32> &data_collection_id,
|
||||
const ap_uint<1> &flushing) {
|
||||
#pragma HLS INLINE
|
||||
ap_uint<1> all_packets_ok = packet_mask.and_reduce();
|
||||
ap_uint<1> any_packets_received = packet_mask.or_reduce();
|
||||
ap_uint<8> status = 0;
|
||||
status[0] = all_packets_ok;
|
||||
status[1] = any_packets_received;
|
||||
|
||||
ap_uint<128> tmp = (handle, packet_count, status, module, frame_num);
|
||||
status[2] = flushing;
|
||||
ap_uint<128> tmp = (handle, packet_count, status, module_number, frame_num);
|
||||
status[7] = tmp.xor_reduce(); // ensure completion has even parity
|
||||
|
||||
m_axis_completion << handle;
|
||||
m_axis_completion << (packet_count, status, module);
|
||||
m_axis_completion << frame_num(63, 32);
|
||||
m_axis_completion << frame_num(31, 0);
|
||||
if (handle != HANDLE_SKIP_FRAME) {
|
||||
m_axis_completion << handle;
|
||||
m_axis_completion << (packet_count, status, module_number);
|
||||
m_axis_completion << frame_num(63, 32);
|
||||
m_axis_completion << frame_num(31, 0);
|
||||
|
||||
m_axis_completion << timestamp(63,32);
|
||||
m_axis_completion << timestamp(31,0);
|
||||
m_axis_completion << bunchid(63,32);
|
||||
m_axis_completion << bunchid(31,0);
|
||||
m_axis_completion << timestamp(63,32);
|
||||
m_axis_completion << timestamp(31,0);
|
||||
m_axis_completion << bunchid(63,32);
|
||||
m_axis_completion << bunchid(31,0);
|
||||
|
||||
m_axis_completion << exptime;
|
||||
m_axis_completion << debug;
|
||||
m_axis_completion << 0;
|
||||
m_axis_completion << 0;
|
||||
m_axis_completion << exptime;
|
||||
m_axis_completion << debug;
|
||||
m_axis_completion << 0;
|
||||
m_axis_completion << data_collection_id;
|
||||
|
||||
m_axis_completion << packet_mask(127,96);
|
||||
m_axis_completion << packet_mask( 95,64);
|
||||
m_axis_completion << packet_mask( 63,32);
|
||||
m_axis_completion << packet_mask( 31, 0);
|
||||
m_axis_completion << packet_mask(127,96);
|
||||
m_axis_completion << packet_mask( 95,64);
|
||||
m_axis_completion << packet_mask( 63,32);
|
||||
m_axis_completion << packet_mask( 31, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,12 +78,13 @@ inline ap_uint<1> read_request(hls::stream<ap_uint<32> > &s_axis_work_request,
|
||||
}
|
||||
|
||||
void host_writer(STREAM_512 &data_in,
|
||||
hls::stream<ap_uint<ADDR_STREAM_WIDTH> > &addr_in,
|
||||
hls::stream<axis_addr> &addr_in,
|
||||
hls::stream<ap_axiu<512,1,1,1> > &host_memory_out,
|
||||
hls::stream<axis_datamover_ctrl> &datamover_out_cmd,
|
||||
hls::stream<ap_uint<32> > &s_axis_work_request,
|
||||
hls::stream<ap_uint<32> > &m_axis_completion,
|
||||
volatile uint64_t &packets_processed,
|
||||
volatile ap_uint<1> &idle,
|
||||
ap_uint<8> &err_reg) {
|
||||
#pragma HLS INTERFACE ap_ctrl_none port=return
|
||||
#pragma HLS INTERFACE register both axis port=data_in
|
||||
@@ -90,15 +95,7 @@ void host_writer(STREAM_512 &data_in,
|
||||
#pragma HLS INTERFACE register both axis port=s_axis_work_request
|
||||
#pragma HLS INTERFACE register ap_vld port=packets_processed
|
||||
#pragma HLS INTERFACE register ap_vld port=err_reg
|
||||
|
||||
ap_uint<ADDR_STREAM_WIDTH> addr;
|
||||
addr_in >> addr;
|
||||
|
||||
packet_512_t packet_in;
|
||||
data_in >> packet_in;
|
||||
|
||||
ap_uint<8> internal_err_reg = 0;
|
||||
err_reg = internal_err_reg;
|
||||
#pragma HLS INTERFACE register ap_none port=idle
|
||||
|
||||
ap_uint<128> packet_mask[MAX_MODULES_FPGA*2];
|
||||
#pragma HLS RESOURCE variable=packet_mask core=RAM_1P
|
||||
@@ -119,6 +116,8 @@ void host_writer(STREAM_512 &data_in,
|
||||
ap_uint<64> curr_offset[MAX_MODULES_FPGA*2];
|
||||
#pragma HLS RESOURCE variable=curr_offset core=RAM_1P
|
||||
|
||||
idle = 1;
|
||||
|
||||
for (int i = 0; i < MAX_MODULES_FPGA*2; i++) {
|
||||
#pragma HLS UNROLL
|
||||
curr_frame[i] = UINT64_MAX;
|
||||
@@ -132,8 +131,32 @@ void host_writer(STREAM_512 &data_in,
|
||||
jf_bunchid[i] = 0;
|
||||
}
|
||||
|
||||
write_completion(m_axis_completion, UINT32_MAX - 1, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
ap_uint<32> req_handle;
|
||||
ap_uint<64> req_host_offset;
|
||||
|
||||
while (data_in.empty()) {
|
||||
#pragma HLS PIPELINE II=4
|
||||
if (!s_axis_work_request.empty())
|
||||
read_request(s_axis_work_request, req_handle, req_host_offset);
|
||||
}
|
||||
|
||||
axis_addr addr;
|
||||
addr_in >> addr;
|
||||
|
||||
packet_512_t packet_in;
|
||||
data_in >> packet_in;
|
||||
ap_uint<5> nmodules = ACT_REG_NMODULES(packet_in.data);
|
||||
ap_uint<32> data_collection_mode = ACT_REG_MODE(packet_in.data);
|
||||
ap_uint<32> data_collection_id = data_collection_mode(31, 16); // upper 16-bit of mode
|
||||
|
||||
ap_uint<1> mode_nonblocking = (data_collection_mode & MODE_NONBLOCKING_ON_WR) ? 1 : 0;
|
||||
|
||||
ap_uint<8> internal_err_reg = 0;
|
||||
err_reg = internal_err_reg;
|
||||
|
||||
write_completion(m_axis_completion, HANDLE_START, 0, 0, 0, 0, 0, 0, 0, 0, data_collection_id, 0);
|
||||
|
||||
idle = 0;
|
||||
uint64_t total_counter = 0;
|
||||
packets_processed = 0;
|
||||
addr_in >> addr;
|
||||
@@ -144,28 +167,15 @@ void host_writer(STREAM_512 &data_in,
|
||||
packet_out.dest = 0;
|
||||
packet_out.id = 0;
|
||||
packet_out.user = 0;
|
||||
|
||||
ap_uint<32> req_handle;
|
||||
ap_uint<64> req_host_offset;
|
||||
|
||||
Loop_good_packet:
|
||||
while (!addr_last_flag(addr)) {
|
||||
while (!addr.last) {
|
||||
// Process one UDP packet per iteration
|
||||
#pragma HLS PIPELINE II=128
|
||||
ap_uint<64> frame_number = addr_frame_number(addr);
|
||||
ap_uint<4> module = addr_module(addr);
|
||||
ap_uint<7> eth_packet = addr_eth_packet(addr);
|
||||
ap_uint<5> id = module * 2 + (frame_number % 2);
|
||||
|
||||
for (int i = 0; i < 128; i++) {
|
||||
data_in >> packet_in;
|
||||
packet_out.data = packet_in.data;
|
||||
packet_out.last = packet_in.last;
|
||||
host_memory_out << packet_out;
|
||||
}
|
||||
|
||||
if (packet_in.last != 1)
|
||||
internal_err_reg[1] = 1;
|
||||
ap_uint<64> frame_number = addr.frame_number;
|
||||
ap_uint<4> module_number = addr.module;
|
||||
ap_uint<7> eth_packet = addr.eth_packet;
|
||||
ap_uint<5> id = module_number * 2 + (frame_number % 2);
|
||||
|
||||
if (curr_frame[id] != frame_number) {
|
||||
if (packet_mask[id] != 0) {
|
||||
@@ -178,26 +188,37 @@ void host_writer(STREAM_512 &data_in,
|
||||
ap_uint<64> comp_bunchid = jf_bunchid[id];
|
||||
ap_uint<32> comp_exptime = exptime[id];
|
||||
|
||||
write_completion(m_axis_completion, comp_handle, module,
|
||||
write_completion(m_axis_completion, comp_handle, module_number,
|
||||
comp_frame, comp_packet_mask, comp_packet_count,
|
||||
comp_debug, comp_timestamp, comp_bunchid,
|
||||
comp_exptime);
|
||||
comp_exptime, data_collection_id, 0);
|
||||
}
|
||||
|
||||
if (read_request(s_axis_work_request, req_handle, req_host_offset))
|
||||
internal_err_reg[2] = 1;
|
||||
|
||||
if (req_handle == UINT32_MAX)
|
||||
internal_err_reg[4] = 1;
|
||||
if (module_number >= nmodules) {
|
||||
req_handle = HANDLE_SKIP_FRAME;
|
||||
req_host_offset = 0;
|
||||
internal_err_reg[5] = 1;
|
||||
} else if (s_axis_work_request.empty() && mode_nonblocking) {
|
||||
req_handle = HANDLE_SKIP_FRAME;
|
||||
req_host_offset = 0;
|
||||
} else {
|
||||
if (read_request(s_axis_work_request, req_handle, req_host_offset))
|
||||
internal_err_reg[2] = 1;
|
||||
if (req_handle >= HANDLE_SKIP_FRAME) {
|
||||
req_handle = HANDLE_SKIP_FRAME;
|
||||
req_host_offset = 0;
|
||||
internal_err_reg[4] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
handle[id] = req_handle;
|
||||
curr_frame[id] = frame_number;
|
||||
curr_offset[id] = req_host_offset;
|
||||
|
||||
debug[id] = addr_jf_debug(addr);
|
||||
timestamp[id] = addr_timestamp(addr);
|
||||
jf_bunchid[id] = addr_bunch_id(addr);
|
||||
exptime[id] = addr_exptime(addr);
|
||||
debug[id] = addr.debug;
|
||||
timestamp[id] = addr.timestamp;
|
||||
jf_bunchid[id] = addr.bunchid;
|
||||
exptime[id] = addr.exptime;
|
||||
|
||||
packet_mask[id] = ap_uint<128>(1) << eth_packet;
|
||||
packet_count[id] = 1;
|
||||
@@ -206,13 +227,31 @@ void host_writer(STREAM_512 &data_in,
|
||||
packet_mask[id] |= ap_uint<128>(1) << eth_packet;
|
||||
}
|
||||
|
||||
size_t out_frame_addr = curr_offset[id] + eth_packet * PACKET_SIZE;
|
||||
if (handle[id] != HANDLE_SKIP_FRAME) {
|
||||
for (int i = 0; i < 128; i++) {
|
||||
data_in >> packet_in;
|
||||
packet_out.data = packet_in.data;
|
||||
packet_out.last = packet_in.last;
|
||||
host_memory_out << packet_out;
|
||||
}
|
||||
|
||||
if (out_frame_addr % 128 != 0) internal_err_reg[0] = 1;
|
||||
if (curr_offset[id] == 0) internal_err_reg[3] = 1;
|
||||
packets_processed = ++total_counter;
|
||||
if (packet_in.last != 1)
|
||||
internal_err_reg[1] = 1;
|
||||
|
||||
setup_datamover(datamover_out_cmd, out_frame_addr, PACKET_SIZE);
|
||||
size_t out_frame_addr = curr_offset[id] + eth_packet * PACKET_SIZE;
|
||||
|
||||
if (out_frame_addr % 128 != 0) internal_err_reg[0] = 1;
|
||||
if (curr_offset[id] == 0) internal_err_reg[3] = 1;
|
||||
total_counter++;
|
||||
packets_processed = total_counter;
|
||||
setup_datamover(datamover_out_cmd, out_frame_addr, PACKET_SIZE);
|
||||
} else {
|
||||
for (int i = 0; i < 128; i++)
|
||||
data_in >> packet_in;
|
||||
|
||||
if (packet_in.last != 1)
|
||||
internal_err_reg[1] = 1;
|
||||
}
|
||||
addr_in >> addr;
|
||||
err_reg = internal_err_reg;
|
||||
}
|
||||
@@ -222,23 +261,17 @@ void host_writer(STREAM_512 &data_in,
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
#endif
|
||||
|
||||
for (ap_uint<8> m = 0; m < MAX_MODULES_FPGA * 2; m++) {
|
||||
for (ap_uint<8> m = 0; m < nmodules * 2; m++) {
|
||||
#pragma HLS PIPELINE II=16
|
||||
if (packet_mask[m] > 0)
|
||||
if (packet_mask[m] != 0)
|
||||
write_completion(m_axis_completion, handle[m], m / 2, curr_frame[m],
|
||||
packet_mask[m], packet_count[m],
|
||||
debug[m], timestamp[m], jf_bunchid[m],
|
||||
exptime[m]);
|
||||
exptime[m], data_collection_id, 1);
|
||||
}
|
||||
|
||||
data_in >> packet_in;
|
||||
|
||||
write_completion(m_axis_completion, UINT32_MAX, 0, total_counter, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
read_request(s_axis_work_request, req_handle, req_host_offset);
|
||||
|
||||
while (req_handle != UINT32_MAX) {
|
||||
#pragma HLS PIPELINE II=4
|
||||
read_request(s_axis_work_request, req_handle, req_host_offset);
|
||||
}
|
||||
write_completion(m_axis_completion, HANDLE_END, 0, 0, 0, 0, 0, 0, 0, 0, data_collection_id, 0);
|
||||
idle = 1;
|
||||
}
|
||||
@@ -34,7 +34,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
************************************************/
|
||||
|
||||
// With modifications from Paul Scherrer Insitute
|
||||
// SPDX-License-Identifier: CERN-OHL-S-2.0 or GPL-3.0-or-later
|
||||
|
||||
|
||||
#include "hls_jfjoch.h"
|
||||
#include "ip_header_checksum.h"
|
||||
@@ -111,8 +111,8 @@ void icmp(AXI_STREAM& eth_in, AXI_STREAM& eth_out, uint64_t& counter,
|
||||
if (eth_in.read_nb(packet)) {
|
||||
if (state == INSPECT_HEADER) {
|
||||
|
||||
ap_uint < 48 > dest_mac = get_mac_addr(packet.data, 0);
|
||||
ap_uint < 48 > src_mac = get_mac_addr(packet.data, 48);
|
||||
ap_uint<48> dest_mac = packet.data(47, 0);
|
||||
ap_uint<48> src_mac = packet.data(95, 48);
|
||||
|
||||
// Swap MAC addresses for reply
|
||||
packet.data(47, 0) = src_mac;
|
||||
@@ -127,8 +127,8 @@ void icmp(AXI_STREAM& eth_in, AXI_STREAM& eth_out, uint64_t& counter,
|
||||
|
||||
if ((icmp_type == ECHO_REQUEST) && (icmp_code == 0)) {
|
||||
|
||||
ap_uint < 32 > ipv4_src_ip = packet.data(eth_payload_pos + 127, eth_payload_pos + 96);
|
||||
ap_uint < 32 > ipv4_dest_ip = packet.data(eth_payload_pos + 159, eth_payload_pos + 128);
|
||||
ap_uint<32> ipv4_src_ip = packet.data(eth_payload_pos + 127, eth_payload_pos + 96);
|
||||
ap_uint<32> ipv4_dest_ip = packet.data(eth_payload_pos + 159, eth_payload_pos + 128);
|
||||
|
||||
packet.data(eth_payload_pos + 71, eth_payload_pos + 64) = 128; // IP time to live
|
||||
packet.data(eth_payload_pos + 95, eth_payload_pos + 80) = 0;
|
||||
@@ -34,7 +34,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
************************************************/
|
||||
|
||||
// With modifications from Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: CERN-OHL-S-2.0 or GPL-3.0-or-later
|
||||
|
||||
|
||||
#ifndef JUNGFRAUJOCH_IP_HEADER_CHECKSUM_H
|
||||
#define JUNGFRAUJOCH_IP_HEADER_CHECKSUM_H
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user