diff options
author | Clifford Wolf <clifford@clifford.at> | 2013-06-12 19:09:14 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2013-06-12 19:09:14 +0200 |
commit | bf2c149329b8823157a346301525e952ddf268e0 (patch) | |
tree | 6c333ab532d1b4c18c5dd6831127df8b12183e6b /kernel | |
parent | 4b311b7b99f55ee4bfe43447067b177fb2f90a82 (diff) | |
download | yosys-bf2c149329b8823157a346301525e952ddf268e0.tar.gz yosys-bf2c149329b8823157a346301525e952ddf268e0.tar.bz2 yosys-bf2c149329b8823157a346301525e952ddf268e0.zip |
Another fix for a bug found using xsthammer
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/satgen.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/satgen.h b/kernel/satgen.h index fcbdcc147..05afeabf5 100644 --- a/kernel/satgen.h +++ b/kernel/satgen.h @@ -92,6 +92,15 @@ struct SatGen vec_y.push_back(ez->literal()); } + void extendSignalWidthUnary(std::vector<int> &vec_a, std::vector<int> &vec_y, RTLIL::Cell *cell) + { + bool is_signed = cell->parameters.count("\\A_SIGNED") > 0 && cell->parameters["\\A_SIGNED"].as_bool(); + while (vec_a.size() < vec_y.size()) + vec_a.push_back(is_signed && vec_a.size() > 0 ? vec_a.back() : ez->FALSE); + while (vec_y.size() < vec_a.size()) + vec_y.push_back(ez->literal()); + } + bool importCell(RTLIL::Cell *cell, int timestep = -1) { if (cell->type == "$_AND_" || cell->type == "$_OR_" || cell->type == "$_XOR_" || @@ -151,6 +160,7 @@ struct SatGen if (cell->type == "$pos" || cell->type == "$neg") { std::vector<int> a = importSigSpec(cell->connections.at("\\A"), timestep); std::vector<int> y = importSigSpec(cell->connections.at("\\Y"), timestep); + extendSignalWidthUnary(a, y, cell); if (cell->type == "$pos") { ez->assume(ez->vec_eq(a, y)); } else { |