Skip to content

Commit

Permalink
some signal info merging improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ekiwi committed Dec 6, 2023
1 parent b22f7e8 commit b8e06c5
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/btor2/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,22 +753,15 @@ impl<'a> Parser<'a> {
}

fn merge_signal_info(original: &SignalInfo, alias: &SignalInfo) -> SignalInfo {
// only overwrite the kind if it was a node, since other labels add more info
let kind = if original.kind == SignalKind::Node {
alias.kind
} else {
original.kind
};

let name = match (original.name, alias.name) {
(Some(name), None) => Some(name),
(None, Some(name)) => Some(name),
(None, None) => None,
(Some(old_name), Some(new_name)) => {
// we decide whether to overwrite depending on the signal kind
match kind {
SignalKind::Input => {
// inputs must retain their old names in order to be identifiable
// we decide whether to overwrite depending on the old signal kind
match original.kind {
SignalKind::Input | SignalKind::Output => {
// inputs and outputs must retain their old names in order to be identifiable
Some(old_name)
}
SignalKind::State => {
Expand All @@ -784,6 +777,13 @@ fn merge_signal_info(original: &SignalInfo, alias: &SignalInfo) -> SignalInfo {
};
// TODO: it might be interesting to retain alias names

// only overwrite the kind if it was a node, since other labels add more info
let kind = if original.kind == SignalKind::Node {
alias.kind
} else {
original.kind
};

SignalInfo { name, kind }
}

Expand Down

0 comments on commit b8e06c5

Please sign in to comment.