Merge pull request #5426 from rocallahan/parse-sigspec

Don't stop parsing sigspec after a {} group.
This commit is contained in:
Emil J 2025-10-15 17:31:11 +02:00 committed by GitHub
commit 9d21585a4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 27 additions and 17 deletions

View File

@ -324,18 +324,15 @@ struct RTLILFrontendWorker {
RTLIL::SigSpec parse_sigspec()
{
RTLIL::SigSpec sig;
if (try_parse_char('{')) {
std::vector<SigSpec> parts;
while (!try_parse_char('}'))
parts.push_back(parse_sigspec());
RTLIL::SigSpec sig;
for (auto it = parts.rbegin(); it != parts.rend(); ++it)
sig.append(std::move(*it));
return sig;
}
RTLIL::SigSpec sig;
} else {
// We could add a special path for parsing IdStrings that must already exist,
// as here.
// We don't need to addref/release in this case.
@ -348,6 +345,7 @@ struct RTLILFrontendWorker {
} else {
sig = RTLIL::SigSpec(parse_const());
}
}
while (try_parse_char('[')) {
int left = parse_integer();

12
tests/rtlil/bug5424.ys Normal file
View File

@ -0,0 +1,12 @@
read_rtlil <<EOT
module \meow
wire width 8 \nya
wire width 8 output 1 \mrrp
wire width 1 input 0 \purr
process $cat
assign \nya { \mrrp \purr } [7:0]
end
end
EOT
select -assert-count 1 meow/$cat

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
set -eu
source ../gen-tests-makefile.sh
generate_mk --bash
generate_mk --bash --yosys-scripts