From a9fefc6ce1c0c351f88e61ec2a01ec64fc30d28f Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Wed, 10 Jul 2013 12:52:29 +0200 Subject: [PATCH] Bugfixes for empty signal vectors --- passes/opt/opt_const.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/passes/opt/opt_const.cc b/passes/opt/opt_const.cc index 4223ebe3b..34d0f9244 100644 --- a/passes/opt/opt_const.cc +++ b/passes/opt/opt_const.cc @@ -217,6 +217,7 @@ void replace_const_cells(RTLIL::Design *design, RTLIL::Module *module, bool cons assign_map.apply(a); \ if (a.is_fully_const()) { \ a.optimize(); \ + if (a.chunks.empty()) a.chunks.push_back(RTLIL::SigChunk()); \ RTLIL::Const dummy_arg(RTLIL::State::S0, 1); \ RTLIL::SigSpec y(RTLIL::const_ ## _t(a.chunks[0].data, dummy_arg, \ cell->parameters["\\A_SIGNED"].as_bool(), false, \ @@ -232,6 +233,8 @@ void replace_const_cells(RTLIL::Design *design, RTLIL::Module *module, bool cons assign_map.apply(a), assign_map.apply(b); \ if (a.is_fully_const() && b.is_fully_const()) { \ a.optimize(), b.optimize(); \ + if (a.chunks.empty()) a.chunks.push_back(RTLIL::SigChunk()); \ + if (b.chunks.empty()) b.chunks.push_back(RTLIL::SigChunk()); \ RTLIL::SigSpec y(RTLIL::const_ ## _t(a.chunks[0].data, b.chunks[0].data, \ cell->parameters["\\A_SIGNED"].as_bool(), \ cell->parameters["\\B_SIGNED"].as_bool(), \ -- 2.30.2