Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix algorithm ST dump #7

Open
Lipen opened this issue Mar 11, 2020 · 0 comments
Open

Fix algorithm ST dump #7

Lipen opened this issue Mar 11, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@Lipen
Copy link
Member

Lipen commented Mar 11, 2020

Currently, the code inside BinaryAlgorithm::toST(...) has a bug in it - when the algorithm is T->T, F->F (z := z), it is erroneously displayed as z := NOT z.

fun toST(outputNames: List<String>): String {
require(outputNames.size == algorithm0.size) { "Wrong number of output names" }
return outputNames.indices.joinToString("") { i ->
val name = outputNames[i]
val a0 = algorithm0[i]
val a1 = algorithm1[i]
if (a0 == a1)
"$name:=${a0.toString().toUpperCase()};"
else
"$name:=NOT $name;"
}
}

The correct behavior is to display such algorithms as z := z or, as we convert to ST, not to display them at all, as z := z is a no-op.

@Lipen Lipen added the bug Something isn't working label Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant