wire->width = result_width;
current_module->wires[wire->name] = wire;
- RTLIL::SigChunk chunk;
- chunk.wire = wire;
- chunk.width = wire->width;
- chunk.offset = 0;
-
- RTLIL::SigSpec sig;
- sig.chunks().push_back(chunk);
- sig.size() = chunk.width;
-
if (gen_attributes)
for (auto &attr : that->attributes) {
if (attr.second->type != AST_CONSTANT)
cell->connections["\\A"] = arg;
cell->parameters["\\Y_WIDTH"] = result_width;
- cell->connections["\\Y"] = sig;
- return sig;
+ cell->connections["\\Y"] = wire;
+ return wire;
}
// helper function for extending bit width (preferred over SigSpec::extend() because of correct undef propagation in ConstEval)
wire->width = width;
current_module->wires[wire->name] = wire;
- RTLIL::SigChunk chunk;
- chunk.wire = wire;
- chunk.width = wire->width;
- chunk.offset = 0;
-
- RTLIL::SigSpec new_sig;
- new_sig.chunks().push_back(chunk);
- new_sig.size() = chunk.width;
-
if (that != NULL)
for (auto &attr : that->attributes) {
if (attr.second->type != AST_CONSTANT)
cell->connections["\\A"] = sig;
cell->parameters["\\Y_WIDTH"] = width;
- cell->connections["\\Y"] = new_sig;
- sig = new_sig;
+ cell->connections["\\Y"] = wire;
+ sig = wire;
}
// helper function for creating RTLIL code for binary operations
wire->width = result_width;
current_module->wires[wire->name] = wire;
- RTLIL::SigChunk chunk;
- chunk.wire = wire;
- chunk.width = wire->width;
- chunk.offset = 0;
-
- RTLIL::SigSpec sig;
- sig.chunks().push_back(chunk);
- sig.size() = chunk.width;
-
for (auto &attr : that->attributes) {
if (attr.second->type != AST_CONSTANT)
log_error("Attribute `%s' with non-constant value at %s:%d!\n",
cell->connections["\\B"] = right;
cell->parameters["\\Y_WIDTH"] = result_width;
- cell->connections["\\Y"] = sig;
- return sig;
+ cell->connections["\\Y"] = wire;
+ return wire;
}
// helper function for creating RTLIL code for multiplexers
wire->width = left.size();
current_module->wires[wire->name] = wire;
- RTLIL::SigChunk chunk;
- chunk.wire = wire;
- chunk.width = wire->width;
- chunk.offset = 0;
-
- RTLIL::SigSpec sig;
- sig.chunks().push_back(chunk);
- sig.size() = chunk.width;
-
for (auto &attr : that->attributes) {
if (attr.second->type != AST_CONSTANT)
log_error("Attribute `%s' with non-constant value at %s:%d!\n",
cell->connections["\\A"] = right;
cell->connections["\\B"] = left;
cell->connections["\\S"] = cond;
- cell->connections["\\Y"] = sig;
+ cell->connections["\\Y"] = wire;
- return sig;
+ return wire;
}
// helper class for converting AST always nodes to RTLIL processes
}
}
- RTLIL::SigSpec sig;
- sig.chunks().push_back(chunk);
- sig.size() = chunk.width;
+ RTLIL::SigSpec sig(chunk);
if (genRTLIL_subst_from && genRTLIL_subst_to)
sig.replace(*genRTLIL_subst_from, *genRTLIL_subst_to);
// concatenation of signals can be done directly using RTLIL::SigSpec
case AST_CONCAT: {
RTLIL::SigSpec sig;
- sig.size() = 0;
- for (auto it = children.begin(); it != children.end(); it++) {
- RTLIL::SigSpec s = (*it)->genRTLIL();
- for (size_t i = 0; i < s.chunks().size(); i++) {
- sig.chunks().push_back(s.chunks()[i]);
- sig.size() += s.chunks()[i].width;
- }
- }
+ for (auto it = children.begin(); it != children.end(); it++)
+ sig.append((*it)->genRTLIL());
if (sig.size() < width_hint)
sig.extend_u0(width_hint, false);
return sig;
sigspec:
constant {
- RTLIL::SigChunk chunk;
- chunk.wire = NULL;
- chunk.width = $1->bits.size();
- chunk.offset = 0;
- chunk.data = *$1;
- $$ = new RTLIL::SigSpec;
- $$->chunks().push_back(chunk);
- $$->size() = chunk.width;
+ $$ = new RTLIL::SigSpec(*$1);
delete $1;
} |
TOK_ID {
if (current_module->wires.count($1) == 0)
rtlil_frontend_ilang_yyerror(stringf("ilang error: wire %s not found", $1).c_str());
- RTLIL::SigChunk chunk;
- chunk.wire = current_module->wires[$1];
- chunk.width = current_module->wires[$1]->width;
- chunk.offset = 0;
- $$ = new RTLIL::SigSpec;
- $$->chunks().push_back(chunk);
- $$->size() = chunk.width;
+ $$ = new RTLIL::SigSpec(current_module->wires[$1]);
free($1);
} |
TOK_ID '[' TOK_INT ']' {
if (current_module->wires.count($1) == 0)
rtlil_frontend_ilang_yyerror(stringf("ilang error: wire %s not found", $1).c_str());
- RTLIL::SigChunk chunk;
- chunk.wire = current_module->wires[$1];
- chunk.offset = $3;
- chunk.width = 1;
- $$ = new RTLIL::SigSpec;
- $$->chunks().push_back(chunk);
- $$->size() = 1;
+ $$ = new RTLIL::SigSpec(current_module->wires[$1], 1, $3);
free($1);
} |
TOK_ID '[' TOK_INT ':' TOK_INT ']' {
if (current_module->wires.count($1) == 0)
rtlil_frontend_ilang_yyerror(stringf("ilang error: wire %s not found", $1).c_str());
- RTLIL::SigChunk chunk;
- chunk.wire = current_module->wires[$1];
- chunk.width = $3 - $5 + 1;
- chunk.offset = $5;
- $$ = new RTLIL::SigSpec;
- $$->chunks().push_back(chunk);
- $$->size() = chunk.width;
+ $$ = new RTLIL::SigSpec(current_module->wires[$1], $3 - $5 + 1, $5);
free($1);
} |
'{' sigspec_list '}' {
sigspec_list:
sigspec_list sigspec {
$$ = new RTLIL::SigSpec;
- for (auto it = $2->chunks().begin(); it != $2->chunks().end(); it++) {
- $$->chunks().push_back(*it);
- $$->size() += it->width;
- }
- for (auto it = $1->chunks().begin(); it != $1->chunks().end(); it++) {
- $$->chunks().push_back(*it);
- $$->size() += it->width;
- }
+ $$->append(*$2);
+ $$->append(*$1);
delete $1;
delete $2;
} |