Fixes error with vector indicies of the form [2:7] [-12:7]

Make sure that we correctly adjust the value to align it to a zero
indexed list with lsb = 0

Signed-off-by: Ethan Mahintorabi <ethanmoon@google.com>
This commit is contained in:
Ethan Mahintorabi 2024-05-08 20:28:37 +00:00
parent c039da2ec1
commit 82a4a87c97
No known key found for this signature in database
GPG Key ID: 824E41B920BEA252
1 changed files with 1 additions and 1 deletions

View File

@ -2164,7 +2164,7 @@ void VerificImporter::import_netlist(RTLIL::Design *design, Netlist *nl, std::ma
// that the indicies match LSB = 0 order to match the std::vector // that the indicies match LSB = 0 order to match the std::vector
// to SigSpec LSB = 0 precondition. // to SigSpec LSB = 0 precondition.
if (lsb_index > msb_index) { if (lsb_index > msb_index) {
port_offset = abs(port_offset - lsb_index); port_offset = abs(port_offset - (lsb_index - min(msb_index, lsb_index)));
} }
} }
IdString port_name_id = RTLIL::escape_id(port_name); IdString port_name_id = RTLIL::escape_id(port_name);