mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-20 12:53:39 +00:00
Merge upstream
This commit is contained in:
commit
993b23e747
6 changed files with 52 additions and 24 deletions
1
.github/workflows/test-build.yml
vendored
1
.github/workflows/test-build.yml
vendored
|
@ -86,6 +86,7 @@ jobs:
|
||||||
if: needs.pre_job.outputs.should_skip != 'true'
|
if: needs.pre_job.outputs.should_skip != 'true'
|
||||||
env:
|
env:
|
||||||
CC: clang
|
CC: clang
|
||||||
|
UBSAN_OPTIONS: halt_on_error=1
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-latest]
|
os: [ubuntu-latest, macos-latest]
|
||||||
|
|
|
@ -2936,7 +2936,10 @@ bool AstNode::simplify(bool const_fold, int stage, int width_hint, bool sign_hin
|
||||||
lsb_expr->children[stride_ix]->detectSignWidth(stride_width, stride_sign);
|
lsb_expr->children[stride_ix]->detectSignWidth(stride_width, stride_sign);
|
||||||
max_width = std::max(i_width, stride_width);
|
max_width = std::max(i_width, stride_width);
|
||||||
// Stride width calculated from actual stride value.
|
// Stride width calculated from actual stride value.
|
||||||
stride_width = std::ceil(std::log2(std::abs(stride)));
|
if (stride == 0)
|
||||||
|
stride_width = 0;
|
||||||
|
else
|
||||||
|
stride_width = std::ceil(std::log2(std::abs(stride)));
|
||||||
|
|
||||||
if (i_width + stride_width > max_width) {
|
if (i_width + stride_width > max_width) {
|
||||||
// For (truncated) i*stride to be within the range of dst, the following must hold:
|
// For (truncated) i*stride to be within the range of dst, the following must hold:
|
||||||
|
|
|
@ -253,13 +253,13 @@ void shift_op(AbstractCellEdgesDatabase *db, RTLIL::Cell *cell)
|
||||||
if (a_width == 1 && is_signed) {
|
if (a_width == 1 && is_signed) {
|
||||||
int skip = 1 << (k + 1);
|
int skip = 1 << (k + 1);
|
||||||
int base = skip -1;
|
int base = skip -1;
|
||||||
if (i % skip != base && i - a_width + 2 < 1 << b_width)
|
if (i % skip != base && i - a_width + 2 < 1 << b_width_capped)
|
||||||
db->add_edge(cell, ID::B, k, ID::Y, i, -1);
|
db->add_edge(cell, ID::B, k, ID::Y, i, -1);
|
||||||
} else if (is_signed) {
|
} else if (is_signed) {
|
||||||
if (i - a_width + 2 < 1 << b_width)
|
if (i - a_width + 2 < 1 << b_width_capped)
|
||||||
db->add_edge(cell, ID::B, k, ID::Y, i, -1);
|
db->add_edge(cell, ID::B, k, ID::Y, i, -1);
|
||||||
} else {
|
} else {
|
||||||
if (i - a_width + 1 < 1 << b_width)
|
if (i - a_width + 1 < 1 << b_width_capped)
|
||||||
db->add_edge(cell, ID::B, k, ID::Y, i, -1);
|
db->add_edge(cell, ID::B, k, ID::Y, i, -1);
|
||||||
}
|
}
|
||||||
// right shifts
|
// right shifts
|
||||||
|
|
42
libs/fst/00_PATCH_strict_alignment.patch
Normal file
42
libs/fst/00_PATCH_strict_alignment.patch
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
diff --git a/fastlz.cc b/fastlz.cc
|
||||||
|
index 3272ca7a8..41ea27a16 100644
|
||||||
|
--- a/fastlz.cc
|
||||||
|
+++ b/fastlz.cc
|
||||||
|
@@ -60,24 +60,9 @@
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
- * Prevent accessing more than 8-bit at once, except on x86 architectures.
|
||||||
|
+ * Yosys patch: do not do unaligned accesses on any platform
|
||||||
|
*/
|
||||||
|
-#if !defined(FASTLZ_STRICT_ALIGN)
|
||||||
|
#define FASTLZ_STRICT_ALIGN
|
||||||
|
-#if defined(__i386__) || defined(__386) /* GNU C, Sun Studio */
|
||||||
|
-#undef FASTLZ_STRICT_ALIGN
|
||||||
|
-#elif defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(__amd64) /* GNU C */
|
||||||
|
-#undef FASTLZ_STRICT_ALIGN
|
||||||
|
-#elif defined(_M_IX86) /* Intel, MSVC */
|
||||||
|
-#undef FASTLZ_STRICT_ALIGN
|
||||||
|
-#elif defined(__386)
|
||||||
|
-#undef FASTLZ_STRICT_ALIGN
|
||||||
|
-#elif defined(_X86_) /* MinGW */
|
||||||
|
-#undef FASTLZ_STRICT_ALIGN
|
||||||
|
-#elif defined(__I86__) /* Digital Mars */
|
||||||
|
-#undef FASTLZ_STRICT_ALIGN
|
||||||
|
-#endif
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
/* prototypes */
|
||||||
|
int fastlz_compress(const void* input, int length, void* output);
|
||||||
|
@@ -88,11 +73,7 @@ int fastlz_decompress(const void* input, int length, void* output, int maxout);
|
||||||
|
#define MAX_LEN 264 /* 256 + 8 */
|
||||||
|
#define MAX_DISTANCE 8192
|
||||||
|
|
||||||
|
-#if !defined(FASTLZ_STRICT_ALIGN)
|
||||||
|
-#define FASTLZ_READU16(p) *((const flzuint16*)(p))
|
||||||
|
-#else
|
||||||
|
#define FASTLZ_READU16(p) ((p)[0] | (p)[1]<<8)
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
#define HASH_LOG 13
|
||||||
|
#define HASH_SIZE (1<< HASH_LOG)
|
|
@ -17,3 +17,4 @@ sed -i -e 's,"fastlz.c","fastlz.cc",' *.cc *.h
|
||||||
|
|
||||||
patch -p0 < 00_PATCH_win_zlib.patch
|
patch -p0 < 00_PATCH_win_zlib.patch
|
||||||
patch -p0 < 00_PATCH_win_io.patch
|
patch -p0 < 00_PATCH_win_io.patch
|
||||||
|
patch -p1 < 00_PATCH_strict_alignment.patch
|
||||||
|
|
|
@ -60,24 +60,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Prevent accessing more than 8-bit at once, except on x86 architectures.
|
* Yosys patch: do not do unaligned accesses on any platform
|
||||||
*/
|
*/
|
||||||
#if !defined(FASTLZ_STRICT_ALIGN)
|
|
||||||
#define FASTLZ_STRICT_ALIGN
|
#define FASTLZ_STRICT_ALIGN
|
||||||
#if defined(__i386__) || defined(__386) /* GNU C, Sun Studio */
|
|
||||||
#undef FASTLZ_STRICT_ALIGN
|
|
||||||
#elif defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(__amd64) /* GNU C */
|
|
||||||
#undef FASTLZ_STRICT_ALIGN
|
|
||||||
#elif defined(_M_IX86) /* Intel, MSVC */
|
|
||||||
#undef FASTLZ_STRICT_ALIGN
|
|
||||||
#elif defined(__386)
|
|
||||||
#undef FASTLZ_STRICT_ALIGN
|
|
||||||
#elif defined(_X86_) /* MinGW */
|
|
||||||
#undef FASTLZ_STRICT_ALIGN
|
|
||||||
#elif defined(__I86__) /* Digital Mars */
|
|
||||||
#undef FASTLZ_STRICT_ALIGN
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* prototypes */
|
/* prototypes */
|
||||||
int fastlz_compress(const void* input, int length, void* output);
|
int fastlz_compress(const void* input, int length, void* output);
|
||||||
|
@ -88,11 +73,7 @@ int fastlz_decompress(const void* input, int length, void* output, int maxout);
|
||||||
#define MAX_LEN 264 /* 256 + 8 */
|
#define MAX_LEN 264 /* 256 + 8 */
|
||||||
#define MAX_DISTANCE 8192
|
#define MAX_DISTANCE 8192
|
||||||
|
|
||||||
#if !defined(FASTLZ_STRICT_ALIGN)
|
|
||||||
#define FASTLZ_READU16(p) *((const flzuint16*)(p))
|
|
||||||
#else
|
|
||||||
#define FASTLZ_READU16(p) ((p)[0] | (p)[1]<<8)
|
#define FASTLZ_READU16(p) ((p)[0] | (p)[1]<<8)
|
||||||
#endif
|
|
||||||
|
|
||||||
#define HASH_LOG 13
|
#define HASH_LOG 13
|
||||||
#define HASH_SIZE (1<< HASH_LOG)
|
#define HASH_SIZE (1<< HASH_LOG)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue