Marcelina Kościelnicka
dc18bf1969
opt_expr: Fix handling of $_XNOR_ cells with A = B.
...
Fixes #2311 .
2020-07-29 12:41:43 +02:00
Marcelina Kościelnicka
31d6107521
pmux2shift: Refactor to use FfInitVals.
2020-07-24 11:22:31 +02:00
Marcelina Kościelnicka
4d9105ccb0
wreduce: Refactor to use FfInitVals.
2020-07-24 11:22:31 +02:00
Marcelina Kościelnicka
61a7ec4768
opt_merge: Dedup one more use of FF cell type list.
2020-07-15 06:19:18 +02:00
Marcelina Kościelnicka
7afcb72c98
opt_expr: Fix crash on $mul optimization with more zeros removed than Y has.
...
Fixes #2221 .
2020-07-05 06:31:58 +02:00
Marcelina Kościelnicka
77b15dd8e9
opt_merge: use the master FF type list
2020-06-30 20:57:35 +02:00
clairexen
c7d71f436d
Merge pull request #2168 from whitequark/assert-unused-exprs
...
Use (and ignore) the expression provided to log_assert in NDEBUG builds
2020-06-25 18:21:51 +02:00
Marcelina Kościelnicka
119f79d8b9
Add support for new FF types in some opt passes.
2020-06-23 15:40:02 +02:00
whitequark
118e4caa37
Remove YS_ATTRIBUTE(unused) where present just for log_assert()/log_debug().
2020-06-19 15:48:58 +00:00
whitequark
7191dd16f9
Use C++11 final/override keywords.
2020-06-18 23:34:52 +00:00
Claire Wolf
3c7122c378
Do not optimize away FFs in "prep" and Verific fron-end
...
Signed-off-by: Claire Wolf <claire@symbioticeda.com>
2020-06-09 15:54:14 +02:00
Xiretza
edd8ff2c07
Add flooring division operator
...
The $div and $mod cells use truncating division semantics (rounding
towards 0), as defined by e.g. Verilog. Another rounding mode, flooring
(rounding towards negative infinity), can be used in e.g. VHDL. The
new $divfloor cell provides this flooring division.
This commit also fixes the handling of $div in opt_expr, which was
previously optimized as if it was $divfloor.
2020-05-28 22:59:04 +02:00
Xiretza
17163cf43a
Add flooring modulo operator
...
The $div and $mod cells use truncating division semantics (rounding
towards 0), as defined by e.g. Verilog. Another rounding mode, flooring
(rounding towards negative infinity), can be used in e.g. VHDL. The
new $modfloor cell provides this flooring modulo (also known as "remainder"
in several languages, but this name is ambiguous).
This commit also fixes the handling of $mod in opt_expr, which was
previously optimized as if it was $modfloor.
2020-05-28 22:59:03 +02:00
Eddie Hung
7b3a4a1fff
opt_expr: Sx to Sz; spotted by @Xiretza
2020-05-14 12:14:23 -07:00
Eddie Hung
73b7ea713c
Merge pull request #1994 from YosysHQ/eddie/fix_bug1758
...
opt_expr: improve single-bit $and/$or/$xor/$xnor cells; gate cells too
2020-05-14 11:56:22 -07:00
Eddie Hung
cd92a706ae
Fix whitespace
2020-05-14 09:51:17 -07:00
Eddie Hung
5be4b00a0d
opt_clean: improve warning message
2020-05-14 00:59:38 -07:00
Eddie Hung
fc9fb09a91
opt_clean: rminit without -purge; also remove if consistent with const..
...
warn otherwise
2020-05-14 00:31:08 -07:00
Eddie Hung
68b31f5e99
opt_clean: really make 'clean' identical to 'opt_clean' by rminit too
2020-05-14 00:31:08 -07:00
Eddie Hung
9694dc42dd
opt_expr: consume_x to require/imply !keepdc
2020-05-08 11:12:43 -07:00
Eddie Hung
17f4e06247
opt_expr: restore consume_x; use for coarse grained too
2020-05-08 11:07:44 -07:00
Claire Wolf
2285cf1219
Fix the other "opt_expr -fine" bug introduced in 213a89558
...
Signed-off-by: Claire Wolf <claire@symbioticeda.com>
2020-05-02 21:50:43 +02:00
Claire Wolf
8ee32adac3
Fix "opt_expr -fine" bug introduced in 213a89558
...
Signed-off-by: Claire Wolf <claire@symbioticeda.com>
2020-05-01 20:12:16 +02:00
Eddie Hung
b5f38f8342
opt_expr: const_xnor replacement to pad Y with 1'b1
2020-04-24 14:13:45 -07:00
Eddie Hung
83570bc0da
opt_expr: more fixes for $xor/$xnor
2020-04-24 11:15:29 -07:00
Eddie Hung
90b71eb84b
opt_expr: do not group by X, more fixes
2020-04-23 18:15:07 -07:00
Eddie Hung
e7058593f4
opt_expr: improve single-bit $and/$or/$xor/$xnor cells; gate cells too
2020-04-23 15:57:48 -07:00
Marcelina Kościelnicka
2f8541a92e
opt_expr: Fix X and CO outputs for $alu identity-mapping rules.
2020-04-16 11:48:29 +02:00
Marcelina Kościelnicka
85166633bc
opt_clean: Add missing assignments to opt.did_something.
2020-04-15 16:20:56 +02:00
Marcelina Kościelnicka
6c16fd760b
opt_expr: Add more $alu optimizations.
...
Detect the places in the $alu where the carry bit is constant (due to
const A[i] == B[i] ^ BI) and split it into smaller $alu at these points.
Also, make the existing const-carry detection for low bits more generic
(now handles cases where both BI and CI are constant, but not equal to
one another).
Fixes #1912 .
2020-04-14 21:48:13 +02:00
Marcelina Kościelnicka
840bb17089
opt_expr: Optimize multiplications with low 0 bits in operands.
...
Fixes #1500 .
2020-04-13 16:52:22 +02:00
Marcelina Kościelnicka
516857f3ba
[NFCI] Deduplicate builtin FF cell types list
...
A few passes included the same list of FF cell types. Make it a global
const instead.
The zinit pass also seems to include a list like that, but given that
it seems to be completely broken at the time (see #1568 discussion),
I'm going to pretend I didn't see that.
2020-04-09 18:05:06 +02:00
Eddie Hung
956ecd48f7
kernel: big fat patch to use more ID::*, otherwise ID(*)
2020-04-02 09:51:32 -07:00
Eddie Hung
37f42fe102
Merge pull request #1845 from YosysHQ/eddie/kernel_speedup
...
kernel: speedup by using more pass-by-const-ref
2020-04-02 07:13:33 -07:00
Eddie Hung
c90324662c
Merge pull request #1828 from YosysHQ/eddie/celltypes_speedup
...
kernel: share a single CellTypes within a pass
2020-04-01 14:17:45 -07:00
Eddie Hung
4ae7f3a8ed
Merge pull request #1790 from YosysHQ/eddie/opt_expr_xor
...
opt_expr: optimise $xor/$xnor/$_XOR_/$_XNOR_ -s with constant inputs
2020-04-01 14:17:01 -07:00
Eddie Hung
e79bc45975
Merge pull request #1789 from YosysHQ/eddie/opt_expr_alu
...
opt_expr: improve performance on $alu and $sub
2020-04-01 14:11:09 -07:00
Eddie Hung
4d897975a8
Code review fixes
2020-03-30 08:22:46 -07:00
Eddie Hung
f64d59d824
Apply suggestions from code review
...
Co-Authored-By: Alberto Gonzalez <61295559+boqwxp@users.noreply.github.com>
2020-03-30 08:19:56 -07:00
Eddie Hung
d40f12252b
kernel: clear some more ShareWorker state
2020-03-26 15:05:45 -07:00
Eddie Hung
0c0dc4ffc3
opt_expr: fix failing $xnor test
2020-03-20 14:39:08 -07:00
Eddie Hung
af16ca9dd4
opt_expr: fix missing brace
2020-03-20 09:17:53 -07:00
Eddie Hung
01f9aabc2f
opt_expr: extend to $xnor and $_XNOR_
2020-03-19 16:56:39 -07:00
Eddie Hung
ee5995641e
opt_expr: optimise 1-bit $xor or $_XOR_ with constant input
2020-03-19 16:33:54 -07:00
Eddie Hung
8d1fa0e3b9
opt_expr: remove redundant
2020-03-19 14:34:27 -07:00
Eddie Hung
213a895589
opt_expr: optimise $sub when both A[i] and B[i] == 1'b1
2020-03-19 14:34:10 -07:00
Eddie Hung
a8e5d0c402
opt_expr: optimise for identity $alu-s just like $add/$sub
2020-03-19 14:24:55 -07:00
Eddie Hung
7ad7f41bc5
kernel: share a single CellTypes within a pass
2020-03-18 12:21:40 -07:00
Eddie Hung
cdf17c4455
opt_merge: unordered_map -> dict as per @cliffordwolf review
2020-03-16 12:44:33 -07:00
Eddie Hung
9f30d7f843
opt_merge: speedup
2020-03-16 12:43:54 -07:00
Eddie Hung
432a09af80
kernel: SigSpec use more const& + overloads to prevent implicit SigSpec
2020-03-13 08:17:39 -07:00
Eddie Hung
de3e5fcdc6
ystests: fix write_smt2_write_smt2_cyclic_dependency_fail
2020-02-28 12:33:55 -08:00
Eddie Hung
1d401a7991
clean: ignore specify-s inside cells when determining whether to keep
2020-02-19 10:45:10 -08:00
Eddie Hung
505557e93e
Merge pull request #1576 from YosysHQ/eddie/opt_merge_init
...
opt_merge: discard \init of '$' cells with 'Q' port when merging
2020-02-05 14:56:26 -08:00
Marcelina Kościelnicka
34d2fbd2f9
Add opt_lut_ins pass. ( #1673 )
2020-02-03 14:57:17 +01:00
Claire Wolf
1679682fa3
Merge branch 'vector_fix' of https://github.com/Kmanfi/yosys
...
Also some minor fixes to the original PR.
2020-01-29 17:01:24 +01:00
Eddie Hung
a855f23f22
Merge remote-tracking branch 'origin/master' into eddie/opt_merge_init
2020-01-28 12:46:18 -08:00
David Shah
6fd9cae5ca
opt_reduce: Call check() per run rather than per optimised cell
...
Signed-off-by: David Shah <dave@ds0.me>
2020-01-28 09:42:01 +00:00
Eddie Hung
f5e0a07ad6
Add $_FF_ and $_SR* courtesy of @mwkmwkmwk
2019-12-20 13:00:04 -08:00
Eddie Hung
d038cea3c7
More stringent check for flop cells
2019-12-20 12:32:00 -08:00
Alyssa Milburn
e709fd3da1
Fix opt_expr.eqneq.cmpzero debug print
2019-12-15 20:40:38 +01:00
Eddie Hung
83d36394f8
opt_merge to discard \init of '$' cells with 'Q' port when merging
2019-12-13 10:26:37 -08:00
Marcin Kościelnicki
fdcbda195b
opt_share: Fix handling of fine cells.
...
Fixes #1525 .
2019-11-27 08:01:07 +01:00
Clifford Wolf
03fb92ed6f
Add "opt_mem" pass
...
Signed-off-by: Clifford Wolf <clifford@clifford.at>
2019-11-22 17:45:22 +01:00
David Shah
f5804a84fd
wreduce: Don't trim zeros or sext when not matching ARST_VALUE
...
Signed-off-by: David Shah <dave@ds0.me>
2019-11-14 18:43:15 +00:00
Clifford Wolf
a67d63714b
Fix handling of z_digit "?" and fix optimization of cmp with "z"
...
Signed-off-by: Clifford Wolf <clifford@clifford.at>
2019-09-13 13:39:39 +02:00
Sean Cross
8d128ba6d0
passes: opt_share: don't statically initialize mergeable_type_map
...
In 3d3779b037
this got turned from a
`std::map<std::string, std::string>` to `std::map<IdString, IdString>`.
Consequently, this exposed some initialization sequencing issues (#1361 ).
Only initialize the map when it's first used, to avoid these static issues.
This fixes #1361 .
Signed-off-by: Sean Cross <sean@xobs.io>
2019-09-09 12:40:01 +08:00
Eddie Hung
9245f0d3f5
Copy-paste typo
2019-08-22 08:43:44 -07:00
Eddie Hung
6f971470f8
Respect opt_expr -keepdc as per @cliffordwolf
2019-08-22 08:37:27 -07:00
Eddie Hung
379f33af54
Handle $shift and Y_WIDTH > 1 as per @cliffordwolf
2019-08-22 08:22:23 -07:00
Eddie Hung
9e31f01b34
Add cover()
2019-08-22 08:06:24 -07:00
Eddie Hung
d0ffe7544c
Canonical form
2019-08-22 08:05:01 -07:00
Eddie Hung
d3a212ff91
opt_expr to trim A port of $shiftx if Y_WIDTH == 1
2019-08-21 21:53:55 -07:00
Eddie Hung
f42ba811b6
ID({A,B,Y}) -> ID::{A,B,Y} for opt_share.cc
2019-08-19 10:11:47 -07:00
Clifford Wolf
2a78a1fd00
Merge pull request #1283 from YosysHQ/clifford/fix1255
...
Fix various NDEBUG compiler warnings
2019-08-17 15:07:16 +02:00
Clifford Wolf
ae5d8dc939
Merge pull request #1303 from YosysHQ/bogdanvuk/opt_share
...
Implement opt_share from @bogdanvuk
2019-08-17 15:03:46 +02:00
Eddie Hung
3d3779b037
Use ID() macro
2019-08-16 14:01:55 -07:00
Eddie Hung
fab067cece
Add 'opt_share' to 'opt -full'
2019-08-16 13:47:37 -07:00
Eddie Hung
51d28645da
Merge https://github.com/bogdanvuk/yosys into bogdanvuk/opt_share
2019-08-16 13:40:29 -07:00
Eddie Hung
29e14e674e
Remove `using namespace RTLIL;`
2019-08-16 19:36:45 +00:00
Eddie Hung
eae5a6b12c
Use ID::keep more liberally too
2019-08-15 14:51:12 -07:00
Eddie Hung
52355f5185
Use more ID::{A,B,Y,blackbox,whitebox}
2019-08-15 14:50:10 -07:00
Clifford Wolf
49301b733e
Merge branch 'master' into clifford/fix1255
2019-08-15 22:44:38 +02:00
Eddie Hung
6cd8cace0c
Fix
2019-08-15 11:25:42 -07:00
Eddie Hung
467c34eff0
Convert a few more to ID
2019-08-15 10:24:35 -07:00
Clifford Wolf
85b0b2c589
Merge branch 'master' into clifford/ids
2019-08-15 10:22:59 +02:00
Clifford Wolf
0c5db07cd6
Fix various NDEBUG compiler warnings, closes #1255
...
Signed-off-by: Clifford Wolf <clifford@clifford.at>
2019-08-13 13:29:03 +02:00
Eddie Hung
88d5185596
Merge remote-tracking branch 'origin/master' into eddie/fix_1262
2019-08-11 21:13:40 -07:00
Clifford Wolf
6995914f3f
Use ID() macro in all of passes/opt/
...
This was obtained by running the following SED command in passes/opt/
and then using "meld foo.cc foo.cc.orig" to manually fix all resulting
compiler errors.
sed -i.orig -r 's/"\\\\([a-zA-Z0-9_]+)"/ID(\1)/g; s/"(\$[a-zA-Z0-9_]+)"/ID(\1)/g;' *.cc
Signed-off-by: Clifford Wolf <clifford@clifford.at>
2019-08-11 11:39:46 +02:00
Eddie Hung
282cc77604
Wrong way around
2019-08-10 11:55:00 -07:00
Eddie Hung
02b0d328ad
cover_list -> cover as per @cliffordwolf
2019-08-10 08:26:41 -07:00
Clifford Wolf
f54bf1631f
Merge pull request #1258 from YosysHQ/eddie/cleanup
...
Cleanup a few barnacles across codebase
2019-08-10 09:52:14 +02:00
Eddie Hung
849e0eeab4
Grammar
2019-08-09 12:43:21 -07:00
Eddie Hung
31f6d74552
Separate $alu handling
2019-08-09 12:13:32 -07:00
Eddie Hung
9f1b82f594
opt_expr -fine to trim LSBs of $alu too
2019-08-09 10:32:12 -07:00
Eddie Hung
f69410daaf
opt_lut to ignore LUT cells, or those that drive bits, with (* keep *)
2019-08-07 13:15:02 -07:00
Eddie Hung
6d77236f38
substr() -> compare()
2019-08-07 12:20:08 -07:00
Eddie Hung
7164996921
RTLIL::S{0,1} -> State::S{0,1}
2019-08-07 11:12:38 -07:00
Eddie Hung
e6d5147214
Merge remote-tracking branch 'origin/master' into eddie/cleanup
2019-08-07 11:11:50 -07:00
Eddie Hung
48d0f99406
stoi -> atoi
2019-08-07 11:09:17 -07:00
Bogdan Vukobratovic
067b44938c
Fix wrong results when opt_share called before opt_clean
2019-08-07 09:30:58 +02:00
Eddie Hung
c11ad24fd7
Use std::stoi instead of atoi(<str>.c_str())
2019-08-06 16:45:48 -07:00
Eddie Hung
e38f40af5b
Use IdString::begins_with()
2019-08-06 16:42:25 -07:00
Eddie Hung
3486235338
Make liberal use of IdString.in()
2019-08-06 16:18:18 -07:00
Eddie Hung
43081337fa
Cleanup opt_expr.cc
2019-08-06 16:04:21 -07:00
Eddie Hung
bfc7164af7
Move LSB-trimming functionality from wreduce to opt_expr
2019-08-06 15:25:50 -07:00
Eddie Hung
26cb3e7afc
Merge remote-tracking branch 'origin/master' into eddie/wreduce_add
2019-08-06 14:50:00 -07:00
Bogdan Vukobratovic
6a796accc0
Support various binary operators in opt_share
2019-08-04 19:06:38 +02:00
Bogdan Vukobratovic
280c4e7794
Fix spacing in opt_share tests, change wording in opt_share help
2019-08-03 12:28:46 +02:00
Miodrag Milanovic
28b7053a01
Fix formatting for msys2 mingw build using GetSize
2019-08-01 17:27:34 +02:00
Bogdan Vukobratovic
c075486c59
Reimplement opt_share to work on $alu and $pmux
2019-07-28 16:03:54 +02:00
Bogdan Vukobratovic
07c4a7d438
Implement opt_share
...
This pass identifies arithmetic operators that share an operand and whose
results are used in mutually exclusive cases controlled by a multiplexer, and
merges them together by multiplexing the other operands
2019-07-26 11:36:48 +02:00
Eddie Hung
09beeee38a
Try and fix again
2019-07-19 14:40:57 -07:00
Eddie Hung
cb0fd05215
Do not access beyond bounds
2019-07-19 13:58:50 -07:00
Eddie Hung
3a87dc3524
Wrap A and B in sigmap
2019-07-19 13:23:07 -07:00
Eddie Hung
31b0002e8c
Remove "top" from message
2019-07-19 13:20:45 -07:00
Eddie Hung
bcd8027182
Also optimise MSB of $sub
2019-07-19 13:11:48 -07:00
Eddie Hung
fc0e36d1c0
wreduce for $sub
2019-07-19 12:50:21 -07:00
whitequark
2de7e92bb8
opt_lut: make less chatty.
2019-07-13 16:49:56 +00:00
Eddie Hung
713337255e
Revert "Add "synth -keepdc" option"
2019-07-09 10:14:23 -07:00
Eddie Hung
37b58f4324
Clarify 'wreduce -keepdc' doc
2019-07-08 19:15:07 -07:00
Clifford Wolf
1c7ce251f3
Merge pull request #1046 from bogdanvuk/master
...
Optimizing DFFs whose initial value prevents their value from changing
2019-06-28 08:30:18 +02:00
Bogdan Vukobratovic
3225bfb984
Add help for "-sat" option inside opt_rmdff. "opt" can pass "-sat" too
2019-06-27 22:06:23 +02:00
Bogdan Vukobratovic
35fa7b3057
Fix memory leak when one of multiple DFF cells is removed in opt_rmdff
...
When there are multiple DFFs and one of them is removed, its reference lingers
inside bit2driver dict. While invoking handle_dff() function for other DFFs,
this broken reference is used isnside sat_import_cell() function.
2019-06-27 22:02:12 +02:00
Bogdan Vukobratovic
0f32cb4e0a
Merge remote-tracking branch 'upstream/master'
2019-06-27 12:11:47 +02:00
Clifford Wolf
7c14678ec0
Add "pmux2shiftx -norange", fixes #1135
...
Signed-off-by: Clifford Wolf <clifford@clifford.at>
2019-06-27 10:59:12 +02:00
Clifford Wolf
0b7d648c6a
Improve opt_clean handling of unused public wires
...
Signed-off-by: Clifford Wolf <clifford@clifford.at>
2019-06-26 17:54:17 +02:00
Clifford Wolf
8e9ef891fe
Do not clean up buffer cells with "keep" attribute, closes #1128
...
Signed-off-by: Clifford Wolf <clifford@clifford.at>
2019-06-26 11:01:03 +02:00
Eddie Hung
545cfbbe0d
Cope with $reduce_or common in case
2019-06-21 12:31:14 -07:00
Eddie Hung
15535112b7
Fix spacing
2019-06-21 11:52:51 -07:00
Eddie Hung
d89d663c92
Add doc
2019-06-21 11:52:28 -07:00
Eddie Hung
641b86d25f
Fix up ExclusiveDatabase with @cliffordwolf's help
2019-06-21 11:45:31 -07:00
Clifford Wolf
2454ad99bf
Refactor "opt_rmdff -sat"
...
Signed-off-by: Clifford Wolf <clifford@clifford.at>
2019-06-20 13:44:21 +02:00
Bogdan Vukobratovic
8451cbea89
Move netlist helper module to passes/opt for the time being
2019-06-14 12:14:02 +02:00
Bogdan Vukobratovic
fe651922cb
Merge remote-tracking branch 'upstream/master'
2019-06-14 12:06:57 +02:00
Bogdan Vukobratovic
53695e6729
Prepare for situation when port of the signal cannot be found
2019-06-14 11:39:24 +02:00
Bogdan Vukobratovic
291b36afeb
Some cleanup, revert sat.cc
2019-06-14 11:35:45 +02:00
Bogdan Vukobratovic
8665f48879
Implement disconnection of constant register bits
2019-06-13 19:35:37 +02:00
Bogdan Vukobratovic
d69989b8d2
Rename satgen_algo.h -> algo.h, code cleanup and refactoring
2019-06-12 19:35:05 +02:00
Bogdan Vukobratovic
9892df17ef
Generate satgen instance instead of calling sat pass
2019-06-11 11:47:13 +02:00
Eddie Hung
5b999ae68d
Elaborate muxpack doc
2019-06-10 10:32:19 -07:00
Eddie Hung
f705f6a0b5
Comment O(N) -> O(N^2)
2019-06-07 15:39:12 -07:00
Eddie Hung
ba52d9b471
Extend ExclusiveDatabase to query SigSpec-s (for $pmux)
2019-06-07 15:34:16 -07:00
Eddie Hung
9b408838f1
Add ExclusiveDatabase to check exclusive $eq/$logic_not cell results
2019-06-07 14:18:17 -07:00
Eddie Hung
887df8914c
Resolve @cliffordwolf comment on redundant check
2019-06-07 11:37:52 -07:00
Eddie Hung
5ab59cd59e
Resolve @cliffordwolf comment on sigmap
2019-06-07 11:36:19 -07:00
Eddie Hung
5c277c6325
Fix and test for balanced case
2019-06-06 14:21:34 -07:00
Eddie Hung
ccdf989025
Support cascading $pmux.A with $mux.A and $mux.B
2019-06-06 13:51:22 -07:00
Eddie Hung
dc7b8c4b94
More cleanup
2019-06-06 12:56:34 -07:00
Eddie Hung
978fda94f6
Fix spacing
2019-06-06 12:46:42 -07:00