HLS kernels are reference only: Xilinx headers and the CPU kernel library removed
fpga/hls stays in the tree as the source of the firmware, but CMake no longer compiles it: the CPU library JFJochHLSCores (built with -DJFJOCH_HLS_NOSYNTH, linked by nothing since the HLS simulation went) is gone. Only the vitis_hls synthesis targets remain (hls, pcie_100g, pcie_8x10g, *_bd), defined only when vivado and vitis_hls are on PATH; synth_hls_function.tcl passes no include path, so Vitis uses its own ap_int.h/hls_stream.h/hls_burst_maxi.h. Deleted: fpga/include (the Xilinx ap_* arbitrary-precision headers, etc/ap_private.h, the modified hls_burst_maxi.h simulation model whose licence terms were never established, and LICENSE.HLS_Headers) and fpga/hls/parallel_stream.h (CPU stand-in adapted from Vitis hls_stream.h). The dead JFJOCH_HLS_NOSYNTH branches in hls_jfjoch.h, jf_conversion.cpp, spot_finder.cpp and host_writer.cpp go with them, so the reference sources show the synthesised path only. Licences: the three Xilinx HLS rows leave THIRD_PARTY_NOTICES.md, licenses/xilinx-hls-headers.txt and its COLLECT.sh line go. viewer/resources/third_party_licenses.html is regenerated; it was stale, so the regeneration also adds six texts already in licenses/ (durin, GPL-2.0, hpcn-uam, rapidjson, slsDetectorPackage-md5-Apache-2.0, stb_sprintf). docs/THIRD_PARTY_NOTICES.md is left to update_version.sh. No host code (receiver, host_library, acquisition_device, common, tools, tests) uses ap_*/hls types; tools/UDPSimulator.cpp keeps fpga/hls_simulation/sls_packet.h, which is plain C++. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HVeDQrPqZ52Tp6rzzZGxf3
This commit is contained in:
1 parent
dd0b5687ff
commit
c18655871b
26 files changed
+713
-15648
No files matched your search
@@ -403,10 +403,10 @@ with cuFFT on a GPU and with pocketfft without one (or under `--no-gpu`), while
|
||||
implementation each. Only rugnux's CLI spells it this way: internally (and in the broker's OpenAPI)
|
||||
`FFT` is the GPU implementation, which the CLI's `cufft` maps onto.
|
||||
|
||||
**FPGA** (`fpga/`): `hls/` is the Vitis HLS source (image-analysis kernels; its CPU library
|
||||
`JFJochHLSCores` and the Xilinx headers in `fpga/include/` are no longer part of the software
|
||||
build), `hdl/` is the Verilog RTL, `host_library/` is the host-side driver, `pcie_driver/` is the
|
||||
kernel module. The HLS algorithms are documented in `docs/FPGA_DATA_ANALYSIS.md`. The software is
|
||||
**FPGA** (`fpga/`): `hls/` is the Vitis HLS source (image-analysis kernels), kept as reference: the
|
||||
software build does not compile it and the tree carries no Xilinx headers (`ap_int.h` etc.) - only
|
||||
`vitis_hls`, with its own headers, synthesises it for the firmware targets. `hdl/` is the Verilog RTL, `host_library/` is the
|
||||
host-side driver, `pcie_driver/` is the kernel module. The HLS algorithms are documented in `docs/FPGA_DATA_ANALYSIS.md`. The software is
|
||||
tested without hardware on `MockAcquisitionDevice`, not on a simulation of the firmware.
|
||||
|
||||
**Detector control** (`detector_control/`): wrappers for SLS (JUNGFRAU) and DECTRIS SIMPLON
|
||||
|
||||
@@ -49,7 +49,7 @@ either way. Eigen is header-only: only its headers reach the binaries, and no Ei
|
||||
|
||||
## Vendored directly in the repository
|
||||
|
||||
These live in the source tree (see the path) rather than being fetched; traccc, the GEMMI-, Ceres- and fast-feedback-indexer-derived files and the Xilinx-derived HLS stream are the exceptions - code adapted into first-party files rather than a vendored directory, see the notes at the end of this file.
|
||||
These live in the source tree (see the path) rather than being fetched; traccc and the GEMMI-, Ceres- and fast-feedback-indexer-derived files are the exceptions - code adapted into first-party files rather than a vendored directory, see the notes at the end of this file.
|
||||
|
||||
| Component | Path | Copyright | License (SPDX) | License text |
|
||||
|---|---|---|---|---|
|
||||
@@ -60,9 +60,6 @@ These live in the source tree (see the path) rather than being fetched; traccc,
|
||||
| [Bitshuffle (h-perf)](https://github.com/kalcutter/bitshuffle) | `compression/bitshuffle_hperf/` | Kal Conley | Apache-2.0 | [bitshuffle-hperf.txt](licenses/bitshuffle-hperf.txt) |
|
||||
| [LZ4](https://github.com/lz4/lz4) (1.9.4) | `compression/lz4/` | Yann Collet | BSD-2-Clause | [lz4.txt](licenses/lz4.txt) |
|
||||
| [stb_image_write](https://github.com/nothings/stb) (v1.16, commit 31c1ad3) | `preview/stb/` | Sean Barrett | MIT OR Unlicense | [stb_image_write.txt](licenses/stb_image_write.txt) |
|
||||
| [HLS arbitrary-precision types](https://github.com/Xilinx/HLS_arbitrary_Precision_Types) | `fpga/include/` | Xilinx, Inc. | Apache-2.0 | [xilinx-hls-headers.txt](licenses/xilinx-hls-headers.txt) |
|
||||
| Vitis HLS `hls_stream.h` (2023.1, adapted) | `fpga/hls/parallel_stream.h` | Xilinx, Inc. | Apache-2.0 | [xilinx-hls-headers.txt](licenses/xilinx-hls-headers.txt) |
|
||||
| Vivado HLS `hls_burst_maxi.h` (simulation model of burst transfers on M-AXI, modified; to be removed when the FPGA part is frozen) | `fpga/include/hls_burst_maxi.h` | Xilinx, Inc. | not stated in the file; upstream terms not established | — |
|
||||
| ICMP responder and IP header checksum (HPCN Group, UAM) | `fpga/hls/icmp.cpp`, `fpga/hls/ip_header_checksum.h` | HPCN Group, UAM Spain; modifications PSI | BSD-3-Clause | [hpcn-uam.txt](licenses/hpcn-uam.txt) |
|
||||
| [fast-feedback-indexer](https://github.com/paulscherrerinstitute/fast-feedback-indexer) (commit a94fd4f) | `image_analysis/indexing/fast-feedback-indexer/` | PSI | BSD-3-Clause | [fast-feedback-indexer.txt](licenses/fast-feedback-indexer.txt) |
|
||||
| [GEMMI](https://github.com/project-gemmi/gemmi) (0.7.5, trimmed) | `gemmi_gph/` | Global Phasing Ltd. | MPL-2.0 | [gemmi.txt](licenses/gemmi.txt) |
|
||||
|
||||
+3
-2
@@ -15,8 +15,9 @@ ELSE()
|
||||
MESSAGE(STATUS "Xilinx HLS compiler not found")
|
||||
ENDIF()
|
||||
|
||||
# The CPU library of the HLS kernels is not part of the software build; the firmware targets below build it on demand
|
||||
ADD_SUBDIRECTORY(hls EXCLUDE_FROM_ALL)
|
||||
# The HLS kernels are not compiled by the software build; only vitis_hls synthesises them, with its own
|
||||
# headers, for the firmware targets below
|
||||
ADD_SUBDIRECTORY(hls)
|
||||
ADD_SUBDIRECTORY(pcie_driver)
|
||||
ADD_SUBDIRECTORY(host_library)
|
||||
|
||||
|
||||
@@ -1,49 +1,6 @@
|
||||
# SPDX-FileCopyrightText: 2023 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
||||
# SPDX-License-Identifier: CERN-OHL-S-2.0
|
||||
|
||||
ADD_LIBRARY( JFJochHLSCores STATIC
|
||||
jf_conversion.cpp
|
||||
data_collection_fsm.cpp
|
||||
timer.cpp
|
||||
hls_jfjoch.h
|
||||
../pcie_driver/jfjoch_fpga.h
|
||||
load_calibration.cpp
|
||||
host_writer.cpp
|
||||
ethernet.cpp
|
||||
ipv4.cpp
|
||||
icmp.cpp
|
||||
arp.cpp
|
||||
ip_header_checksum.h
|
||||
udp.cpp
|
||||
sls_detector.cpp
|
||||
frame_generator.cpp
|
||||
save_to_hbm.cpp
|
||||
load_from_hbm.cpp
|
||||
integration.cpp
|
||||
mask_missing.cpp
|
||||
spot_finder.cpp
|
||||
axis_broadcast.cpp
|
||||
adu_histo.cpp
|
||||
axis_helpers.cpp
|
||||
frame_summation.cpp
|
||||
frame_summation_reorder_compl.cpp
|
||||
stream512to768.cpp
|
||||
stream768to512.cpp
|
||||
spot_finder_merge.cpp
|
||||
spot_finder_connectivity.cpp
|
||||
spot_finder_mask.cpp
|
||||
save_to_hbm_data.cpp
|
||||
eiger_reorder.cpp
|
||||
roi_calc.cpp
|
||||
pixel_sqrt.cpp
|
||||
pixel_threshold.cpp
|
||||
pixel_mask.cpp
|
||||
pixel_calc.cpp
|
||||
ptp.cpp)
|
||||
|
||||
TARGET_COMPILE_DEFINITIONS(JFJochHLSCores PUBLIC -DJFJOCH_HLS_NOSYNTH)
|
||||
TARGET_INCLUDE_DIRECTORIES(JFJochHLSCores SYSTEM PUBLIC ../include)
|
||||
|
||||
IF(VIVADO_HLS)
|
||||
IF(NOT HLS_SOLUTION_NAME)
|
||||
SET(HLS_SOLUTION_NAME base1)
|
||||
|
||||
@@ -15,21 +15,9 @@
|
||||
#define ap_wait()
|
||||
#endif
|
||||
|
||||
#ifndef JFJOCH_HLS_NOSYNTH
|
||||
#include <ap_axi_sdata.h>
|
||||
#include <hls_stream.h>
|
||||
#include <hls_math.h>
|
||||
#else
|
||||
|
||||
#include "parallel_stream.h"
|
||||
|
||||
#include <cmath>
|
||||
namespace hls {
|
||||
inline bool isfinite(float f) {return std::isfinite(f);}
|
||||
// inline float sqrt(float f) {return std::sqrt(f); }
|
||||
template <class T> float sqrt(const T &f) {return std::round(std::sqrt(f.to_float())); }
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "../pcie_driver/jfjoch_fpga.h"
|
||||
|
||||
@@ -43,19 +31,6 @@ typedef ap_ufixed<32,12,AP_RND_CONV> one_over_energy_t;
|
||||
|
||||
typedef ap_uint<256> hbm256_t;
|
||||
|
||||
#ifdef JFJOCH_HLS_NOSYNTH
|
||||
template<int D,int U,int TI,int TD>
|
||||
struct ap_axiu{
|
||||
ap_uint<D> data;
|
||||
ap_uint<(D+7)/8> keep;
|
||||
ap_uint<(D+7)/8> strb;
|
||||
ap_uint<U> user;
|
||||
ap_uint<1> last;
|
||||
ap_uint<TI> id;
|
||||
ap_uint<TD> dest;
|
||||
};
|
||||
#endif
|
||||
|
||||
typedef ap_axiu<512, 1, 1, 1> packet_512_t;
|
||||
typedef ap_axiu<768, 1, 1, 1> packet_768_t;
|
||||
// For internal AXI-STREAM - Jungfraujoch uses 32 x 24-bit stream, with signed integers
|
||||
|
||||
@@ -257,17 +257,12 @@ void host_writer(STREAM_512 &data_in,
|
||||
|
||||
data_in >> packet;
|
||||
|
||||
#ifdef JFJOCH_HLS_NOSYNTH
|
||||
while (!host_memory_out.empty())
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
#else
|
||||
{
|
||||
// wait for 5 ms (ensure that PCIe buffer is clean)
|
||||
#pragma HLS PROTOCOL
|
||||
for (int i = 0; i < 5 * 200 * 1000; i++)
|
||||
ap_wait();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (req_handle_send != HANDLE_START)
|
||||
write_completion(m_axis_completion, req_handle_send, data_collection_id);
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
||||
// SPDX-License-Identifier: CERN-OHL-S-2.0
|
||||
|
||||
#ifndef JFJOCH_HLS_NOSYNTH
|
||||
#include <hls_math.h>
|
||||
#else
|
||||
namespace hls {
|
||||
inline float recip(float f) {return 1.0f/f;}
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "hls_jfjoch.h"
|
||||
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
||||
// SPDX-License-Identifier: CERN-OHL-S-2.0 AND Apache-2.0
|
||||
|
||||
// Based on hls_stream.h from Xilinx VITIS HLS 2023.1
|
||||
|
||||
// (c) Copyright 2011-2022 Xilinx, Inc.
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
#ifndef JUNGFRAUJOCH_PARALLEL_STREAM_H
|
||||
#define JUNGFRAUJOCH_PARALLEL_STREAM_H
|
||||
|
||||
#include <cstddef>
|
||||
#include <queue>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include <chrono>
|
||||
|
||||
namespace hls {
|
||||
template<class T, int DEPTH=0> class stream;
|
||||
|
||||
template<class T> class stream<T, 0> {
|
||||
private:
|
||||
mutable std::mutex m;
|
||||
std::condition_variable c_empty;
|
||||
std::condition_variable c_full;
|
||||
std::queue<T> data;
|
||||
constexpr const static std::chrono::seconds timeout = std::chrono::minutes(30);
|
||||
size_t max_elements;
|
||||
const std::string name;
|
||||
|
||||
void internal_read(T& head) {
|
||||
head = data.front();
|
||||
data.pop();
|
||||
c_full.notify_one();
|
||||
}
|
||||
void internal_write(const T& tail) {
|
||||
data.push(tail);
|
||||
c_empty.notify_one();
|
||||
}
|
||||
public:
|
||||
explicit stream(const char* in_name = "", size_t nelem = UINT64_MAX)
|
||||
: name(in_name), max_elements(nelem), data(){};
|
||||
|
||||
void write(const T& tail) {
|
||||
std::unique_lock ul(m);
|
||||
while (data.size() >= max_elements) {
|
||||
auto start_time = std::chrono::system_clock::now();
|
||||
if (c_full.wait_for(ul, timeout) == std::cv_status::timeout) {
|
||||
auto now_time = std::chrono::system_clock::now();
|
||||
std::chrono::duration<double> elapsed_seconds = now_time - start_time;
|
||||
throw std::runtime_error(name + ": likely deadlock to write to FIFO, timeout: " + std::to_string(elapsed_seconds.count()));
|
||||
}
|
||||
}
|
||||
internal_write(tail);
|
||||
}
|
||||
|
||||
bool write_nb(const T& tail) {
|
||||
std::unique_lock ul(m);
|
||||
if (data.size() >= max_elements) return false;
|
||||
internal_write(tail);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool read_nb(T& head) {
|
||||
std::unique_lock ul(m);
|
||||
if (data.empty()) return false;
|
||||
internal_read(head);
|
||||
return true;
|
||||
}
|
||||
|
||||
void read(T& head) {
|
||||
std::unique_lock ul(m);
|
||||
while (data.empty()) {
|
||||
auto start_time = std::chrono::system_clock::now();
|
||||
if (c_empty.wait_for(ul, timeout) == std::cv_status::timeout) {
|
||||
|
||||
auto now_time = std::chrono::system_clock::now();
|
||||
std::chrono::duration<double> elapsed_seconds = now_time - start_time;
|
||||
throw std::runtime_error(name + ": likely deadlock to read from FIFO, timeout: " + std::to_string(elapsed_seconds.count()));
|
||||
}
|
||||
}
|
||||
internal_read(head);
|
||||
}
|
||||
|
||||
bool full() const {
|
||||
std::unique_lock ul(m);
|
||||
return (data.size() >= max_elements);
|
||||
}
|
||||
|
||||
bool empty() const {
|
||||
std::unique_lock ul(m);
|
||||
return data.empty();
|
||||
};
|
||||
|
||||
size_t size() const { return data.size(); };
|
||||
void operator >> (T& rval) { read(rval); }
|
||||
void operator << (const T& rval) { write(rval); }
|
||||
T read() { T ret; read(ret); return ret; }
|
||||
};
|
||||
|
||||
template<class T, int DEPTH> class stream : public stream<T> {
|
||||
public:
|
||||
explicit stream(const char* name) : stream<T>(name, DEPTH) {}
|
||||
stream() : stream<T>("", DEPTH) {}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //JUNGFRAUJOCH_PARALLEL_STREAM_H
|
||||
@@ -3,10 +3,6 @@
|
||||
|
||||
#include "hls_jfjoch.h"
|
||||
|
||||
#ifdef JFJOCH_HLS_NOSYNTH
|
||||
#include <thread>
|
||||
#endif
|
||||
|
||||
void spot_finder_in_stream(STREAM_768 &data_in,
|
||||
hls::stream<spot_finder_packet> &data_out,
|
||||
volatile ap_int<32> &in_count_threshold,
|
||||
@@ -353,20 +349,8 @@ void spot_finder(STREAM_768 &data_in,
|
||||
hls::stream<ap_int<SUM2_BITWIDTH>, 32> sum2_0;
|
||||
hls::stream<ap_int<VALID_BITWIDTH>, 32> valid_0;
|
||||
|
||||
#ifndef JFJOCH_HLS_NOSYNTH
|
||||
spot_finder_in_stream(data_in, data_0, in_count_threshold, in_snr_threshold);
|
||||
spot_finder_prepare(data_0, data_1, sum_0, sum2_0, valid_0);
|
||||
spot_finder_apply_threshold(data_1, data_2, sum_0, sum2_0, valid_0);
|
||||
spot_finder_out_stream(data_2, data_out, strong_pixel_out);
|
||||
#else
|
||||
std::vector<std::thread> spot_finder_cores;
|
||||
spot_finder_cores.emplace_back([&] {spot_finder_in_stream(data_in, data_0, in_count_threshold,
|
||||
in_snr_threshold);});
|
||||
spot_finder_cores.emplace_back([&] {spot_finder_prepare(data_0, data_1, sum_0, sum2_0, valid_0);});
|
||||
spot_finder_cores.emplace_back([&] {spot_finder_apply_threshold(data_1, data_2, sum_0, sum2_0, valid_0);});
|
||||
spot_finder_cores.emplace_back([&] {spot_finder_out_stream(data_2, data_out, strong_pixel_out);});
|
||||
|
||||
for (auto &i : spot_finder_cores)
|
||||
i.join();
|
||||
#endif
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
Source of the headers:
|
||||
https://github.com/Xilinx/HLS_arbitrary_Precision_Types
|
||||
xilinx_hls_lib_2022_1.tgz (in Vitis HLS 2022.1)
|
||||
|
||||
Copyright 2011-2019 Xilinx, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
@@ -1,376 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011-2019 Xilinx, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __AP_COMMON_H__
|
||||
#define __AP_COMMON_H__
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// Forward declaration of all AP types.
|
||||
#include <ap_decl.h>
|
||||
|
||||
|
||||
#ifdef __SYNTHESIS__
|
||||
#error "The open-source version of AP types does not support synthesis."
|
||||
#endif // ifdef __SYNTHESIS__
|
||||
#define _AP_ENABLE_HALF_ 0
|
||||
|
||||
|
||||
#if _AP_ENABLE_HALF_ == 1
|
||||
// Before ap_private definition.
|
||||
#ifdef __SYNTHESIS__
|
||||
#define _HLS_HALF_DEFINED_
|
||||
typedef __fp16 half;
|
||||
#else
|
||||
class half;
|
||||
#endif // __SYNTHESIS__
|
||||
#endif // _AP_ENABLE_HALF_
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// Macro functions
|
||||
#define AP_MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define AP_MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#define AP_ABS(a) ((a) >= 0 ? (a) : -(a))
|
||||
|
||||
#ifndef AP_ASSERT
|
||||
#ifndef __SYNTHESIS__
|
||||
#include <assert.h>
|
||||
#define AP_ASSERT(cond, msg) assert((cond) && (msg))
|
||||
#else
|
||||
#define AP_ASSERT(cond, msg)
|
||||
#endif // ifndef __SYNTHESIS__
|
||||
#endif // ifndef AP_ASSERT
|
||||
|
||||
#ifndef __SYNTHESIS__
|
||||
// for fprintf messages.
|
||||
#include <stdio.h>
|
||||
// for exit on error.
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
// same disable condition as assert.
|
||||
#if !defined(__SYNTHESIS__) && !defined(NDEBUG)
|
||||
|
||||
#define _AP_DEBUG(cond, ...) \
|
||||
do { \
|
||||
if ((cond)) { \
|
||||
fprintf(stderr, "DEBUG: " __VA_ARGS__); \
|
||||
fprintf(stderr, "\n"); \
|
||||
} \
|
||||
} while (0)
|
||||
#define _AP_WARNING(cond, ...) \
|
||||
do { \
|
||||
if ((cond)) { \
|
||||
fprintf(stderr, "WARNING: " __VA_ARGS__); \
|
||||
fprintf(stderr, "\n"); \
|
||||
} \
|
||||
} while (0)
|
||||
#define _AP_ERROR(cond, ...) \
|
||||
do { \
|
||||
if ((cond)) { \
|
||||
fprintf(stderr, "ERROR: " __VA_ARGS__); \
|
||||
fprintf(stderr, "\n"); \
|
||||
abort(); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#else // if !defined(__SYNTHESIS__) && !defined(NDEBUG)
|
||||
|
||||
#define __AP_VOID_CAST static_cast<void>
|
||||
#define _AP_DEBUG(cond, ...) (__AP_VOID_CAST(0))
|
||||
#define _AP_WARNING(cond, ...) (__AP_VOID_CAST(0))
|
||||
#define _AP_ERROR(cond, ...) (__AP_VOID_CAST(0))
|
||||
|
||||
#endif // if !defined(__SYNTHESIS__) && !defined(NDEBUG) else
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// Attribute only for synthesis
|
||||
#ifdef __SYNTHESIS__
|
||||
#define INLINE inline __attribute__((always_inline))
|
||||
//#define INLINE inline __attribute__((noinline))
|
||||
#else
|
||||
#define INLINE inline
|
||||
#endif
|
||||
|
||||
#define AP_WEAK
|
||||
// __attribute__((weak))
|
||||
|
||||
#ifndef AP_INT_MAX_W
|
||||
#define AP_INT_MAX_W 1024
|
||||
#endif
|
||||
|
||||
#define BIT_WIDTH_UPPER_LIMIT (1 << 15)
|
||||
#if AP_INT_MAX_W > BIT_WIDTH_UPPER_LIMIT
|
||||
#error "Bitwidth exceeds 32768 (1 << 15), the maximum allowed value"
|
||||
#endif
|
||||
|
||||
#define MAX_MODE(BITS) ((BITS + 1023) / 1024)
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// XXX apcc cannot handle global std::ios_base::Init() brought in by <iostream>
|
||||
#ifndef AP_AUTOCC
|
||||
#ifndef __SYNTHESIS__
|
||||
// for overload operator<<
|
||||
#include <iostream>
|
||||
#endif
|
||||
#endif // ifndef AP_AUTOCC
|
||||
|
||||
#ifndef __SYNTHESIS__
|
||||
// for string format.
|
||||
#include <sstream>
|
||||
// for string.
|
||||
#include <string>
|
||||
#endif
|
||||
|
||||
// for detecting if char is signed.
|
||||
enum { CHAR_IS_SIGNED = (char)-1 < 0 };
|
||||
|
||||
// TODO we have similar traits in x_hls_utils.h, should consider unify.
|
||||
namespace _ap_type {
|
||||
template <typename _Tp>
|
||||
struct is_signed {
|
||||
static const bool value = _Tp(-1) < _Tp(1);
|
||||
};
|
||||
|
||||
template <typename _Tp>
|
||||
struct is_integral {
|
||||
static const bool value = false;
|
||||
};
|
||||
#define DEF_IS_INTEGRAL(CTYPE) \
|
||||
template <> \
|
||||
struct is_integral<CTYPE> { \
|
||||
static const bool value = true; \
|
||||
};
|
||||
DEF_IS_INTEGRAL(bool)
|
||||
DEF_IS_INTEGRAL(char)
|
||||
DEF_IS_INTEGRAL(signed char)
|
||||
DEF_IS_INTEGRAL(unsigned char)
|
||||
DEF_IS_INTEGRAL(short)
|
||||
DEF_IS_INTEGRAL(unsigned short)
|
||||
DEF_IS_INTEGRAL(int)
|
||||
DEF_IS_INTEGRAL(unsigned int)
|
||||
DEF_IS_INTEGRAL(long)
|
||||
DEF_IS_INTEGRAL(unsigned long)
|
||||
DEF_IS_INTEGRAL(ap_slong)
|
||||
DEF_IS_INTEGRAL(ap_ulong)
|
||||
#undef DEF_IS_INTEGRAL
|
||||
|
||||
template <bool, typename _Tp = void>
|
||||
struct enable_if {};
|
||||
// partial specialization for true
|
||||
template <typename _Tp>
|
||||
struct enable_if<true, _Tp> {
|
||||
typedef _Tp type;
|
||||
};
|
||||
|
||||
template <typename _Tp>
|
||||
struct remove_const {
|
||||
typedef _Tp type;
|
||||
};
|
||||
|
||||
template <typename _Tp>
|
||||
struct remove_const<_Tp const> {
|
||||
typedef _Tp type;
|
||||
};
|
||||
} // namespace _ap_type
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// Define ssdm_int and _ssdm_op.
|
||||
// XXX deleted in open-source version
|
||||
|
||||
#ifndef NON_C99STRING
|
||||
#define _AP_C99 true
|
||||
#else
|
||||
#define _AP_C99 false
|
||||
#endif
|
||||
|
||||
static inline unsigned char guess_radix(const char* s) {
|
||||
unsigned char rd = 10; ///< default radix
|
||||
const char* p = s;
|
||||
// skip neg sign if it exists
|
||||
if (p[0] == '-' || p[0] == '+') ++p;
|
||||
// guess based on following two bits.
|
||||
if (p[0] == '0') {
|
||||
if (p[1] == 'b' || p[1] == 'B') {
|
||||
rd = 2;
|
||||
} else if (p[1] == 'o' || p[1] == 'O') {
|
||||
rd = 8;
|
||||
} else if (p[1] == 'x' || p[1] == 'X') {
|
||||
rd = 16;
|
||||
} else if (p[1] == 'd' || p[1] == 'D') {
|
||||
rd = 10;
|
||||
}
|
||||
}
|
||||
return rd;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// Basic integral struct upon which ap_int and ap_fixed are defined.
|
||||
#ifdef __SYNTHESIS__
|
||||
// Use ssdm_int, a compiler dependent, attribute constrained integeral type as
|
||||
// basic data type.
|
||||
#define _AP_ROOT_TYPE ssdm_int
|
||||
// Basic ops.
|
||||
#define _AP_ROOT_op_concat(Ret, X, Y) _ssdm_op_concat(Ret, X, Y)
|
||||
#define _AP_ROOT_op_get_bit(Val, Bit) _ssdm_op_get_bit(Val, Bit)
|
||||
#define _AP_ROOT_op_set_bit(Val, Bit, Repl) _ssdm_op_set_bit(Val, Bit, Repl)
|
||||
#define _AP_ROOT_op_get_range(Val, Lo, Hi) _ssdm_op_get_range(Val, Lo, Hi)
|
||||
#define _AP_ROOT_op_set_range(Val, Lo, Hi, Repl) \
|
||||
_ssdm_op_set_range(Val, Lo, Hi, Repl)
|
||||
#define _AP_ROOT_op_reduce(Op, Val) _ssdm_op_reduce(Op, Val)
|
||||
#else // ifdef __SYNTHESIS__
|
||||
// Use ap_private for compiler-independent basic data type
|
||||
template <int _AP_W, bool _AP_S, bool _AP_C = _AP_W <= 64>
|
||||
class ap_private;
|
||||
/// model ssdm_int in standard C++ for simulation.
|
||||
template <int _AP_W, bool _AP_S>
|
||||
struct ssdm_int_sim {
|
||||
/// integral type with template-specified width and signedness.
|
||||
ap_private<_AP_W, _AP_S> V;
|
||||
ssdm_int_sim() {}
|
||||
};
|
||||
#define _AP_ROOT_TYPE ssdm_int_sim
|
||||
// private's ref uses _AP_ROOT_TYPE.
|
||||
#include <etc/ap_private.h>
|
||||
// XXX The C-sim model cannot use GCC-extension
|
||||
// Basic ops. Ret and Val are ap_private.
|
||||
template <typename _Tp1, typename _Tp2, typename _Tp3>
|
||||
inline _Tp1 _AP_ROOT_op_concat(const _Tp1& Ret, const _Tp2& X, const _Tp3& Y) {
|
||||
_Tp1 r = (X).operator,(Y);
|
||||
return r;
|
||||
}
|
||||
#define _AP_ROOT_op_get_bit(Val, Bit) (Val).get_bit((Bit))
|
||||
template <typename _Tp1, typename _Tp2, typename _Tp3>
|
||||
inline _Tp1& _AP_ROOT_op_set_bit(_Tp1& Val, const _Tp2& Bit, const _Tp3& Repl) {
|
||||
(Val).set_bit((Bit), (Repl));
|
||||
return Val;
|
||||
}
|
||||
// notice the order of high and low index is different in ssdm call and
|
||||
// ap_private.range()...
|
||||
#define _AP_ROOT_op_get_range(Val, Lo, Hi) (Val).range((Hi), (Lo))
|
||||
template <typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
|
||||
inline _Tp1& _AP_ROOT_op_set_range(_Tp1& Val, const _Tp2& Lo, const _Tp3& Hi,
|
||||
const _Tp4& Repl) {
|
||||
(Val).range((Hi), (Lo)) = Repl;
|
||||
return (Val);
|
||||
}
|
||||
#define _AP_ROOT_op_and_reduce(Val) (Val).and_reduce()
|
||||
#define _AP_ROOT_op_nand_reduce(Val) (Val).nand_reduce()
|
||||
#define _AP_ROOT_op_or_reduce(Val) (Val).or_reduce()
|
||||
#define _AP_ROOT_op_xor_reduce(Val) (Val).xor_reduce()
|
||||
// ## is the concatenation in preprocessor:
|
||||
#define _AP_ROOT_op_reduce(Op, Val) _AP_ROOT_op_##Op##_reduce(Val)
|
||||
#endif // ifdef __SYNTHESIS__ else
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// Constants for half, single, double pricision floating points
|
||||
#define HALF_MAN 10
|
||||
#define FLOAT_MAN 23
|
||||
#define DOUBLE_MAN 52
|
||||
|
||||
#define HALF_EXP 5
|
||||
#define FLOAT_EXP 8
|
||||
#define DOUBLE_EXP 11
|
||||
|
||||
#define BIAS(e) ((1L << (e - 1L)) - 1L)
|
||||
#define HALF_BIAS BIAS(HALF_EXP)
|
||||
#define FLOAT_BIAS BIAS(FLOAT_EXP)
|
||||
#define DOUBLE_BIAS BIAS(DOUBLE_EXP)
|
||||
|
||||
#define APFX_IEEE_DOUBLE_E_MAX DOUBLE_BIAS
|
||||
#define APFX_IEEE_DOUBLE_E_MIN (-DOUBLE_BIAS + 1)
|
||||
|
||||
INLINE ap_ulong doubleToRawBits(double pf) {
|
||||
union {
|
||||
ap_ulong __L;
|
||||
double __D;
|
||||
} LD;
|
||||
LD.__D = pf;
|
||||
return LD.__L;
|
||||
}
|
||||
|
||||
INLINE unsigned int floatToRawBits(float pf) {
|
||||
union {
|
||||
unsigned int __L;
|
||||
float __D;
|
||||
} LD;
|
||||
LD.__D = pf;
|
||||
return LD.__L;
|
||||
}
|
||||
|
||||
#if _AP_ENABLE_HALF_ == 1
|
||||
INLINE unsigned short halfToRawBits(half pf) {
|
||||
#ifdef __SYNTHESIS__
|
||||
union {
|
||||
unsigned short __L;
|
||||
half __D;
|
||||
} LD;
|
||||
LD.__D = pf;
|
||||
return LD.__L;
|
||||
#else
|
||||
return pf.get_bits();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
// usigned long long is at least 64-bit
|
||||
INLINE double rawBitsToDouble(ap_ulong pi) {
|
||||
union {
|
||||
ap_ulong __L;
|
||||
double __D;
|
||||
} LD;
|
||||
LD.__L = pi;
|
||||
return LD.__D;
|
||||
}
|
||||
|
||||
// long is at least 32-bit
|
||||
INLINE float rawBitsToFloat(unsigned long pi) {
|
||||
union {
|
||||
unsigned int __L;
|
||||
float __D;
|
||||
} LD;
|
||||
LD.__L = pi;
|
||||
return LD.__D;
|
||||
}
|
||||
|
||||
#if _AP_ENABLE_HALF_ == 1
|
||||
// short is at least 16-bit
|
||||
INLINE half rawBitsToHalf(unsigned short pi) {
|
||||
#ifdef __SYNTHESIS__
|
||||
union {
|
||||
unsigned short __L;
|
||||
half __D;
|
||||
} LD;
|
||||
LD.__L = pi;
|
||||
return LD.__D;
|
||||
#else
|
||||
// sim model of half has a non-trivial constructor
|
||||
half __D;
|
||||
__D.set_bits(pi);
|
||||
return __D;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // ifndef __AP_COMMON_H__
|
||||
|
||||
// -*- cpp -*-
|
||||
@@ -1,212 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011-2019 Xilinx, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __AP_DECL_H__
|
||||
#define __AP_DECL_H__
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#if !defined(__AP_FIXED_H__) && !defined(__AP_INT_H__) && !defined(__AUTOPILOT_CBE_H__) && !defined(__HLS_HALF_H__)
|
||||
#error "Only ap_fixed.h and ap_int.h can be included directly in user code."
|
||||
#endif
|
||||
|
||||
// Test __SYNTHESIS__ only for mode
|
||||
#if !defined(__SYNTHESIS__) && (defined(AESL_SYN) || defined(__HLS_SYN__))
|
||||
//#pragma message "AESL_SYN and __HLS_SYN__ should be replaced by __SYNTHESIS__"
|
||||
#define __SYNTHESIS__
|
||||
#endif
|
||||
|
||||
/* for safety*/
|
||||
#if (defined(_AP_N) || defined(_AP_C))
|
||||
#error One or more of the following is defined: _AP_N, _AP_C. Definition conflicts with their usage as template parameters.
|
||||
#endif
|
||||
|
||||
/* for safety*/
|
||||
#if (defined(_AP_W) || defined(_AP_I) || defined(_AP_S) || defined(_AP_Q) || \
|
||||
defined(_AP_O) || defined(_AP_W2) || defined(_AP_I2) || \
|
||||
defined(_AP_S2) || defined(_AP_Q2) || defined(_AP_O2) || \
|
||||
defined(_AP_N) || defined(_AP_N2))
|
||||
#error \
|
||||
"One or more of the following is defined: _AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N, _AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2. Definition conflicts with their usage as template parameters."
|
||||
#endif
|
||||
|
||||
/*for safety*/
|
||||
#if (defined(_AP_W3) || defined(_AP_S3) || defined(_AP_W4) || defined(_AP_S4))
|
||||
#error \
|
||||
"One or more of the following is defined: _AP_W3, _AP_S3, _AP_W4,_AP_S4. Definition conflicts with their usage as template parameters."
|
||||
#endif
|
||||
|
||||
#if (defined(_AP_W1) || defined(_AP_S1) || defined(_AP_T) || \
|
||||
defined(_AP_T1) || defined(_AP_T2) || defined(_AP_T3) || defined(_AP_T4))
|
||||
#error \
|
||||
"One or more of the following is defined: _AP_W1, _AP_S1, _AP_T, _AP_T1, _AP_T2, _AP_T3, _AP_T4. Definition conflicts with their usage as template parameters."
|
||||
#endif
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error "AP data type can only be used in C++"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#ifndef __SC_COMPATIBLE__
|
||||
/// ap_fixed quantification mode
|
||||
enum ap_q_mode {
|
||||
AP_RND, //< rounding to plus infinity
|
||||
AP_RND_ZERO, //< rounding to zero
|
||||
AP_RND_MIN_INF, //< rounding to minus infinity
|
||||
AP_RND_INF, //< rounding to infinity
|
||||
AP_RND_CONV, //< convergent rounding
|
||||
AP_TRN, //< truncation
|
||||
AP_TRN_ZERO, //< truncation to zero
|
||||
};
|
||||
|
||||
// FIXME for legacy code
|
||||
#ifndef SYSTEMC_INCLUDED
|
||||
#define SC_RND AP_RND
|
||||
#define SC_RND_ZERO AP_RND_ZERO
|
||||
#define SC_RND_MIN_INF AP_RND_MIN_INF
|
||||
#define SC_RND_INF AP_RND_INF
|
||||
#define SC_RND_CONV AP_RND_CONV
|
||||
#define SC_TRN AP_TRN
|
||||
#define SC_TRN_ZERO AP_TRN_ZERO
|
||||
#endif // !defined(SYSTEMC_INCLUDED)
|
||||
|
||||
/// ap_fixed saturation mode
|
||||
enum ap_o_mode {
|
||||
AP_SAT, //< saturation
|
||||
AP_SAT_ZERO, //< saturation to zero
|
||||
AP_SAT_SYM, //< symmetrical saturation
|
||||
AP_WRAP, //< wrap-around (*)
|
||||
AP_WRAP_SM, //< sign magnitude wrap-around (*)
|
||||
};
|
||||
|
||||
// FIXME for legacy code
|
||||
#ifndef SYSTEMC_INCLUDED
|
||||
#define SC_SAT AP_SAT
|
||||
#define SC_SAT_ZERO AP_SAT_ZERO
|
||||
#define SC_SAT_SYM AP_SAT_SYM
|
||||
#define SC_WRAP AP_WRAP
|
||||
#define SC_WRAP_SM AP_WRAP_SM
|
||||
#endif // !defined(SYSTEMC_INCLUDED)
|
||||
|
||||
#else // defined(__SC_COMPATIBLE__)
|
||||
|
||||
// There will not be sc_fxdefs.h, and the emu should be defined by ap_fixed.
|
||||
|
||||
/// ap_fixed quantification mode
|
||||
enum ap_q_mode {
|
||||
SC_RND, //< rounding to plus infinity
|
||||
SC_RND_ZERO, //< rounding to zero
|
||||
SC_RND_MIN_INF, //< rounding to minus infinity
|
||||
SC_RND_INF, //< rounding to infinity
|
||||
SC_RND_CONV, //< convergent rounding
|
||||
SC_TRN, //< truncation
|
||||
SC_TRN_ZERO, //< truncation to zero
|
||||
};
|
||||
|
||||
#define AP_RND SC_RND
|
||||
#define AP_RND_ZERO SC_RND_ZERO
|
||||
#define AP_RND_MIN_INF SC_RND_MIN_INF
|
||||
#define AP_RND_INF SC_RND_INF
|
||||
#define AP_RND_CONV SC_RND_CONV
|
||||
#define AP_TRN SC_TRN
|
||||
#define AP_TRN_ZERO SC_TRN_ZERO
|
||||
|
||||
/// ap_fixed saturation mode
|
||||
enum ap_o_mode {
|
||||
SC_SAT, //< saturation
|
||||
SC_SAT_ZERO, //< saturation to zero
|
||||
SC_SAT_SYM, //< symmetrical saturation
|
||||
SC_WRAP, //< wrap-around (*)
|
||||
SC_WRAP_SM, //< sign magnitude wrap-around (*)
|
||||
};
|
||||
|
||||
#define AP_SAT SC_SAT
|
||||
#define AP_SAT_ZERO SC_SAT_ZERO
|
||||
#define AP_SAT_SYM SC_SAT_SYM
|
||||
#define AP_WRAP SC_WRAP
|
||||
#define AP_WRAP_SM SC_WRAP_SM
|
||||
|
||||
#endif // defined(__SC_COMPATIBLE__)
|
||||
|
||||
template <int _AP_W, bool _AP_S>
|
||||
struct ap_int_base;
|
||||
|
||||
template <int _AP_W>
|
||||
struct ap_int;
|
||||
|
||||
template <int _AP_W>
|
||||
struct ap_uint;
|
||||
|
||||
template <int _AP_W, bool _AP_S>
|
||||
struct ap_range_ref;
|
||||
|
||||
template <int _AP_W, bool _AP_S>
|
||||
struct ap_bit_ref;
|
||||
|
||||
template <int _AP_W1, typename _AP_T1, int _AP_W2, typename _AP_T2>
|
||||
struct ap_concat_ref;
|
||||
|
||||
template <int _AP_W, int _AP_I, bool _AP_S = true, ap_q_mode _AP_Q = AP_TRN,
|
||||
ap_o_mode _AP_O = AP_WRAP, int _AP_N = 0>
|
||||
struct ap_fixed_base;
|
||||
|
||||
template <int _AP_W, int _AP_I, ap_q_mode _AP_Q = AP_TRN,
|
||||
ap_o_mode _AP_O = AP_WRAP, int _AP_N = 0>
|
||||
struct ap_fixed;
|
||||
|
||||
template <int _AP_W, int _AP_I, ap_q_mode _AP_Q = AP_TRN,
|
||||
ap_o_mode _AP_O = AP_WRAP, int _AP_N = 0>
|
||||
struct ap_ufixed;
|
||||
|
||||
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
||||
int _AP_N>
|
||||
struct af_range_ref;
|
||||
|
||||
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
||||
int _AP_N>
|
||||
struct af_bit_ref;
|
||||
|
||||
/// string base mode
|
||||
enum BaseMode { AP_BIN = 2, AP_OCT = 8, AP_DEC = 10, AP_HEX = 16 };
|
||||
|
||||
#ifndef SYSTEMC_INCLUDED
|
||||
#define SC_BIN 2
|
||||
#define SC_OCT 8
|
||||
#define SC_DEC 10
|
||||
#define SC_HEX 16
|
||||
#endif // !defined(SYSTEMC_INCLUDED)
|
||||
|
||||
// Alias C data types
|
||||
#ifdef _MSC_VER
|
||||
typedef signed __int64 ap_slong;
|
||||
typedef unsigned __int64 ap_ulong;
|
||||
#else // !defined(_MSC_VER)
|
||||
typedef signed long long ap_slong;
|
||||
typedef unsigned long long ap_ulong;
|
||||
#endif // !defined(_MSC_VER)
|
||||
|
||||
enum {
|
||||
_AP_SIZE_char = 8,
|
||||
_AP_SIZE_short = sizeof(short) * 8,
|
||||
_AP_SIZE_int = sizeof(int) * 8,
|
||||
_AP_SIZE_long = sizeof(long) * 8,
|
||||
_AP_SIZE_ap_slong = sizeof(ap_slong) * 8
|
||||
};
|
||||
|
||||
#endif // !defined(__AP_DECL_H__)
|
||||
|
||||
// -*- cpp -*-
|
||||
@@ -1,360 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011-2019 Xilinx, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __AP_FIXED_H__
|
||||
#define __AP_FIXED_H__
|
||||
|
||||
#include <ap_common.h>
|
||||
#include <ap_fixed_base.h>
|
||||
#include <ap_fixed_ref.h>
|
||||
|
||||
//---------------------------------------------------------------
|
||||
|
||||
/// Signed Arbitrary Precision Fixed-Point Type.
|
||||
// default for _AP_Q, _AP_O and _AP_N set in ap_decl.h
|
||||
template <int _AP_W, int _AP_I, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
||||
struct ap_fixed : ap_fixed_base<_AP_W, _AP_I, true, _AP_Q, _AP_O, _AP_N> {
|
||||
typedef ap_fixed_base<_AP_W, _AP_I, true, _AP_Q, _AP_O, _AP_N> Base;
|
||||
// Constructor
|
||||
/// default ctor
|
||||
INLINE ap_fixed() : Base() {}
|
||||
|
||||
/// default copy ctor
|
||||
INLINE ap_fixed(const ap_fixed& op) { Base::V = op.V; }
|
||||
|
||||
/// copy ctor from ap_fixed_base.
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE ap_fixed(const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2,
|
||||
_AP_O2, _AP_N2>& op)
|
||||
: Base(op) {}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE ap_fixed(const volatile ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2,
|
||||
_AP_O2, _AP_N2>& op)
|
||||
: Base(op) {}
|
||||
|
||||
//// from ap_fixed
|
||||
//template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
||||
// int _AP_N2>
|
||||
//INLINE ap_fixed(
|
||||
// const ap_fixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
// : Base(ap_fixed_base<_AP_W2, _AP_I2, true, _AP_Q2, _AP_O2, _AP_N2>(op)) {}
|
||||
|
||||
//template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
||||
// int _AP_N2>
|
||||
//INLINE ap_fixed(
|
||||
// const volatile ap_fixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
// : Base(ap_fixed_base<_AP_W2, _AP_I2, true, _AP_Q2, _AP_O2, _AP_N2>(op)) {}
|
||||
|
||||
//// from ap_ufixed.
|
||||
//template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
||||
// int _AP_N2>
|
||||
//INLINE ap_fixed(
|
||||
// const ap_ufixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
// : Base(ap_fixed_base<_AP_W2, _AP_I2, false, _AP_Q2, _AP_O2, _AP_N2>(op)) {
|
||||
//}
|
||||
|
||||
//template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
||||
// int _AP_N2>
|
||||
//INLINE ap_fixed(
|
||||
// const volatile ap_ufixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
// : Base(ap_fixed_base<_AP_W2, _AP_I2, false, _AP_Q2, _AP_O2, _AP_N2>(op)) {
|
||||
//}
|
||||
|
||||
/// copy ctor from ap_int_base.
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE ap_fixed(const ap_int_base<_AP_W2, _AP_S2>& op) : Base(op) {}
|
||||
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE ap_fixed(const volatile ap_int_base<_AP_W2, _AP_S2>& op) : Base(op) {}
|
||||
|
||||
//// from ap_int.
|
||||
//template <int _AP_W2>
|
||||
//INLINE ap_fixed(const ap_int<_AP_W2>& op)
|
||||
// : Base(ap_int_base<_AP_W2, true>(op)) {}
|
||||
|
||||
//template <int _AP_W2>
|
||||
//INLINE ap_fixed(const volatile ap_int<_AP_W2>& op)
|
||||
// : Base(ap_int_base<_AP_W2, true>(op)) {}
|
||||
|
||||
//// from ap_uint.
|
||||
//template <int _AP_W2>
|
||||
//INLINE ap_fixed(const ap_uint<_AP_W2>& op)
|
||||
// : Base(ap_int_base<_AP_W2, false>(op)) {}
|
||||
|
||||
//template <int _AP_W2>
|
||||
//INLINE ap_fixed(const volatile ap_uint<_AP_W2>& op)
|
||||
// : Base(ap_int_base<_AP_W2, false>(op)) {}
|
||||
|
||||
// from ap_bit_ref.
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE ap_fixed(const ap_bit_ref<_AP_W2, _AP_S2>& op) : Base(op) {}
|
||||
|
||||
// from ap_range_ref.
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE ap_fixed(const ap_range_ref<_AP_W2, _AP_S2>& op) : Base(op) {}
|
||||
|
||||
// from ap_concat_ref.
|
||||
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
||||
INLINE ap_fixed(const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3>& op)
|
||||
: Base(op) {}
|
||||
|
||||
// from af_bit_ref.
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE ap_fixed(
|
||||
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
: Base(op) {}
|
||||
|
||||
// from af_range_ref.
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE ap_fixed(
|
||||
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
: Base(op) {}
|
||||
|
||||
// from c types.
|
||||
#define CTOR(TYPE) \
|
||||
INLINE ap_fixed(TYPE v) : Base(v) {}
|
||||
|
||||
CTOR(bool)
|
||||
CTOR(char)
|
||||
CTOR(signed char)
|
||||
CTOR(unsigned char)
|
||||
CTOR(short)
|
||||
CTOR(unsigned short)
|
||||
CTOR(int)
|
||||
CTOR(unsigned int)
|
||||
CTOR(long)
|
||||
CTOR(unsigned long)
|
||||
CTOR(ap_slong)
|
||||
CTOR(ap_ulong)
|
||||
#if _AP_ENABLE_HALF_ == 1
|
||||
CTOR(half)
|
||||
#endif
|
||||
CTOR(float)
|
||||
CTOR(double)
|
||||
#undef CTOR
|
||||
|
||||
INLINE ap_fixed(const char* s) : Base(s) {}
|
||||
|
||||
INLINE ap_fixed(const char* s, signed char rd) : Base(s, rd) {}
|
||||
|
||||
// Assignment
|
||||
// The assignment operator is technically inherited; however, it is always
|
||||
// hidden by an explicitly or implicitly defined assignment operator for the
|
||||
// derived class.
|
||||
/* XXX ctor will be used when right is not of proper type. */
|
||||
INLINE ap_fixed& operator=(
|
||||
const ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N>& op) {
|
||||
Base::V = op.V;
|
||||
return *this;
|
||||
}
|
||||
|
||||
INLINE void operator=(
|
||||
const ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N>& op) volatile {
|
||||
Base::V = op.V;
|
||||
}
|
||||
|
||||
INLINE ap_fixed& operator=(
|
||||
const volatile ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N>& op) {
|
||||
Base::V = op.V;
|
||||
return *this;
|
||||
}
|
||||
|
||||
INLINE void operator=(
|
||||
const volatile ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N>& op) volatile {
|
||||
Base::V = op.V;
|
||||
}
|
||||
}; // struct ap_fixed.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
// Unsigned Arbitrary Precision Fixed-Point Type.
|
||||
// default for _AP_Q, _AP_O and _AP_N set in ap_decl.h
|
||||
template <int _AP_W, int _AP_I, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
||||
struct ap_ufixed : ap_fixed_base<_AP_W, _AP_I, false, _AP_Q, _AP_O, _AP_N> {
|
||||
typedef ap_fixed_base<_AP_W, _AP_I, false, _AP_Q, _AP_O, _AP_N> Base;
|
||||
// Constructor
|
||||
/// default ctor
|
||||
INLINE ap_ufixed() : Base() {}
|
||||
|
||||
/// default copy ctor
|
||||
INLINE ap_ufixed(const ap_ufixed& op) { Base::V = op.V; }
|
||||
|
||||
/// copy ctor from ap_fixed_base
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE ap_ufixed(const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2,
|
||||
_AP_O2, _AP_N2>& op)
|
||||
: Base(op) {}
|
||||
|
||||
/// copy ctor from ap_fixed_base
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE ap_ufixed(const volatile ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2,
|
||||
_AP_O2, _AP_N2>& op)
|
||||
: Base(op) {}
|
||||
|
||||
//template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
||||
// int _AP_N2>
|
||||
//INLINE ap_ufixed(
|
||||
// const ap_fixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
// : Base(ap_fixed_base<_AP_W2, _AP_I2, true, _AP_Q2, _AP_O2, _AP_N2>(op)) {}
|
||||
|
||||
//template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
||||
// int _AP_N2>
|
||||
//INLINE ap_ufixed(
|
||||
// const volatile ap_fixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
// : Base(ap_fixed_base<_AP_W2, _AP_I2, true, _AP_Q2, _AP_O2, _AP_N2>(op)) {}
|
||||
|
||||
//template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
||||
// int _AP_N2>
|
||||
//INLINE ap_ufixed(
|
||||
// const ap_ufixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
// : Base(ap_fixed_base<_AP_W2, _AP_I2, false, _AP_Q2, _AP_O2, _AP_N2>(op)) {
|
||||
//}
|
||||
|
||||
//template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
||||
// int _AP_N2>
|
||||
//INLINE ap_ufixed(
|
||||
// const volatile ap_ufixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
// : Base(ap_fixed_base<_AP_W2, _AP_I2, false, _AP_Q2, _AP_O2, _AP_N2>(op)) {
|
||||
//}
|
||||
|
||||
/// copy ctor from ap_int_base.
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE ap_ufixed(const ap_int_base<_AP_W2, _AP_S2>& op) : Base(op) {}
|
||||
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE ap_ufixed(const volatile ap_int_base<_AP_W2, _AP_S2>& op) : Base(op) {}
|
||||
|
||||
//template <int _AP_W2>
|
||||
//INLINE ap_ufixed(const ap_int<_AP_W2>& op)
|
||||
// : Base(ap_int_base<_AP_W2, true>(op)) {}
|
||||
|
||||
//template <int _AP_W2>
|
||||
//INLINE ap_ufixed(const volatile ap_int<_AP_W2>& op)
|
||||
// : Base(ap_int_base<_AP_W2, true>(op)) {}
|
||||
|
||||
//template <int _AP_W2>
|
||||
//INLINE ap_ufixed(const ap_uint<_AP_W2>& op)
|
||||
// : Base(ap_int_base<_AP_W2, false>(op)) {}
|
||||
|
||||
//template <int _AP_W2>
|
||||
//INLINE ap_ufixed(const volatile ap_uint<_AP_W2>& op)
|
||||
// : Base(ap_int_base<_AP_W2, false>(op)) {}
|
||||
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE ap_ufixed(const ap_bit_ref<_AP_W2, _AP_S2>& op) : Base(op) {}
|
||||
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE ap_ufixed(const ap_range_ref<_AP_W2, _AP_S2>& op) : Base(op) {}
|
||||
|
||||
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
||||
INLINE ap_ufixed(const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3>& op)
|
||||
: Base(op) {}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE ap_ufixed(
|
||||
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
: Base(op) {}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE ap_ufixed(
|
||||
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
: Base(op) {}
|
||||
|
||||
#define CTOR(TYPE) \
|
||||
INLINE ap_ufixed(TYPE v) : Base(v) {}
|
||||
|
||||
CTOR(bool)
|
||||
CTOR(char)
|
||||
CTOR(signed char)
|
||||
CTOR(unsigned char)
|
||||
CTOR(short)
|
||||
CTOR(unsigned short)
|
||||
CTOR(int)
|
||||
CTOR(unsigned int)
|
||||
CTOR(long)
|
||||
CTOR(unsigned long)
|
||||
CTOR(ap_slong)
|
||||
CTOR(ap_ulong)
|
||||
#if _AP_ENABLE_HALF_ == 1
|
||||
CTOR(half)
|
||||
#endif
|
||||
CTOR(float)
|
||||
CTOR(double)
|
||||
#undef CTOR
|
||||
|
||||
INLINE ap_ufixed(const char* s) : Base(s) {}
|
||||
|
||||
INLINE ap_ufixed(const char* s, signed char rd) : Base(s, rd) {}
|
||||
|
||||
// Assignment
|
||||
INLINE ap_ufixed& operator=(
|
||||
const ap_ufixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N>& op) {
|
||||
Base::V = op.V;
|
||||
return *this;
|
||||
}
|
||||
|
||||
INLINE void operator=(
|
||||
const ap_ufixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N>& op) volatile {
|
||||
Base::V = op.V;
|
||||
}
|
||||
|
||||
INLINE ap_ufixed& operator=(
|
||||
const volatile ap_ufixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N>& op) {
|
||||
Base::V = op.V;
|
||||
return *this;
|
||||
}
|
||||
|
||||
INLINE void operator=(const volatile ap_ufixed<_AP_W, _AP_I, _AP_Q, _AP_O,
|
||||
_AP_N>& op) volatile {
|
||||
Base::V = op.V;
|
||||
}
|
||||
}; // struct ap_ufixed
|
||||
|
||||
|
||||
#if !defined(__SYNTHESIS__) && (defined(SYSTEMC_H) || defined(SYSTEMC_INCLUDED))
|
||||
// XXX sc_trace overload for ap_fixed is already included in
|
||||
// "ap_sysc/ap_sc_extras.h", so do not define in synthesis.
|
||||
template <int _AP_W, int _AP_I, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
||||
INLINE void sc_trace(sc_core::sc_trace_file* tf,
|
||||
const ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N>& op,
|
||||
const std::string& name) {
|
||||
tf->trace(sc_dt::sc_lv<_AP_W>(op.to_string(2).c_str()), name);
|
||||
}
|
||||
|
||||
template <int _AP_W, int _AP_I, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
||||
INLINE void sc_trace(sc_core::sc_trace_file* tf,
|
||||
const ap_ufixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N>& op,
|
||||
const std::string& name) {
|
||||
tf->trace(sc_dt::sc_lv<_AP_W>(op.to_string(2).c_str()), name);
|
||||
}
|
||||
#endif // System C sim
|
||||
|
||||
// Specialization of std containers, so that std::complex<ap_fixed> can have its
|
||||
// image part automatically zero-initialized when only real part is provided.
|
||||
#include <ap_fixed_special.h>
|
||||
|
||||
#endif // ifndef __AP_FIXED_H__
|
||||
|
||||
// -*- cpp -*-
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,718 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011-2019 Xilinx, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __AP_FIXED_REF_H__
|
||||
#define __AP_FIXED_REF_H__
|
||||
|
||||
#ifndef __AP_FIXED_H__
|
||||
#error "Only ap_fixed.h and ap_int.h can be included directly in user code."
|
||||
#endif
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error "C++ is required to include this header file"
|
||||
|
||||
#else
|
||||
#ifndef __SYNTHESIS__
|
||||
#include <iostream>
|
||||
#endif
|
||||
/// Proxy class, which allows bit selection to be used as both rvalue (for
|
||||
/// reading) and lvalue (for writing)
|
||||
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
||||
int _AP_N>
|
||||
struct af_bit_ref {
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4521 4522)
|
||||
#endif
|
||||
typedef ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> ref_type;
|
||||
ref_type& d_bv;
|
||||
int d_index;
|
||||
|
||||
public:
|
||||
INLINE af_bit_ref(
|
||||
const af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& ref)
|
||||
: d_bv(ref.d_bv), d_index(ref.d_index) {
|
||||
#ifndef __SYNTHESIS__
|
||||
_AP_WARNING(d_index < 0, "Index of bit vector (%d) cannot be negative.",
|
||||
d_index);
|
||||
_AP_WARNING(d_index >= _AP_W, "Index of bit vector (%d) out of range (%d).",
|
||||
d_index, _AP_W);
|
||||
#endif
|
||||
}
|
||||
|
||||
INLINE af_bit_ref(ref_type* bv, int index = 0) : d_bv(*bv), d_index(index) {}
|
||||
|
||||
INLINE af_bit_ref(const ref_type* bv, int index = 0)
|
||||
: d_bv(*const_cast<ref_type*>(bv)), d_index(index) {}
|
||||
|
||||
/// convert operators.
|
||||
INLINE operator bool() const { return _AP_ROOT_op_get_bit(d_bv.V, d_index); }
|
||||
|
||||
/// @name assign operators
|
||||
// @{
|
||||
INLINE af_bit_ref& operator=(bool val) {
|
||||
d_bv.V = _AP_ROOT_op_set_bit(d_bv.V, d_index, val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Be explicit to prevent it from being deleted, as field d_bv
|
||||
// is of reference type.
|
||||
INLINE af_bit_ref& operator=(const af_bit_ref& val) {
|
||||
return operator=(bool(val));
|
||||
}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE af_bit_ref& operator=(
|
||||
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& val) {
|
||||
return operator=(bool(val));
|
||||
}
|
||||
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE af_bit_ref& operator=(const ap_bit_ref<_AP_W2, _AP_S2>& val) {
|
||||
return operator=(bool(val));
|
||||
}
|
||||
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE af_bit_ref& operator=(const ap_int_base<_AP_W2, _AP_S2>& val) {
|
||||
return operator=(val != 0);
|
||||
}
|
||||
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE af_bit_ref& operator=(const ap_range_ref<_AP_W2, _AP_S2>& val) {
|
||||
return operator=(ap_int_base<_AP_W2, false>(val));
|
||||
}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE af_bit_ref& operator=(
|
||||
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& val) {
|
||||
return operator=(ap_int_base<_AP_W2, false>(val));
|
||||
}
|
||||
|
||||
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
||||
INLINE af_bit_ref& operator=(
|
||||
const ap_concat_ref<_AP_W2, _AP_T3, _AP_W3, _AP_T3>& val) {
|
||||
return operator=(ap_int_base<_AP_W2 + _AP_W3, false>(val));
|
||||
}
|
||||
// @}
|
||||
|
||||
/// @name concatenate operators
|
||||
// @{
|
||||
template <int _AP_W2, int _AP_S2>
|
||||
INLINE ap_concat_ref<1, af_bit_ref, _AP_W2, ap_int_base<_AP_W2, _AP_S2> >
|
||||
operator,(ap_int_base<_AP_W2, _AP_S2> &op) {
|
||||
return ap_concat_ref<1, af_bit_ref, _AP_W2, ap_int_base<_AP_W2, _AP_S2> >(
|
||||
*this, op);
|
||||
}
|
||||
|
||||
template <int _AP_W2, int _AP_S2>
|
||||
INLINE ap_concat_ref<1, af_bit_ref, 1, ap_bit_ref<_AP_W2, _AP_S2> > operator,(
|
||||
const ap_bit_ref<_AP_W2, _AP_S2> &op) {
|
||||
return ap_concat_ref<1, af_bit_ref, 1, ap_bit_ref<_AP_W2, _AP_S2> >(*this,
|
||||
op);
|
||||
}
|
||||
|
||||
template <int _AP_W2, int _AP_S2>
|
||||
INLINE ap_concat_ref<1, af_bit_ref, _AP_W2, ap_range_ref<_AP_W2, _AP_S2> >
|
||||
operator,(const ap_range_ref<_AP_W2, _AP_S2> &op) {
|
||||
return ap_concat_ref<1, af_bit_ref, _AP_W2, ap_range_ref<_AP_W2, _AP_S2> >(
|
||||
*this, op);
|
||||
}
|
||||
|
||||
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
||||
INLINE ap_concat_ref<1, af_bit_ref, _AP_W2 + _AP_W3,
|
||||
ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3> >
|
||||
operator,(const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3> &op) {
|
||||
return ap_concat_ref<1, af_bit_ref, _AP_W2 + _AP_W3,
|
||||
ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3> >(*this,
|
||||
op);
|
||||
}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE ap_concat_ref<
|
||||
1, af_bit_ref, _AP_W2,
|
||||
af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >
|
||||
operator,(
|
||||
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> &op) {
|
||||
return ap_concat_ref<
|
||||
1, af_bit_ref, _AP_W2,
|
||||
af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >(*this,
|
||||
op);
|
||||
}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE ap_concat_ref<1, af_bit_ref, 1, af_bit_ref<_AP_W2, _AP_I2, _AP_S2,
|
||||
_AP_Q2, _AP_O2, _AP_N2> >
|
||||
operator,(
|
||||
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> &op) {
|
||||
return ap_concat_ref<1, af_bit_ref, 1, af_bit_ref<_AP_W2, _AP_I2, _AP_S2,
|
||||
_AP_Q2, _AP_O2, _AP_N2> >(
|
||||
*this,
|
||||
const_cast<af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>&>(
|
||||
op));
|
||||
}
|
||||
// @}
|
||||
|
||||
/// @name comparison
|
||||
// @{
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE bool operator==(
|
||||
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op) {
|
||||
return get() == op.get();
|
||||
}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE bool operator!=(
|
||||
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op) {
|
||||
return get() != op.get();
|
||||
}
|
||||
// @}
|
||||
|
||||
INLINE bool operator~() const {
|
||||
bool bit = _AP_ROOT_op_get_bit(d_bv.V, d_index);
|
||||
return bit ? false : true;
|
||||
}
|
||||
|
||||
INLINE bool get() const { return _AP_ROOT_op_get_bit(d_bv.V, d_index); }
|
||||
|
||||
INLINE int length() const { return 1; }
|
||||
|
||||
#ifndef __SYNTHESIS__
|
||||
std::string to_string() const { return get() ? "1" : "0"; }
|
||||
#else
|
||||
// XXX HLS will delete this in synthesis
|
||||
INLINE char* to_string() const { return 0; }
|
||||
#endif
|
||||
}; // struct af_bit_ref
|
||||
|
||||
// XXX apcc cannot handle global std::ios_base::Init() brought in by <iostream>
|
||||
#ifndef AP_AUTOCC
|
||||
#ifndef __SYNTHESIS__
|
||||
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
||||
int _AP_N>
|
||||
INLINE std::ostream& operator<<(
|
||||
std::ostream& os,
|
||||
const af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& x) {
|
||||
os << x.to_string();
|
||||
return os;
|
||||
}
|
||||
#endif // ifndef __SYNTHESIS__
|
||||
#endif // ifndef AP_AUTOCC
|
||||
|
||||
/// Range (slice) reference.
|
||||
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
||||
int _AP_N>
|
||||
struct af_range_ref {
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4521 4522)
|
||||
#endif
|
||||
typedef ap_fixed_base<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N> ref_type;
|
||||
ref_type& d_bv;
|
||||
int l_index;
|
||||
int h_index;
|
||||
|
||||
public:
|
||||
/// copy ctor
|
||||
INLINE af_range_ref(
|
||||
const af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& ref)
|
||||
: d_bv(ref.d_bv), l_index(ref.l_index), h_index(ref.h_index) {}
|
||||
|
||||
/// ctor from ap_fixed_base, higher and lower bound.
|
||||
/** if h is less than l, the bits selected will be returned in reverse order.
|
||||
*/
|
||||
INLINE af_range_ref(ref_type* bv, int h, int l)
|
||||
: d_bv(*bv), l_index(l), h_index(h) {
|
||||
#ifndef __SYNTHESIS__
|
||||
_AP_WARNING(h < 0 || l < 0,
|
||||
"Higher bound(%d) and lower(%d) bound cannot be negative.", h,
|
||||
l);
|
||||
_AP_WARNING(h >= _AP_W || l >= _AP_W,
|
||||
"Higher bound(%d) or lower(%d) bound out of range.", h, l);
|
||||
_AP_WARNING(h < l, "The bits selected will be returned in reverse order.");
|
||||
#endif
|
||||
}
|
||||
|
||||
INLINE af_range_ref(const ref_type* bv, int h, int l)
|
||||
: d_bv(*const_cast<ref_type*>(bv)), l_index(l), h_index(h) {
|
||||
#ifndef __SYNTHESIS__
|
||||
_AP_WARNING(h < 0 || l < 0,
|
||||
"Higher bound(%d) and lower(%d) bound cannot be negative.", h,
|
||||
l);
|
||||
_AP_WARNING(h >= _AP_W || l >= _AP_W,
|
||||
"Higher bound(%d) or lower(%d) bound out of range.", h, l);
|
||||
_AP_WARNING(h < l, "The bits selected will be returned in reverse order.");
|
||||
#endif
|
||||
}
|
||||
|
||||
/// @name assign operators
|
||||
// @{
|
||||
|
||||
#define ASSIGN_CTYPE_TO_AF_RANGE(DATA_TYPE) \
|
||||
INLINE af_range_ref& operator=(const DATA_TYPE val) { \
|
||||
ap_int_base<_AP_W, false> loc(val); \
|
||||
d_bv.V = _AP_ROOT_op_set_range(d_bv.V, l_index, h_index, loc.V); \
|
||||
return *this; \
|
||||
}
|
||||
|
||||
ASSIGN_CTYPE_TO_AF_RANGE(bool)
|
||||
ASSIGN_CTYPE_TO_AF_RANGE(char)
|
||||
ASSIGN_CTYPE_TO_AF_RANGE(signed char)
|
||||
ASSIGN_CTYPE_TO_AF_RANGE(unsigned char)
|
||||
ASSIGN_CTYPE_TO_AF_RANGE(short)
|
||||
ASSIGN_CTYPE_TO_AF_RANGE(unsigned short)
|
||||
ASSIGN_CTYPE_TO_AF_RANGE(int)
|
||||
ASSIGN_CTYPE_TO_AF_RANGE(unsigned int)
|
||||
ASSIGN_CTYPE_TO_AF_RANGE(long)
|
||||
ASSIGN_CTYPE_TO_AF_RANGE(unsigned long)
|
||||
ASSIGN_CTYPE_TO_AF_RANGE(ap_slong)
|
||||
ASSIGN_CTYPE_TO_AF_RANGE(ap_ulong)
|
||||
#if _AP_ENABLE_HALF_ == 1
|
||||
ASSIGN_CTYPE_TO_AF_RANGE(half)
|
||||
#endif
|
||||
ASSIGN_CTYPE_TO_AF_RANGE(float)
|
||||
ASSIGN_CTYPE_TO_AF_RANGE(double)
|
||||
#undef ASSIGN_CTYPE_TO_AF_RANGE
|
||||
|
||||
/// assgin using a string. XXX crucial for cosim.
|
||||
INLINE af_range_ref& operator=(const char* val) {
|
||||
const ap_int_base<_AP_W, false> tmp(val); // XXX figure out radix
|
||||
d_bv.V = _AP_ROOT_op_set_range(d_bv.V, l_index, h_index, tmp.V);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// assign from ap_int_base.
|
||||
// NOTE Base of other assgin operators.
|
||||
template <int _AP_W3, bool _AP_S3>
|
||||
INLINE af_range_ref& operator=(const ap_int_base<_AP_W3, _AP_S3>& val) {
|
||||
d_bv.V = _AP_ROOT_op_set_range(d_bv.V, l_index, h_index, val.V);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// assign from range reference to ap_int_base.
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE af_range_ref& operator=(const ap_range_ref<_AP_W2, _AP_S2>& val) {
|
||||
const ap_int_base<_AP_W2, false> tmp(val);
|
||||
return operator=(tmp);
|
||||
}
|
||||
|
||||
/// assign from bit reference to ap_int_base..
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE af_range_ref& operator=(const ap_bit_ref<_AP_W2, _AP_S2>& val) {
|
||||
const ap_int_base<1, false> tmp((bool)val);
|
||||
return operator=(tmp);
|
||||
}
|
||||
|
||||
/// assgin from ap_fixed_base.
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE af_range_ref& operator=(
|
||||
const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>&
|
||||
val) {
|
||||
d_bv.V = _AP_ROOT_op_set_range(d_bv.V, l_index, h_index, val.V);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// copy assgin.
|
||||
// XXX This has to be explicit, otherwise it will be deleted, as d_bv is
|
||||
// of reference type.
|
||||
INLINE af_range_ref& operator=(const af_range_ref& val) {
|
||||
ap_int_base<_AP_W, false> tmp(val);
|
||||
return operator=(tmp);
|
||||
}
|
||||
|
||||
/// assign from range reference to ap_fixed_base.
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE af_range_ref& operator=(
|
||||
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& val) {
|
||||
ap_int_base<_AP_W2, false> tmp(val);
|
||||
return operator=(tmp);
|
||||
}
|
||||
|
||||
/// assign from bit reference to ap_fixed_base.
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE af_range_ref& operator=(
|
||||
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& val) {
|
||||
ap_int_base<1, false> tmp((bool)val);
|
||||
return operator=(tmp);
|
||||
}
|
||||
|
||||
/// assign from compound reference.
|
||||
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
||||
INLINE af_range_ref& operator=(
|
||||
const ap_concat_ref<_AP_W2, _AP_T3, _AP_W3, _AP_T3>& val) {
|
||||
const ap_int_base<_AP_W2 + _AP_W3, false> tmp(val);
|
||||
return operator=(tmp);
|
||||
}
|
||||
// @}
|
||||
|
||||
/// @name comparison operators with ap_range_ref.
|
||||
// @{
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE bool operator==(const ap_range_ref<_AP_W2, _AP_S2>& op2) {
|
||||
ap_int_base<_AP_W, false> lop(*this);
|
||||
ap_int_base<_AP_W2, false> rop(op2);
|
||||
return lop == rop;
|
||||
}
|
||||
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE bool operator!=(const ap_range_ref<_AP_W2, _AP_S2>& op2) {
|
||||
return !(operator==(op2));
|
||||
}
|
||||
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE bool operator<(const ap_range_ref<_AP_W2, _AP_S2>& op2) {
|
||||
ap_int_base<_AP_W, false> lop(*this);
|
||||
ap_int_base<_AP_W2, false> rop(op2);
|
||||
return lop < rop;
|
||||
}
|
||||
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE bool operator>(const ap_range_ref<_AP_W2, _AP_S2>& op2) {
|
||||
ap_int_base<_AP_W, false> lop(*this);
|
||||
ap_int_base<_AP_W2, false> rop(op2);
|
||||
return lop > rop;
|
||||
}
|
||||
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE bool operator<=(const ap_range_ref<_AP_W2, _AP_S2>& op2) {
|
||||
return !(operator>(op2));
|
||||
}
|
||||
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE bool operator>=(const ap_range_ref<_AP_W2, _AP_S2>& op2) {
|
||||
return !(operator<(op2));
|
||||
}
|
||||
// @}
|
||||
|
||||
/// @name comparison operators with af_range_ref.
|
||||
// @{
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE bool operator==(
|
||||
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op2) {
|
||||
ap_int_base<_AP_W, false> lop(*this);
|
||||
ap_int_base<_AP_W2, false> rop(op2);
|
||||
return lop == rop;
|
||||
}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE bool operator!=(
|
||||
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op2) {
|
||||
return !(operator==(op2));
|
||||
}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE bool operator<(
|
||||
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op2) {
|
||||
ap_int_base<_AP_W, false> lop(*this);
|
||||
ap_int_base<_AP_W2, false> rop(op2);
|
||||
return lop < rop;
|
||||
}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE bool operator>(
|
||||
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op2) {
|
||||
ap_int_base<_AP_W, false> lop(*this);
|
||||
ap_int_base<_AP_W2, false> rop(op2);
|
||||
return lop > rop;
|
||||
}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE bool operator<=(
|
||||
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op2) {
|
||||
return !(operator>(op2));
|
||||
}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE bool operator>=(
|
||||
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op2) {
|
||||
return !(operator<(op2));
|
||||
}
|
||||
// @}
|
||||
|
||||
/// @name concatenate operators.
|
||||
/// @{
|
||||
/// concatenate with ap_int_base.
|
||||
template <int _AP_W2, int _AP_S2>
|
||||
INLINE
|
||||
ap_concat_ref<_AP_W, af_range_ref, _AP_W2, ap_int_base<_AP_W2, _AP_S2> >
|
||||
operator,(ap_int_base<_AP_W2, _AP_S2> &op) {
|
||||
return ap_concat_ref<_AP_W, af_range_ref, _AP_W2,
|
||||
ap_int_base<_AP_W2, _AP_S2> >(*this, op);
|
||||
}
|
||||
|
||||
/// concatenate with ap_bit_ref.
|
||||
template <int _AP_W2, int _AP_S2>
|
||||
INLINE ap_concat_ref<_AP_W, af_range_ref, 1, ap_bit_ref<_AP_W2, _AP_S2> >
|
||||
operator,(const ap_bit_ref<_AP_W2, _AP_S2> &op) {
|
||||
return ap_concat_ref<_AP_W, af_range_ref, 1, ap_bit_ref<_AP_W2, _AP_S2> >(
|
||||
*this, const_cast<ap_bit_ref<_AP_W2, _AP_S2>&>(op));
|
||||
}
|
||||
|
||||
/// concatenate with ap_bit_ref.
|
||||
template <int _AP_W2, int _AP_S2>
|
||||
INLINE ap_concat_ref<_AP_W, af_range_ref, _AP_W2, ap_range_ref<_AP_W2, _AP_S2> >
|
||||
operator,(const ap_range_ref<_AP_W2, _AP_S2> &op) {
|
||||
return ap_concat_ref<_AP_W, af_range_ref, _AP_W2,
|
||||
ap_range_ref<_AP_W2, _AP_S2> >(
|
||||
*this, const_cast<ap_range_ref<_AP_W2, _AP_S2>&>(op));
|
||||
}
|
||||
|
||||
/// concatenate with ap_concat_ref.
|
||||
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
||||
INLINE ap_concat_ref<_AP_W, af_range_ref, _AP_W2 + _AP_W3,
|
||||
ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3> >
|
||||
operator,(const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3> &op) {
|
||||
return ap_concat_ref<_AP_W, af_range_ref, _AP_W2 + _AP_W3,
|
||||
ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3> >(
|
||||
*this, const_cast<ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3>&>(op));
|
||||
}
|
||||
|
||||
/// concatenate with another af_range_ref.
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE
|
||||
ap_concat_ref<_AP_W, af_range_ref, _AP_W2,
|
||||
af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >
|
||||
operator,(const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>
|
||||
&op) {
|
||||
return ap_concat_ref<
|
||||
_AP_W, af_range_ref, _AP_W2,
|
||||
af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >(
|
||||
*this,
|
||||
const_cast<af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>&>(
|
||||
op));
|
||||
}
|
||||
|
||||
/// concatenate with another af_bit_ref.
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE
|
||||
ap_concat_ref<_AP_W, af_range_ref, 1,
|
||||
af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >
|
||||
operator,(
|
||||
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> &op) {
|
||||
return ap_concat_ref<
|
||||
_AP_W, af_range_ref, 1,
|
||||
af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2> >(
|
||||
*this,
|
||||
const_cast<af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>&>(
|
||||
op));
|
||||
}
|
||||
// @}
|
||||
|
||||
INLINE operator ap_ulong() const {
|
||||
ap_int_base<_AP_W, false> ret;
|
||||
ret.V = _AP_ROOT_op_get_range(d_bv.V, l_index, h_index);
|
||||
return ret.to_uint64();
|
||||
}
|
||||
|
||||
INLINE operator ap_int_base<_AP_W, false>() const {
|
||||
ap_int_base<_AP_W, false> ret;
|
||||
ret.V = _AP_ROOT_op_get_range(d_bv.V, l_index, h_index);
|
||||
return ret;
|
||||
}
|
||||
|
||||
INLINE ap_int_base<_AP_W, false> to_ap_int_base() const {
|
||||
ap_int_base<_AP_W, false> ret;
|
||||
ret.V = _AP_ROOT_op_get_range(d_bv.V, l_index, h_index);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// used in ap_fixed_base::to_string()
|
||||
INLINE char to_char() const {
|
||||
return (char)(_AP_ROOT_op_get_range(d_bv.V, l_index, h_index));
|
||||
}
|
||||
|
||||
INLINE int to_int() const {
|
||||
return (int)(_AP_ROOT_op_get_range(d_bv.V, l_index, h_index));
|
||||
}
|
||||
|
||||
INLINE unsigned to_uint() const {
|
||||
return (unsigned)(_AP_ROOT_op_get_range(d_bv.V, l_index, h_index));
|
||||
}
|
||||
|
||||
INLINE long to_long() const {
|
||||
return (long)(_AP_ROOT_op_get_range(d_bv.V, l_index, h_index));
|
||||
}
|
||||
|
||||
INLINE unsigned long to_ulong() const {
|
||||
return (unsigned long)(_AP_ROOT_op_get_range(d_bv.V, l_index, h_index));
|
||||
}
|
||||
|
||||
INLINE ap_slong to_int64() const {
|
||||
return (ap_slong)(_AP_ROOT_op_get_range(d_bv.V, l_index, h_index));
|
||||
}
|
||||
|
||||
INLINE ap_ulong to_uint64() const {
|
||||
return (ap_ulong)(_AP_ROOT_op_get_range(d_bv.V, l_index, h_index));
|
||||
}
|
||||
|
||||
INLINE ap_int_base<_AP_W, false> get() const {
|
||||
ap_int_base<_AP_W, false> ret;
|
||||
ret.V = _AP_ROOT_op_get_range(d_bv.V, l_index, h_index);
|
||||
return ret;
|
||||
}
|
||||
|
||||
template <int _AP_W2>
|
||||
INLINE void set(const ap_int_base<_AP_W2, false>& val) {
|
||||
d_bv.V = _AP_ROOT_op_set_range(d_bv.V, l_index, h_index, val.V);
|
||||
}
|
||||
|
||||
INLINE int length() const {
|
||||
return h_index >= l_index ? h_index - l_index + 1 : l_index - h_index + 1;
|
||||
}
|
||||
|
||||
#ifndef __SYNTHESIS__
|
||||
std::string to_string(signed char rd = 2) const {
|
||||
ap_int_base<_AP_W, false> ret;
|
||||
ret.V = _AP_ROOT_op_get_range(d_bv.V, l_index, h_index);
|
||||
return ret.to_string(rd);
|
||||
}
|
||||
#else
|
||||
// XXX HLS will delete this in synthesis
|
||||
INLINE char* to_string(signed char rd = 2) const {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}; // struct af_range_ref
|
||||
|
||||
// XXX apcc cannot handle global std::ios_base::Init() brought in by <iostream>
|
||||
#ifndef AP_AUTOCC
|
||||
#ifndef __SYNTHESIS__
|
||||
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, ap_o_mode _AP_O,
|
||||
int _AP_N>
|
||||
INLINE std::ostream& operator<<(
|
||||
std::ostream& os,
|
||||
const af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& x) {
|
||||
os << x.to_string();
|
||||
return os;
|
||||
}
|
||||
#endif
|
||||
#endif // ifndef AP_AUTOCC
|
||||
|
||||
#define AF_REF_REL_OP_WITH_INT(REL_OP, C_TYPE, _AP_W2, _AP_S2) \
|
||||
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
||||
ap_o_mode _AP_O, int _AP_N> \
|
||||
INLINE bool operator REL_OP( \
|
||||
const af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op, \
|
||||
C_TYPE op2) { \
|
||||
return ap_int_base<_AP_W, false>(op) \
|
||||
REL_OP ap_int_base<_AP_W2, _AP_S2>(op2); \
|
||||
} \
|
||||
\
|
||||
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
||||
ap_o_mode _AP_O, int _AP_N> \
|
||||
INLINE bool operator REL_OP( \
|
||||
C_TYPE op2, \
|
||||
const af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op) { \
|
||||
return ap_int_base<_AP_W2, _AP_S2>(op2) \
|
||||
REL_OP ap_int_base<_AP_W, false>(op); \
|
||||
} \
|
||||
\
|
||||
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
||||
ap_o_mode _AP_O, int _AP_N> \
|
||||
INLINE bool operator REL_OP( \
|
||||
const af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op, \
|
||||
C_TYPE op2) { \
|
||||
return bool(op) REL_OP op2; \
|
||||
} \
|
||||
\
|
||||
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
||||
ap_o_mode _AP_O, int _AP_N> \
|
||||
INLINE bool operator REL_OP( \
|
||||
C_TYPE op2, \
|
||||
const af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op) { \
|
||||
return op2 REL_OP bool(op); \
|
||||
}
|
||||
|
||||
#define AF_REF_REL_OPS_WITH_INT(C_TYPE, _AP_W2, _AP_S2) \
|
||||
AF_REF_REL_OP_WITH_INT(>, C_TYPE, (_AP_W2), (_AP_S2)) \
|
||||
AF_REF_REL_OP_WITH_INT(<, C_TYPE, (_AP_W2), (_AP_S2)) \
|
||||
AF_REF_REL_OP_WITH_INT(>=, C_TYPE, (_AP_W2), (_AP_S2)) \
|
||||
AF_REF_REL_OP_WITH_INT(<=, C_TYPE, (_AP_W2), (_AP_S2)) \
|
||||
AF_REF_REL_OP_WITH_INT(==, C_TYPE, (_AP_W2), (_AP_S2)) \
|
||||
AF_REF_REL_OP_WITH_INT(!=, C_TYPE, (_AP_W2), (_AP_S2))
|
||||
|
||||
AF_REF_REL_OPS_WITH_INT(bool, 1, false)
|
||||
AF_REF_REL_OPS_WITH_INT(char, 8, CHAR_IS_SIGNED)
|
||||
AF_REF_REL_OPS_WITH_INT(signed char, 8, true)
|
||||
AF_REF_REL_OPS_WITH_INT(unsigned char, 8, false)
|
||||
AF_REF_REL_OPS_WITH_INT(short, _AP_SIZE_short, true)
|
||||
AF_REF_REL_OPS_WITH_INT(unsigned short, _AP_SIZE_short, false)
|
||||
AF_REF_REL_OPS_WITH_INT(int, _AP_SIZE_int, true)
|
||||
AF_REF_REL_OPS_WITH_INT(unsigned int, _AP_SIZE_int, false)
|
||||
AF_REF_REL_OPS_WITH_INT(long, _AP_SIZE_long, true)
|
||||
AF_REF_REL_OPS_WITH_INT(unsigned long, _AP_SIZE_long, false)
|
||||
AF_REF_REL_OPS_WITH_INT(ap_slong, _AP_SIZE_ap_slong, true)
|
||||
AF_REF_REL_OPS_WITH_INT(ap_ulong, _AP_SIZE_ap_slong, false)
|
||||
|
||||
#undef AF_REF_REL_OP_INT
|
||||
#undef AF_REF_REL_OPS_WITH_INT
|
||||
|
||||
#define AF_REF_REL_OP_WITH_AP_INT(REL_OP) \
|
||||
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
||||
ap_o_mode _AP_O, int _AP_N, int _AP_W2, bool _AP_S2> \
|
||||
INLINE bool operator REL_OP( \
|
||||
const af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op, \
|
||||
const ap_int_base<_AP_W2, _AP_S>& op2) { \
|
||||
return ap_int_base<_AP_W, false>(op) REL_OP op2; \
|
||||
} \
|
||||
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
||||
ap_o_mode _AP_O, int _AP_N, int _AP_W2, bool _AP_S2> \
|
||||
INLINE bool operator REL_OP( \
|
||||
const ap_int_base<_AP_W2, _AP_S2>& op2, \
|
||||
const af_range_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op) { \
|
||||
return op2 REL_OP ap_int_base<_AP_W, false>(op); \
|
||||
} \
|
||||
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
||||
ap_o_mode _AP_O, int _AP_N, int _AP_W2, bool _AP_S2> \
|
||||
INLINE bool operator REL_OP( \
|
||||
const af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op, \
|
||||
const ap_int_base<_AP_W2, _AP_S2>& op2) { \
|
||||
return ap_int_base<1, false>(op) REL_OP op2; \
|
||||
} \
|
||||
template <int _AP_W, int _AP_I, bool _AP_S, ap_q_mode _AP_Q, \
|
||||
ap_o_mode _AP_O, int _AP_N, int _AP_W2, bool _AP_S2> \
|
||||
INLINE bool operator REL_OP( \
|
||||
const ap_int_base<_AP_W2, _AP_S2>& op2, \
|
||||
const af_bit_ref<_AP_W, _AP_I, _AP_S, _AP_Q, _AP_O, _AP_N>& op) { \
|
||||
return op2 REL_OP ap_int_base<1, false>(op); \
|
||||
}
|
||||
|
||||
AF_REF_REL_OP_WITH_AP_INT(>)
|
||||
AF_REF_REL_OP_WITH_AP_INT(<)
|
||||
AF_REF_REL_OP_WITH_AP_INT(>=)
|
||||
AF_REF_REL_OP_WITH_AP_INT(<=)
|
||||
AF_REF_REL_OP_WITH_AP_INT(==)
|
||||
AF_REF_REL_OP_WITH_AP_INT(!=)
|
||||
|
||||
#endif // ifndef __cplusplus
|
||||
|
||||
#endif // ifndef __AP_FIXED_REF_H__
|
||||
|
||||
// -*- cpp -*-
|
||||
@@ -1,230 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011-2019 Xilinx, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __AP_FIXED_SPECIAL_H__
|
||||
#define __AP_FIXED_SPECIAL_H__
|
||||
|
||||
#ifndef __AP_FIXED_H__
|
||||
#error "Only ap_fixed.h and ap_int.h can be included directly in user code."
|
||||
#endif
|
||||
|
||||
#ifndef __SYNTHESIS__
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#endif
|
||||
// FIXME AP_AUTOCC cannot handle many standard headers, so declare instead of
|
||||
// include.
|
||||
// #include <complex>
|
||||
namespace std {
|
||||
template<typename _Tp> class complex;
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: Modernize the code using C++11/C++14
|
||||
1. constexpr http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0415r0.html
|
||||
2. move constructor
|
||||
*/
|
||||
|
||||
namespace std {
|
||||
/*
|
||||
Specialize std::complex<ap_fixed> to zero initialization ap_fixed.
|
||||
|
||||
To reduce the area cost, ap_fixed is not zero initialized, just like basic
|
||||
types float or double. However, libstdc++ provides specialization for float,
|
||||
double and long double, initializing image part to 0 when not specified.
|
||||
|
||||
This has become a difficulty in switching legacy code from these C types to
|
||||
ap_fixed. To ease the tranform of legacy code, we have to implement
|
||||
specialization of std::complex<> for our type.
|
||||
|
||||
As ap_fixed is a template, it is impossible to specialize only the methods
|
||||
that causes default initialization of value type in std::complex<>. An
|
||||
explicit full specialization of the template class has to be done, covering
|
||||
all the member functions and operators of std::complex<> as specified
|
||||
in standard 26.2.4 and 26.2.5.
|
||||
*/
|
||||
template <int _AP_W, int _AP_I, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
||||
class complex<ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N> > {
|
||||
public:
|
||||
typedef ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N> _Tp;
|
||||
typedef _Tp value_type;
|
||||
|
||||
// 26.2.4/1
|
||||
// Constructor without argument
|
||||
// Default initialize, so that in dataflow, the variable is only written once.
|
||||
complex() : _M_real(_Tp()), _M_imag(_Tp()) {}
|
||||
// Constructor with ap_fixed.
|
||||
// Zero initialize image part when not specified, so that `C(1) == C(1,0)`
|
||||
complex(const _Tp &__r, const _Tp &__i = _Tp(0))
|
||||
: _M_real(__r), _M_imag(__i) {}
|
||||
|
||||
// Constructor with another complex number
|
||||
template <typename _Up>
|
||||
complex(const complex<_Up> &__z) : _M_real(__z.real()), _M_imag(__z.imag()) {}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
const _Tp& real() const { return _M_real; }
|
||||
const _Tp& imag() const { return _M_imag; }
|
||||
#else
|
||||
_Tp& real() { return _M_real; }
|
||||
const _Tp& real() const { return _M_real; }
|
||||
_Tp& imag() { return _M_imag; }
|
||||
const _Tp& imag() const { return _M_imag; }
|
||||
#endif
|
||||
|
||||
void real(_Tp __val) { _M_real = __val; }
|
||||
|
||||
void imag(_Tp __val) { _M_imag = __val; }
|
||||
|
||||
// Assign this complex number with ap_fixed.
|
||||
// Zero initialize image poarrt, so that `C c; c = 1; c == C(1,0);`
|
||||
complex<_Tp> &operator=(const _Tp __t) {
|
||||
_M_real = __t;
|
||||
_M_imag = _Tp(0);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 26.2.5/1
|
||||
// Add ap_fixed to this complex number.
|
||||
complex<_Tp> &operator+=(const _Tp &__t) {
|
||||
_M_real += __t;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 26.2.5/3
|
||||
// Subtract ap_fixed from this complex number.
|
||||
complex<_Tp> &operator-=(const _Tp &__t) {
|
||||
_M_real -= __t;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 26.2.5/5
|
||||
// Multiply this complex number by ap_fixed.
|
||||
complex<_Tp> &operator*=(const _Tp &__t) {
|
||||
_M_real *= __t;
|
||||
_M_imag *= __t;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 26.2.5/7
|
||||
// Divide this complex number by ap_fixed.
|
||||
complex<_Tp> &operator/=(const _Tp &__t) {
|
||||
_M_real /= __t;
|
||||
_M_imag /= __t;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Assign complex number to this complex number.
|
||||
template <typename _Up>
|
||||
complex<_Tp> &operator=(const complex<_Up> &__z) {
|
||||
_M_real = __z.real();
|
||||
_M_imag = __z.imag();
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 26.2.5/9
|
||||
// Add complex number to this.
|
||||
template <typename _Up>
|
||||
complex<_Tp> &operator+=(const complex<_Up> &__z) {
|
||||
_M_real += __z.real();
|
||||
_M_imag += __z.imag();
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 26.2.5/11
|
||||
// Subtract complex number from this.
|
||||
template <typename _Up>
|
||||
complex<_Tp> &operator-=(const complex<_Up> &__z) {
|
||||
_M_real -= __z.real();
|
||||
_M_imag -= __z.imag();
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 26.2.5/13
|
||||
// Multiply this by complex number.
|
||||
template <typename _Up>
|
||||
complex<_Tp> &operator*=(const complex<_Up> &__z) {
|
||||
const _Tp __r = _M_real * __z.real() - _M_imag * __z.imag();
|
||||
_M_imag = _M_real * __z.imag() + _M_imag * __z.real();
|
||||
_M_real = __r;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 26.2.5/15
|
||||
// Divide this by complex number.
|
||||
template <typename _Up>
|
||||
complex<_Tp> &operator/=(const complex<_Up> &__z) {
|
||||
complex<_Tp> cj (__z.real(), -__z.imag());
|
||||
complex<_Tp> a = (*this) * cj;
|
||||
complex<_Tp> b = cj * __z;
|
||||
_M_real = a.real() / b.real();
|
||||
_M_imag = a.imag() / b.real();
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
_Tp _M_real;
|
||||
_Tp _M_imag;
|
||||
|
||||
}; // class complex<ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N> >
|
||||
|
||||
/*
|
||||
Non-member operations
|
||||
These operations are not required by standard in 26.2.6, but libstdc++
|
||||
defines them for
|
||||
float, double or long double's specialization.
|
||||
*/
|
||||
// Compare complex number with ap_fixed.
|
||||
template <int _AP_W, int _AP_I, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
||||
inline bool operator==(
|
||||
const complex<ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N> > &__x,
|
||||
const ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N> &__y) {
|
||||
return __x.real() == __y &&
|
||||
__x.imag() == 0;
|
||||
}
|
||||
|
||||
// Compare ap_fixed with complex number.
|
||||
template <int _AP_W, int _AP_I, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
||||
inline bool operator==(
|
||||
const ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N> &__x,
|
||||
const complex<ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N> > &__y) {
|
||||
return __x == __y.real() &&
|
||||
0 == __y.imag();
|
||||
}
|
||||
|
||||
// Compare complex number with ap_fixed.
|
||||
template <int _AP_W, int _AP_I, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
||||
inline bool operator!=(
|
||||
const complex<ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N> > &__x,
|
||||
const ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N> &__y) {
|
||||
return __x.real() != __y ||
|
||||
__x.imag() != 0;
|
||||
}
|
||||
|
||||
// Compare ap_fixed with complex number.
|
||||
template <int _AP_W, int _AP_I, ap_q_mode _AP_Q, ap_o_mode _AP_O, int _AP_N>
|
||||
inline bool operator!=(
|
||||
const ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N> &__x,
|
||||
const complex<ap_fixed<_AP_W, _AP_I, _AP_Q, _AP_O, _AP_N> > &__y) {
|
||||
return __x != __y.real() ||
|
||||
0 != __y.imag();
|
||||
}
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // ifndef __AP_FIXED_SPECIAL_H__
|
||||
|
||||
// -*- cpp -*-
|
||||
@@ -1,330 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011-2019 Xilinx, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __AP_INT_H__
|
||||
#define __AP_INT_H__
|
||||
|
||||
#include <ap_common.h>
|
||||
#include <ap_int_base.h>
|
||||
#include <ap_int_ref.h>
|
||||
|
||||
//---------------------------------------------------------------
|
||||
|
||||
/// Sign Arbitrary Precision Type.
|
||||
template <int _AP_W>
|
||||
struct ap_int : ap_int_base<_AP_W, true> {
|
||||
typedef ap_int_base<_AP_W, true> Base;
|
||||
// Constructor
|
||||
INLINE ap_int() : Base() {}
|
||||
|
||||
// Copy ctor
|
||||
INLINE ap_int(const ap_int& op) { Base::V = op.V; }
|
||||
|
||||
template <int _AP_W2>
|
||||
INLINE ap_int(const ap_int<_AP_W2>& op) {
|
||||
Base::V = op.V;
|
||||
}
|
||||
|
||||
template <int _AP_W2>
|
||||
INLINE ap_int(const volatile ap_int<_AP_W2>& op) {
|
||||
Base::V = op.V;
|
||||
}
|
||||
|
||||
template <int _AP_W2>
|
||||
INLINE ap_int(const ap_uint<_AP_W2>& op) {
|
||||
Base::V = op.V;
|
||||
}
|
||||
|
||||
template <int _AP_W2>
|
||||
INLINE ap_int(const volatile ap_uint<_AP_W2>& op) {
|
||||
Base::V = op.V;
|
||||
}
|
||||
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE ap_int(const ap_range_ref<_AP_W2, _AP_S2>& ref) : Base(ref) {}
|
||||
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE ap_int(const ap_bit_ref<_AP_W2, _AP_S2>& ref) : Base(ref) {}
|
||||
|
||||
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
||||
INLINE ap_int(const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3>& ref)
|
||||
: Base(ref) {}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
||||
int _AP_N2>
|
||||
INLINE ap_int(const ap_fixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
: Base((ap_fixed_base<_AP_W2, _AP_I2, true, _AP_Q2, _AP_O2, _AP_N2>)op) {}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
||||
int _AP_N2>
|
||||
INLINE ap_int(const ap_ufixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
: Base((ap_fixed_base<_AP_W2, _AP_I2, false, _AP_Q2, _AP_O2, _AP_N2>)op) {
|
||||
}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
||||
int _AP_N2>
|
||||
INLINE ap_int(
|
||||
const volatile ap_fixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
: Base((ap_fixed_base<_AP_W2, _AP_I2, true, _AP_Q2, _AP_O2, _AP_N2>)op) {}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
||||
int _AP_N2>
|
||||
INLINE ap_int(
|
||||
const volatile ap_ufixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
: Base((ap_fixed_base<_AP_W2, _AP_I2, false, _AP_Q2, _AP_O2, _AP_N2>)op) {
|
||||
}
|
||||
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE ap_int(const ap_int_base<_AP_W2, _AP_S2>& op) {
|
||||
Base::V = op.V;
|
||||
}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE ap_int(
|
||||
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
: Base(op) {}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE ap_int(
|
||||
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
: Base(op) {}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE ap_int(
|
||||
const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
: Base(op) {}
|
||||
|
||||
#define CTOR(TYPE) \
|
||||
INLINE ap_int(TYPE val) { Base::V = val; }
|
||||
CTOR(bool)
|
||||
CTOR(char)
|
||||
CTOR(signed char)
|
||||
CTOR(unsigned char)
|
||||
CTOR(short)
|
||||
CTOR(unsigned short)
|
||||
CTOR(int)
|
||||
CTOR(unsigned int)
|
||||
CTOR(long)
|
||||
CTOR(unsigned long)
|
||||
CTOR(ap_slong)
|
||||
CTOR(ap_ulong)
|
||||
#undef CTOR
|
||||
ap_int(double val) : Base(val) {}
|
||||
ap_int(float val) : Base(val) {}
|
||||
#if _AP_ENABLE_HALF_ == 1
|
||||
ap_int(half val) : Base(val) {}
|
||||
#endif
|
||||
|
||||
// ap_int_base will guess radix if radix is not provided.
|
||||
INLINE ap_int(const char* s) : Base(s) {}
|
||||
|
||||
INLINE ap_int(const char* s, signed char rd) : Base(s, rd) {}
|
||||
|
||||
// Assignment
|
||||
/* ctor will be used when right is not of proper type. */
|
||||
|
||||
INLINE ap_int& operator=(const ap_int<_AP_W>& op2) {
|
||||
Base::V = op2.V;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* cannot bind volatile reference to non-volatile type. */
|
||||
INLINE ap_int& operator=(const volatile ap_int<_AP_W>& op2) {
|
||||
Base::V = op2.V;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* cannot return volatile *this. */
|
||||
INLINE void operator=(const ap_int<_AP_W>& op2) volatile { Base::V = op2.V; }
|
||||
|
||||
INLINE void operator=(const volatile ap_int<_AP_W>& op2) volatile {
|
||||
Base::V = op2.V;
|
||||
}
|
||||
|
||||
}; // struct ap_int.
|
||||
|
||||
//---------------------------------------------------------------
|
||||
|
||||
/// Unsigned Arbitrary Precision Type.
|
||||
template <int _AP_W>
|
||||
struct ap_uint : ap_int_base<_AP_W, false> {
|
||||
typedef ap_int_base<_AP_W, false> Base;
|
||||
// Constructor
|
||||
INLINE ap_uint() : Base() {}
|
||||
|
||||
// Copy ctor
|
||||
INLINE ap_uint(const ap_uint& op) { Base::V = op.V; }
|
||||
|
||||
template <int _AP_W2>
|
||||
INLINE ap_uint(const ap_uint<_AP_W2>& op) {
|
||||
Base::V = op.V;
|
||||
}
|
||||
|
||||
template <int _AP_W2>
|
||||
INLINE ap_uint(const ap_int<_AP_W2>& op) {
|
||||
Base::V = op.V;
|
||||
}
|
||||
|
||||
template <int _AP_W2>
|
||||
INLINE ap_uint(const volatile ap_uint<_AP_W2>& op) {
|
||||
Base::V = op.V;
|
||||
}
|
||||
|
||||
template <int _AP_W2>
|
||||
INLINE ap_uint(const volatile ap_int<_AP_W2>& op) {
|
||||
Base::V = op.V;
|
||||
}
|
||||
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE ap_uint(const ap_range_ref<_AP_W2, _AP_S2>& ref) : Base(ref) {}
|
||||
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE ap_uint(const ap_bit_ref<_AP_W2, _AP_S2>& ref) : Base(ref) {}
|
||||
|
||||
template <int _AP_W2, typename _AP_T2, int _AP_W3, typename _AP_T3>
|
||||
INLINE ap_uint(const ap_concat_ref<_AP_W2, _AP_T2, _AP_W3, _AP_T3>& ref)
|
||||
: Base(ref) {}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
||||
int _AP_N2>
|
||||
INLINE ap_uint(const ap_fixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
: Base((ap_fixed_base<_AP_W2, _AP_I2, true, _AP_Q2, _AP_O2, _AP_N2>)op) {}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
||||
int _AP_N2>
|
||||
INLINE ap_uint(const ap_ufixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
: Base((ap_fixed_base<_AP_W2, _AP_I2, false, _AP_Q2, _AP_O2, _AP_N2>)op) {
|
||||
}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
||||
int _AP_N2>
|
||||
INLINE ap_uint(
|
||||
const volatile ap_fixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
: Base((ap_fixed_base<_AP_W2, _AP_I2, true, _AP_Q2, _AP_O2, _AP_N2>)op) {}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, ap_q_mode _AP_Q2, ap_o_mode _AP_O2,
|
||||
int _AP_N2>
|
||||
INLINE ap_uint(
|
||||
const volatile ap_ufixed<_AP_W2, _AP_I2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
: Base((ap_fixed_base<_AP_W2, _AP_I2, false, _AP_Q2, _AP_O2, _AP_N2>)op) {
|
||||
}
|
||||
|
||||
template <int _AP_W2, bool _AP_S2>
|
||||
INLINE ap_uint(const ap_int_base<_AP_W2, _AP_S2>& op) {
|
||||
Base::V = op.V;
|
||||
}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE ap_uint(
|
||||
const af_bit_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
: Base(op) {}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE ap_uint(
|
||||
const af_range_ref<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
: Base(op) {}
|
||||
|
||||
template <int _AP_W2, int _AP_I2, bool _AP_S2, ap_q_mode _AP_Q2,
|
||||
ap_o_mode _AP_O2, int _AP_N2>
|
||||
INLINE ap_uint(
|
||||
const ap_fixed_base<_AP_W2, _AP_I2, _AP_S2, _AP_Q2, _AP_O2, _AP_N2>& op)
|
||||
: Base(op) {}
|
||||
|
||||
#define CTOR(TYPE) \
|
||||
INLINE ap_uint(TYPE val) { Base::V = val; }
|
||||
CTOR(bool)
|
||||
CTOR(char)
|
||||
CTOR(signed char)
|
||||
CTOR(unsigned char)
|
||||
CTOR(short)
|
||||
CTOR(unsigned short)
|
||||
CTOR(int)
|
||||
CTOR(unsigned int)
|
||||
CTOR(long)
|
||||
CTOR(unsigned long)
|
||||
CTOR(ap_slong)
|
||||
CTOR(ap_ulong)
|
||||
#undef CTOR
|
||||
ap_uint(double val) : Base(val) {}
|
||||
ap_uint(float val) : Base(val) {}
|
||||
#if _AP_ENABLE_HALF_ == 1
|
||||
ap_uint(half val) : Base(val) {}
|
||||
#endif
|
||||
|
||||
// ap_int_base will guess radix if radix is not provided.
|
||||
INLINE ap_uint(const char* s) : Base(s) {}
|
||||
|
||||
INLINE ap_uint(const char* s, signed char rd) : Base(s, rd) {}
|
||||
|
||||
// Assignment
|
||||
/* XXX ctor will be used when right is not of proper type. */
|
||||
|
||||
INLINE ap_uint& operator=(const ap_uint<_AP_W>& op2) {
|
||||
Base::V = op2.V;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* cannot bind volatile reference to non-volatile type. */
|
||||
INLINE ap_uint& operator=(const volatile ap_uint<_AP_W>& op2) {
|
||||
Base::V = op2.V;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* cannot return volatile *this. */
|
||||
INLINE void operator=(const ap_uint<_AP_W>& op2) volatile { Base::V = op2.V; }
|
||||
|
||||
INLINE void operator=(const volatile ap_uint<_AP_W>& op2) volatile {
|
||||
Base::V = op2.V;
|
||||
}
|
||||
|
||||
}; // struct ap_uint.
|
||||
|
||||
#define ap_bigint ap_int
|
||||
#define ap_biguint ap_uint
|
||||
|
||||
#if !defined(__SYNTHESIS__) && (defined(SYSTEMC_H) || defined(SYSTEMC_INCLUDED))
|
||||
// XXX sc_trace overload for ap_fixed is already included in
|
||||
// "ap_sysc/ap_sc_extras.h", so do not define in synthesis.
|
||||
template <int _AP_W>
|
||||
INLINE void sc_trace(sc_core::sc_trace_file* tf, const ap_int<_AP_W>& op,
|
||||
const std::string& name) {
|
||||
if (tf) tf->trace(sc_dt::sc_lv<_AP_W>(op.to_string(2).c_str()), name);
|
||||
}
|
||||
|
||||
template <int _AP_W>
|
||||
INLINE void sc_trace(sc_core::sc_trace_file* tf, const ap_uint<_AP_W>& op,
|
||||
const std::string& name) {
|
||||
if (tf) tf->trace(sc_dt::sc_lv<_AP_W>(op.to_string(2).c_str()), name);
|
||||
}
|
||||
#endif // System C sim
|
||||
|
||||
#include <ap_int_special.h>
|
||||
|
||||
#endif // ifndef __AP_INT_H__ else
|
||||
|
||||
// FIXME user should include ap_fixed.h when using ap_fixed.
|
||||
// to avoid circular inclusion, must check whether this is required by
|
||||
// ap_fixed.h
|
||||
#ifndef __AP_FIXED_H__
|
||||
#include <ap_fixed.h>
|
||||
#endif
|
||||
|
||||
// -*- cpp -*-
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,223 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011-2019 Xilinx, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __AP_INT_SPECIAL_H__
|
||||
#define __AP_INT_SPECIAL_H__
|
||||
|
||||
#ifndef __AP_INT_H__
|
||||
#error "Only ap_fixed.h and ap_int.h can be included directly in user code."
|
||||
#endif
|
||||
|
||||
#ifndef __SYNTHESIS__
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#endif
|
||||
// FIXME AP_AUTOCC cannot handle many standard headers, so declare instead of
|
||||
// include.
|
||||
// #include <complex>
|
||||
namespace std {
|
||||
template<typename _Tp> class complex;
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: Modernize the code using C++11/C++14
|
||||
1. constexpr http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0415r0.html
|
||||
2. move constructor
|
||||
*/
|
||||
|
||||
namespace std {
|
||||
/*
|
||||
Specialize std::complex<ap_int> to zero initialization ap_int.
|
||||
|
||||
To reduce the area cost, ap_int is not zero initialized, just like basic
|
||||
types float or double. However, libstdc++ provides specialization for float,
|
||||
double and long double, initializing image part to 0 when not specified.
|
||||
|
||||
This has become a difficulty in switching legacy code from these C types to
|
||||
ap_int. To ease the tranform of legacy code, we have to implement
|
||||
specialization of std::complex<> for our type.
|
||||
|
||||
As ap_int is a template, it is impossible to specialize only the methods
|
||||
that causes default initialization of value type in std::complex<>. An
|
||||
explicit full specialization of the template class has to be done, covering
|
||||
all the member functions and operators of std::complex<> as specified
|
||||
in standard 26.2.4 and 26.2.5.
|
||||
*/
|
||||
template <int _AP_W>
|
||||
class complex<ap_int<_AP_W> > {
|
||||
public:
|
||||
typedef ap_int<_AP_W> _Tp;
|
||||
typedef _Tp value_type;
|
||||
|
||||
// 26.2.4/1
|
||||
// Constructor without argument
|
||||
// Default initialize, so that in dataflow, the variable is only written once.
|
||||
complex() : _M_real(_Tp()), _M_imag(_Tp()) {}
|
||||
// Constructor with ap_int.
|
||||
// Zero initialize image part when not specified, so that `C(1) == C(1,0)`
|
||||
complex(const _Tp &__r, const _Tp &__i = _Tp(0))
|
||||
: _M_real(__r), _M_imag(__i) {}
|
||||
|
||||
// Constructor with another complex number
|
||||
template <typename _Up>
|
||||
complex(const complex<_Up> &__z) : _M_real(__z.real()), _M_imag(__z.imag()) {}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
const _Tp& real() const { return _M_real; }
|
||||
const _Tp& imag() const { return _M_imag; }
|
||||
#else
|
||||
_Tp& real() { return _M_real; }
|
||||
const _Tp& real() const { return _M_real; }
|
||||
_Tp& imag() { return _M_imag; }
|
||||
const _Tp& imag() const { return _M_imag; }
|
||||
#endif
|
||||
|
||||
void real(_Tp __val) { _M_real = __val; }
|
||||
|
||||
void imag(_Tp __val) { _M_imag = __val; }
|
||||
|
||||
// Assign this complex number with ap_int.
|
||||
// Zero initialize image poarrt, so that `C c; c = 1; c == C(1,0);`
|
||||
complex<_Tp> &operator=(const _Tp __t) {
|
||||
_M_real = __t;
|
||||
_M_imag = _Tp(0);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 26.2.5/1
|
||||
// Add ap_int to this complex number.
|
||||
complex<_Tp> &operator+=(const _Tp &__t) {
|
||||
_M_real += __t;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 26.2.5/3
|
||||
// Subtract ap_int from this complex number.
|
||||
complex<_Tp> &operator-=(const _Tp &__t) {
|
||||
_M_real -= __t;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 26.2.5/5
|
||||
// Multiply this complex number by ap_int.
|
||||
complex<_Tp> &operator*=(const _Tp &__t) {
|
||||
_M_real *= __t;
|
||||
_M_imag *= __t;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 26.2.5/7
|
||||
// Divide this complex number by ap_int.
|
||||
complex<_Tp> &operator/=(const _Tp &__t) {
|
||||
_M_real /= __t;
|
||||
_M_imag /= __t;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Assign complex number to this complex number.
|
||||
template <typename _Up>
|
||||
complex<_Tp> &operator=(const complex<_Up> &__z) {
|
||||
_M_real = __z.real();
|
||||
_M_imag = __z.imag();
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 26.2.5/9
|
||||
// Add complex number to this.
|
||||
template <typename _Up>
|
||||
complex<_Tp> &operator+=(const complex<_Up> &__z) {
|
||||
_M_real += __z.real();
|
||||
_M_imag += __z.imag();
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 26.2.5/11
|
||||
// Subtract complex number from this.
|
||||
template <typename _Up>
|
||||
complex<_Tp> &operator-=(const complex<_Up> &__z) {
|
||||
_M_real -= __z.real();
|
||||
_M_imag -= __z.imag();
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 26.2.5/13
|
||||
// Multiply this by complex number.
|
||||
template <typename _Up>
|
||||
complex<_Tp> &operator*=(const complex<_Up> &__z) {
|
||||
const _Tp __r = _M_real * __z.real() - _M_imag * __z.imag();
|
||||
_M_imag = _M_real * __z.imag() + _M_imag * __z.real();
|
||||
_M_real = __r;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 26.2.5/15
|
||||
// Divide this by complex number.
|
||||
template <typename _Up>
|
||||
complex<_Tp> &operator/=(const complex<_Up> &__z) {
|
||||
complex<_Tp> cj (__z.real(), -__z.imag());
|
||||
complex<_Tp> a = (*this) * cj;
|
||||
complex<_Tp> b = cj * __z;
|
||||
_M_real = a.real() / b.real();
|
||||
_M_imag = a.imag() / b.real();
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
_Tp _M_real;
|
||||
_Tp _M_imag;
|
||||
|
||||
}; // class complex<ap_int<_AP_W> >
|
||||
|
||||
|
||||
/*
|
||||
Non-member operations
|
||||
These operations are not required by standard in 26.2.6, but libstdc++
|
||||
defines them for
|
||||
float, double or long double's specialization.
|
||||
*/
|
||||
// Compare complex number with ap_int.
|
||||
template <int _AP_W>
|
||||
inline bool operator==(const complex<ap_int<_AP_W> > &__x, const ap_int<_AP_W> &__y) {
|
||||
return __x.real() == __y &&
|
||||
__x.imag() == 0;
|
||||
}
|
||||
|
||||
// Compare ap_int with complex number.
|
||||
template <int _AP_W>
|
||||
inline bool operator==(const ap_int<_AP_W> &__x, const complex<ap_int<_AP_W> > &__y) {
|
||||
return __x == __y.real() &&
|
||||
0 == __y.imag();
|
||||
}
|
||||
|
||||
// Compare complex number with ap_int.
|
||||
template <int _AP_W>
|
||||
inline bool operator!=(const complex<ap_int<_AP_W> > &__x, const ap_int<_AP_W> &__y) {
|
||||
return __x.real() != __y ||
|
||||
__x.imag() != 0;
|
||||
}
|
||||
|
||||
// Compare ap_int with complex number.
|
||||
template <int _AP_W>
|
||||
inline bool operator!=(const ap_int<_AP_W> &__x, const complex<ap_int<_AP_W> > &__y) {
|
||||
return __x != __y.real() ||
|
||||
0 != __y.imag();
|
||||
}
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // ifndef __AP_INT_SPECIAL_H__
|
||||
|
||||
// -*- cpp -*-
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,122 +0,0 @@
|
||||
// 67d7842dbbe25473c3c32b93c0da8047785f30d78e8a024de1b57352245f9689
|
||||
|
||||
// Modified by Filip Leonarski (Paul Scherrer Institute
|
||||
// to allow for multiple parallel bursts to the same pointer
|
||||
// (via independent HBM channels)
|
||||
|
||||
#ifndef X_HLS_BURST_MAXI_SIM_H
|
||||
#define X_HLS_BURST_MAXI_SIM_H
|
||||
|
||||
/*
|
||||
* This file contains a C++ simulation model of hls::burst_maxi
|
||||
*/
|
||||
#ifndef __cplusplus
|
||||
|
||||
#error C++ is required to include this header file
|
||||
|
||||
#else
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
#include <assert.h>
|
||||
#include "ap_int.h"
|
||||
|
||||
namespace hls {
|
||||
|
||||
struct MAXIAccessRecord {
|
||||
unsigned read_disp;
|
||||
unsigned write_disp;
|
||||
std::list<std::pair<size_t, unsigned>> ReadQ;
|
||||
std::list<std::pair<size_t, unsigned>> WriteQ;
|
||||
std::list<std::pair<size_t, unsigned>> WriteRespQ;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class burst_maxi {
|
||||
public:
|
||||
burst_maxi(T *p) : Ptr(p) {
|
||||
unsigned bitwidth = sizeof(T) * 8;
|
||||
assert(bitwidth != 0 && !(bitwidth & (bitwidth - 1)) &&
|
||||
"Error: bit width of hls::burst_maxi is not poower-of-2.");
|
||||
// Reset the MAXI access record to this pointer
|
||||
R.read_disp = 0;
|
||||
R.write_disp = 0;
|
||||
R.ReadQ.clear();
|
||||
R.WriteQ.clear();
|
||||
R.WriteRespQ.clear();
|
||||
}
|
||||
|
||||
void read_request(size_t offset, unsigned len) {
|
||||
assert(len > 0);
|
||||
R.ReadQ.push_back(std::make_pair(offset, len));
|
||||
std::list<std::pair<size_t, unsigned>> CurrentWriteQ = R.WriteQ;
|
||||
CurrentWriteQ.insert(CurrentWriteQ.end(),
|
||||
R.WriteRespQ.begin(), R.WriteRespQ.end());
|
||||
for (auto Pair : CurrentWriteQ) {
|
||||
if (overlap(offset, len, Pair.first, Pair.second)) {
|
||||
std::cerr << "Error: MAXI read request(offset = " << offset << ", len = " << len << ") overlaps with previous write request(offset = " << Pair.first << ", len = " << Pair.second << ")." << std::endl;
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
T read() {
|
||||
assert(!R.ReadQ.empty() && "Error: MAXI read without request.");
|
||||
auto Pair = R.ReadQ.front();
|
||||
T V = Ptr[Pair.first + (R.read_disp++)];
|
||||
if (R.read_disp == Pair.second) {
|
||||
R.read_disp = 0;
|
||||
R.ReadQ.pop_front();
|
||||
}
|
||||
return V;
|
||||
}
|
||||
|
||||
void write_request(size_t offset, unsigned len) {
|
||||
assert(len > 0);
|
||||
for (auto Pair : R.ReadQ) {
|
||||
if (overlap(offset, len, Pair.first, Pair.second)) {
|
||||
std::cerr << "Error: MAXI write request(offset = " << offset << ", len = " << len << ") overlaps with previous read request(offset = " << Pair.first << ", len = " << Pair.second << ")." << std::endl;
|
||||
abort();
|
||||
}
|
||||
}
|
||||
R.WriteQ.push_back(std::make_pair(offset, len));
|
||||
}
|
||||
|
||||
void write(const T &val, ap_int<sizeof(T)> byte_enable_mask = -1) {
|
||||
assert(!R.WriteQ.empty() && "Error: MAXI write without request.");
|
||||
auto Pair = R.WriteQ.front();
|
||||
T *DstP = &Ptr[Pair.first + R.write_disp++];
|
||||
T Src = val;
|
||||
for (unsigned i = 0; i < sizeof(T); i++) {
|
||||
if (byte_enable_mask[i])
|
||||
reinterpret_cast<char *>(DstP)[i] = reinterpret_cast<char *>(&Src)[i];
|
||||
}
|
||||
|
||||
if (R.write_disp == Pair.second) {
|
||||
R.write_disp = 0;
|
||||
R.WriteRespQ.push_back(Pair);
|
||||
R.WriteQ.pop_front();
|
||||
}
|
||||
}
|
||||
|
||||
void write_response() {
|
||||
assert(!R.WriteRespQ.empty() && "Error: bad MAXI write response. Possible: 1) no corresponding write request; 2) some data still not written.");
|
||||
R.WriteRespQ.pop_front();
|
||||
}
|
||||
|
||||
private:
|
||||
T *Ptr;
|
||||
MAXIAccessRecord R;
|
||||
bool overlap(size_t a, unsigned a_len, size_t b, unsigned b_len) {
|
||||
return a <= b ? a + a_len > b : b + b_len > a;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} // namespace hls
|
||||
|
||||
#endif // __cplusplus
|
||||
#endif // X_HLS_STREAM_SIM_H
|
||||
|
||||
|
||||
@@ -75,7 +75,6 @@ copy_license bitshuffle.txt compression/bitshuffle/LICENSE
|
||||
copy_license bitshuffle-hperf.txt compression/bitshuffle_hperf/LICENSE-APACHE
|
||||
copy_license lz4.txt compression/lz4/LICENSE
|
||||
copy_license stb_image_write.txt preview/stb/LICENSE
|
||||
copy_license xilinx-hls-headers.txt fpga/include/LICENSE.HLS_Headers
|
||||
copy_license gemmi.txt gemmi_gph/LICENSE.txt
|
||||
copy_license larch.txt gemmi_gph/LICENSE-larch.txt
|
||||
copy_license fast-feedback-indexer.txt image_analysis/indexing/fast-feedback-indexer/LICENSE.md
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
Source of the headers:
|
||||
https://github.com/Xilinx/HLS_arbitrary_Precision_Types
|
||||
xilinx_hls_lib_2022_1.tgz (in Vitis HLS 2022.1)
|
||||
|
||||
Copyright 2011-2019 Xilinx, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
@@ -29,7 +29,6 @@ const titles = {
|
||||
"fast-feedback-indexer": "Fast feedback indexer",
|
||||
"nlohmann-json": "nlohmann/json",
|
||||
"xbflash-qspi": "xbflash.qspi",
|
||||
"xilinx-hls-headers": "Xilinx HLS arbitrary-precision headers",
|
||||
"slsDetectorPackage-GPL-3.0": "slsDetectorPackage (GPL-3.0)",
|
||||
"slsDetectorPackage-LGPL-3.0": "slsDetectorPackage (LGPL-3.0)",
|
||||
};
|
||||
|
||||
@@ -18,13 +18,16 @@ manifest with copyright holders is in THIRD_PARTY_NOTICES.md in the source distr
|
||||
<li><a href="#ccp4-monomer-library">ccp4-monomer-library</a></li>
|
||||
<li><a href="#ceres-solver">ceres-solver</a></li>
|
||||
<li><a href="#cpp-httplib">cpp-httplib</a></li>
|
||||
<li><a href="#durin">durin</a></li>
|
||||
<li><a href="#eigen-README">Eigen (notes)</a></li>
|
||||
<li><a href="#eigen">eigen</a></li>
|
||||
<li><a href="#fast-feedback-indexer">Fast feedback indexer</a></li>
|
||||
<li><a href="#fast-float">fast-float</a></li>
|
||||
<li><a href="#gemmi">gemmi</a></li>
|
||||
<li><a href="#GPL-2.0">GPL-2.0</a></li>
|
||||
<li><a href="#half">half</a></li>
|
||||
<li><a href="#hdf5">hdf5</a></li>
|
||||
<li><a href="#hpcn-uam">hpcn-uam</a></li>
|
||||
<li><a href="#larch">larch</a></li>
|
||||
<li><a href="#libtiff">libtiff</a></li>
|
||||
<li><a href="#libzmq">libzmq</a></li>
|
||||
@@ -37,18 +40,20 @@ manifest with copyright holders is in THIRD_PARTY_NOTICES.md in the source distr
|
||||
<li><a href="#pocketfft">pocketfft</a></li>
|
||||
<li><a href="#Qt6-LGPL-3.0">Qt 6 — LGPL-3.0 (full text)</a></li>
|
||||
<li><a href="#Qt6-NOTICE">Qt 6</a></li>
|
||||
<li><a href="#rapidjson">rapidjson</a></li>
|
||||
<li><a href="#sajson">sajson</a></li>
|
||||
<li><a href="#slsDetectorPackage-GPL-3.0">slsDetectorPackage (GPL-3.0)</a></li>
|
||||
<li><a href="#slsDetectorPackage-LGPL-3.0">slsDetectorPackage (LGPL-3.0)</a></li>
|
||||
<li><a href="#slsDetectorPackage-md5-Apache-2.0">slsDetectorPackage-md5-Apache-2.0</a></li>
|
||||
<li><a href="#spdlog">spdlog</a></li>
|
||||
<li><a href="#stb_image_write">stb_image_write</a></li>
|
||||
<li><a href="#stb_sprintf">stb_sprintf</a></li>
|
||||
<li><a href="#tf-psa-crypto">tf-psa-crypto</a></li>
|
||||
<li><a href="#tinycbor">tinycbor</a></li>
|
||||
<li><a href="#tinydir">tinydir</a></li>
|
||||
<li><a href="#traccc">traccc</a></li>
|
||||
<li><a href="#wingetopt">wingetopt</a></li>
|
||||
<li><a href="#xbflash-qspi">xbflash.qspi</a></li>
|
||||
<li><a href="#xilinx-hls-headers">Xilinx HLS arbitrary-precision headers</a></li>
|
||||
<li><a href="#zlib">zlib</a></li>
|
||||
<li><a href="#zstd">zstd</a></li>
|
||||
</ul>
|
||||
@@ -1422,6 +1427,32 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.</pre>
|
||||
<hr>
|
||||
<h2 id="durin">durin</h2>
|
||||
<pre>Copyright (c) 2018-2019, Diamond Light Source
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holder nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</pre>
|
||||
<hr>
|
||||
<h2 id="eigen-README">Eigen (notes)</h2>
|
||||
<pre>Eigen is primarily MPL2 licensed. See COPYING.MPL2 and these links:
|
||||
http://www.mozilla.org/MPL/2.0/
|
||||
@@ -2308,6 +2339,347 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.</pre>
|
||||
<hr>
|
||||
<h2 id="GPL-2.0">GPL-2.0</h2>
|
||||
<pre> GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) 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
|
||||
this service 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 make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. 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.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
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
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the 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 a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE 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.
|
||||
|
||||
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
|
||||
convey 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 2 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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision 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, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This 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.</pre>
|
||||
<hr>
|
||||
<h2 id="half">half</h2>
|
||||
<pre>half - IEEE 754-based half-precision floating-point library.
|
||||
|
||||
@@ -2611,6 +2983,39 @@ Foundation under Federal Award No. 2534078.
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.</pre>
|
||||
<hr>
|
||||
<h2 id="hpcn-uam">hpcn-uam</h2>
|
||||
<pre>BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2019, HPCN Group, UAM Spain (hpcn-uam.es)
|
||||
and Systems Group, ETH Zurich (systems.ethz.ch)
|
||||
All rights reserved.
|
||||
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</pre>
|
||||
<hr>
|
||||
<h2 id="larch">larch</h2>
|
||||
<pre>The MIT License
|
||||
|
||||
@@ -5569,12 +5974,18 @@ LGPL-3.0 compliance for the distributed viewer:
|
||||
|
||||
* Qt is used as provided by The Qt Company under the LGPL-3.0 open-source terms; no Qt
|
||||
source code has been modified.
|
||||
* The viewer links Qt dynamically. On Windows and macOS the Qt shared libraries are
|
||||
deployed next to the application by windeployqt / macdeployqt; the user may therefore
|
||||
replace them with a compatible build of Qt, as the LGPL requires.
|
||||
* On Windows and macOS the viewer links Qt dynamically: the Qt shared libraries are
|
||||
deployed next to the application by windeployqt / macdeployqt, and the user may replace
|
||||
them with a compatible build of Qt, as the LGPL requires.
|
||||
* The Linux build links Qt 6.11.x (currently 6.11.1) statically. As LGPL-3.0 section 4(d)(0)
|
||||
provides, the user can relink the viewer with a modified Qt: the complete source of
|
||||
jfjoch_viewer is distributed with Jungfraujoch, and docker/ubuntu2404/Dockerfile (with
|
||||
docker/common/build-qt.sh) gives the full recipe that builds the static Qt and the viewer;
|
||||
point it at the modified Qt and rebuild jfjoch_viewer.
|
||||
* The corresponding source code for the exact version of Qt used can be obtained from
|
||||
https://download.qt.io/ (and from https://code.qt.io/). The Qt version is reported in
|
||||
the viewer's Help > About dialog.
|
||||
https://download.qt.io/ (the Linux build fetches
|
||||
https://download.qt.io/official_releases/qt/6.11/6.11.1/single/qt-everywhere-src-6.11.1.tar.xz)
|
||||
and from https://code.qt.io/. The Qt version is reported in the viewer's Help > About dialog.
|
||||
|
||||
Full license texts:
|
||||
* LGPL-3.0: see licenses/Qt6-LGPL-3.0.txt (verbatim GNU Lesser General Public License v3),
|
||||
@@ -5582,6 +5993,41 @@ Full license texts:
|
||||
* GPL-3.0 (the base license that LGPL-3.0 extends) is included in the top-level LICENSE
|
||||
file of this distribution and in licenses/slsDetectorPackage-GPL-3.0.txt.</pre>
|
||||
<hr>
|
||||
<h2 id="rapidjson">rapidjson</h2>
|
||||
<pre>Tencent is pleased to support the open source community by making RapidJSON available.
|
||||
|
||||
Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
|
||||
|
||||
Licensed under the MIT License (the "License"); you may not use this file except
|
||||
in compliance with the License. You may obtain a copy of the License at
|
||||
|
||||
http://opensource.org/licenses/MIT
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software distributed
|
||||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations under the License.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
The MIT License, which the notice above refers to (http://opensource.org/licenses/MIT):
|
||||
|
||||
Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
||||
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
|
||||
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</pre>
|
||||
<hr>
|
||||
<h2 id="sajson">sajson</h2>
|
||||
<pre>Copyright (c) 2012-2017 Chad Austin
|
||||
|
||||
@@ -6476,6 +6922,218 @@ apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.</pre>
|
||||
<hr>
|
||||
<h2 id="slsDetectorPackage-md5-Apache-2.0">slsDetectorPackage-md5-Apache-2.0</h2>
|
||||
<pre>Valid-License-Identifier: Apache-2.0
|
||||
SPDX-URL: https://spdx.org/licenses/Apache-2.0.html
|
||||
Usage-Guide:
|
||||
To use this license in source code, put one of the following SPDX
|
||||
tag/value pairs into a comment according to the placement
|
||||
guidelines in the licensing rules documentation.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
License-Text:
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.</pre>
|
||||
<hr>
|
||||
<h2 id="spdlog">spdlog</h2>
|
||||
<pre>The MIT License (MIT)
|
||||
|
||||
@@ -6544,6 +7202,47 @@ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
------------------------------------------------------------------------------</pre>
|
||||
<hr>
|
||||
<h2 id="stb_sprintf">stb_sprintf</h2>
|
||||
<pre>------------------------------------------------------------------------------
|
||||
This software is available under 2 licenses -- choose whichever you prefer.
|
||||
------------------------------------------------------------------------------
|
||||
ALTERNATIVE A - MIT License
|
||||
Copyright (c) 2017 Sean Barrett
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
------------------------------------------------------------------------------
|
||||
ALTERNATIVE B - Public Domain (www.unlicense.org)
|
||||
This is free and unencumbered software released into the public domain.
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
|
||||
software, either in source code form or as a compiled binary, for any purpose,
|
||||
commercial or non-commercial, and by any means.
|
||||
In jurisdictions that recognize copyright laws, the author or authors of this
|
||||
software dedicate any and all copyright interest in the software to the public
|
||||
domain. We make this dedication for the benefit of the public at large and to
|
||||
the detriment of our heirs and successors. We intend this dedication to be an
|
||||
overt act of relinquishment in perpetuity of all present and future rights to
|
||||
this software under copyright law.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
------------------------------------------------------------------------------</pre>
|
||||
<hr>
|
||||
<h2 id="tf-psa-crypto">tf-psa-crypto</h2>
|
||||
<pre>TF-PSA-Crypto files are provided under a dual [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html)
|
||||
OR [GPL-2.0-or-later](https://spdx.org/licenses/GPL-2.0-or-later.html) license.
|
||||
@@ -8099,25 +8798,6 @@ POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS</pre>
|
||||
<hr>
|
||||
<h2 id="xilinx-hls-headers">Xilinx HLS arbitrary-precision headers</h2>
|
||||
<pre>Source of the headers:
|
||||
https://github.com/Xilinx/HLS_arbitrary_Precision_Types
|
||||
xilinx_hls_lib_2022_1.tgz (in Vitis HLS 2022.1)
|
||||
|
||||
Copyright 2011-2019 Xilinx, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.</pre>
|
||||
<hr>
|
||||
<h2 id="zlib">zlib</h2>
|
||||
<pre>(C) 1995-2024 Jean-loup Gailly and Mark Adler
|
||||
|
||||
|
||||
Reference in new issue
Block a user