3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-05-11 09:44:44 +00:00

rtlil: enable single-bit vector wires

This commit is contained in:
Emil J. Tywoniak 2025-05-06 12:02:00 +02:00
parent f60bbe64ac
commit ab112b9b6b
12 changed files with 121 additions and 9 deletions

View file

@ -350,6 +350,8 @@ void AstNode::dumpAst(FILE *f, std::string indent) const
fprintf(f, " port=%d", port_id);
if (range_valid || range_left != -1 || range_right != 0)
fprintf(f, " %srange=[%d:%d]%s", range_swapped ? "swapped_" : "", range_left, range_right, range_valid ? "" : "!");
if (is_sbvector)
fprintf(f, " vector");
if (integer != 0)
fprintf(f, " int=%u", (int)integer);
if (realvalue != 0)

View file

@ -192,7 +192,7 @@ namespace AST
// node content - most of it is unused in most node types
std::string str;
std::vector<RTLIL::State> bits;
bool is_input, is_output, is_reg, is_logic, is_signed, is_string, is_wand, is_wor, range_valid, range_swapped, was_checked, is_unsized, is_custom_type;
bool is_input, is_output, is_reg, is_logic, is_signed, is_string, is_wand, is_wor, range_valid, range_swapped, is_sbvector, was_checked, is_unsized, is_custom_type;
int port_id, range_left, range_right;
uint32_t integer;
double realvalue;

View file

@ -1445,7 +1445,11 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
wire->port_id = port_id;
wire->port_input = is_input;
wire->port_output = is_output;
wire->upto = range_swapped;
if (wire->width != 1)
wire->upto = range_swapped;
else
wire->sbvector = is_sbvector;
wire->is_signed = is_signed;
for (auto &attr : attributes) {

View file

@ -2084,6 +2084,8 @@ bool AstNode::simplify(bool const_fold, int stage, int width_hint, bool sign_hin
std::swap(range_left, range_right);
range_swapped = force_upto;
}
if (range_left == range_right)
is_sbvector = true;
}
} else {
if (!range_valid)
@ -2092,6 +2094,7 @@ bool AstNode::simplify(bool const_fold, int stage, int width_hint, bool sign_hin
range_swapped = false;
range_left = 0;
range_right = 0;
is_sbvector = false;
}
}