diff options
author | Jannis Harder <me@jix.one> | 2022-04-25 16:23:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-25 16:23:21 +0200 |
commit | 6ae0b51c76cd9a79c10d6516ef14c54339551ff4 (patch) | |
tree | d7e896512cc6e76217fe786063d9f110cb14e68c | |
parent | e0e31bfc5c4e40a64b96990f8875010202d3ca96 (diff) | |
parent | c7ef0f2932b9857c26cd61d1c93bb477e4e1aa23 (diff) | |
download | yosys-6ae0b51c76cd9a79c10d6516ef14c54339551ff4.tar.gz yosys-6ae0b51c76cd9a79c10d6516ef14c54339551ff4.tar.bz2 yosys-6ae0b51c76cd9a79c10d6516ef14c54339551ff4.zip |
Merge pull request #3287 from jix/smt2-conditional-store
smt2: Make write port array stores conditional on nonzero write mask
-rw-r--r-- | backends/smt2/smt2.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/backends/smt2/smt2.cc b/backends/smt2/smt2.cc index 9bf0de03e..a3628197e 100644 --- a/backends/smt2/smt2.cc +++ b/backends/smt2/smt2.cc @@ -1185,10 +1185,12 @@ struct Smt2Worker data = stringf("(bvor (bvand %s %s) (bvand (select (|%s#%d#%d| state) %s) (bvnot %s)))", data.c_str(), mask.c_str(), get_id(module), arrayid, i, addr.c_str(), mask.c_str()); + string empty_mask(mem->width, '0'); + decls.push_back(stringf("(define-fun |%s#%d#%d| ((state |%s_s|)) (Array (_ BitVec %d) (_ BitVec %d)) " - "(store (|%s#%d#%d| state) %s %s)) ; %s\n", + "(ite (= %s #b%s) (|%s#%d#%d| state) (store (|%s#%d#%d| state) %s %s))) ; %s\n", get_id(module), arrayid, i+1, get_id(module), abits, mem->width, - get_id(module), arrayid, i, addr.c_str(), data.c_str(), get_id(mem->memid))); + mask.c_str(), empty_mask.c_str(), get_id(module), arrayid, i, get_id(module), arrayid, i, addr.c_str(), data.c_str(), get_id(mem->memid))); } } |