aboutsummaryrefslogtreecommitdiffstats
path: root/backends
diff options
context:
space:
mode:
authorKevin Läufer <laeufer@cs.berkeley.edu>2022-06-20 16:39:53 -0700
committerKevin Läufer <laeufer@cs.berkeley.edu>2022-06-20 16:40:46 -0700
commitde5c4bf52320e1c19d79a13fcbe303f590d531c0 (patch)
tree217959aff5dc0f10e98e21afd3ebd2a7b3d21bc6 /backends
parent34804f3fb63d8f576ec614904171c1384839cd73 (diff)
downloadyosys-de5c4bf52320e1c19d79a13fcbe303f590d531c0.tar.gz
yosys-de5c4bf52320e1c19d79a13fcbe303f590d531c0.tar.bz2
yosys-de5c4bf52320e1c19d79a13fcbe303f590d531c0.zip
btor: add support for $pos cell
Diffstat (limited to 'backends')
-rw-r--r--backends/btor/btor.cc19
1 files changed, 11 insertions, 8 deletions
diff --git a/backends/btor/btor.cc b/backends/btor/btor.cc
index 5be9bf324..7dec70545 100644
--- a/backends/btor/btor.cc
+++ b/backends/btor/btor.cc
@@ -446,25 +446,28 @@ struct BtorWorker
goto okay;
}
- if (cell->type.in(ID($not), ID($neg), ID($_NOT_)))
+ if (cell->type.in(ID($not), ID($neg), ID($_NOT_), ID($pos)))
{
string btor_op;
if (cell->type.in(ID($not), ID($_NOT_))) btor_op = "not";
if (cell->type == ID($neg)) btor_op = "neg";
- log_assert(!btor_op.empty());
int width = std::max(GetSize(cell->getPort(ID::A)), GetSize(cell->getPort(ID::Y)));
bool a_signed = cell->hasParam(ID::A_SIGNED) ? cell->getParam(ID::A_SIGNED).as_bool() : false;
-
- int sid = get_bv_sid(width);
int nid_a = get_sig_nid(cell->getPort(ID::A), width, a_signed);
-
- int nid = next_nid++;
- btorf("%d %s %d %d%s\n", nid, btor_op.c_str(), sid, nid_a, getinfo(cell).c_str());
-
SigSpec sig = sigmap(cell->getPort(ID::Y));
+ // the $pos cell just passes through, all other cells need an actual operation applied
+ int nid = nid_a;
+ if (cell->type != ID($pos))
+ {
+ log_assert(!btor_op.empty());
+ int sid = get_bv_sid(width);
+ nid = next_nid++;
+ btorf("%d %s %d %d%s\n", nid, btor_op.c_str(), sid, nid_a, getinfo(cell).c_str());
+ }
+
if (GetSize(sig) < width) {
int sid = get_bv_sid(GetSize(sig));
int nid2 = next_nid++;