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

Do not check contention on downstream values #4903

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gr455
Copy link
Member

@gr455 gr455 commented Apr 19, 2024

We define an output node value to be upstream if it is given to it by its parent element. All other values are downstream values.

In the case that a node gives an output node value (while the parent does not drive the output value. e.g. Tristate with control bit 0), and then the same node gives another value to the output node, earlier it would cause contention since the output node is said to [before the propagation from the other node] still have the former value.

This is a downstream value and post this commit will be overwritten. Contention will only be checked at upstream valued output nodes.

We define an output node value to be upstream if it is given to
it by its parent element. All other values are downstream values.

In the case that a node gives an output node value (while the
parent does not drive the output value. e.g. Tristate with control
bit 0), and then the same node gives another value to the output
node, earlier it would cause contention since the output node is
said to [before the propagation from the other node] still have
the former value.

This is a downstream value and post this commit will be
overwritten. Contention will only be checked at upstream valued
output nodes.
@@ -103,6 +103,8 @@ export default class AndGate extends CircuitElement {
result &= this.inp[i].value || 0;
this.output1.value = result >>> 0;
simulationArea.simulationQueue.add(this.output1);

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing spaces not allowed.

@@ -82,6 +82,8 @@ export default class Buffer extends CircuitElement {

this.output1.value = this.state;
simulationArea.simulationQueue.add(this.output1);

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing spaces not allowed.

}

/**
* @memberof ConstantVal
* updates state using a prompt when dbl clicked
*/
dblclick() {
this.state = prompt("Re enter the value") || "0";
const state_ = prompt("Re enter the value") || "0";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected dangling '' in 'state'.

this.newBitWidth(this.state.toString().length);
}

isValidState(state) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected 'this' to be used by class method 'isValidState'.

this.newBitWidth(this.state.toString().length);
}

isValidState(state) {
for (const c of state)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.

this.newBitWidth(this.state.toString().length);
}

isValidState(state) {
for (const c of state)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected { after 'for-of'.

this.newBitWidth(this.state.toString().length);
}

isValidState(state) {
for (const c of state)
if (c != "0" && c != "1") return false;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected no linebreak before this statement.

this.newBitWidth(this.state.toString().length);
}

isValidState(state) {
for (const c of state)
if (c != "0" && c != "1") return false;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected '!==' and instead saw '!='.

this.newBitWidth(this.state.toString().length);
}

isValidState(state) {
for (const c of state)
if (c != "0" && c != "1") return false;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected '!==' and instead saw '!='.

@@ -232,6 +232,8 @@ export default class RGBLedMatrix extends CircuitElement {
colors[rowNodeValue][columnNodeValue] = colorValue;
}
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing spaces not allowed.

Copy link

codeclimate bot commented Apr 19, 2024

Code Climate has analyzed commit 6c369c0 and detected 25 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 11
Clarity 9
Bug Risk 5

View more on Code Climate.

@tachyons tachyons requested a review from pulkit-30 April 23, 2024 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant