Skip to content

Reinstate connection width mismatch exception #311

Closed
@mkorbel1

Description

@mkorbel1

Describe the bug

When _Wires were added to ROHD Logics (#199), an exception was mistakenly removed which clearly explained why signals could not be connected when signals are different widths:

rohd/lib/src/logic.dart

Lines 261 to 264 in bae662c

if (other.width != width) {
throw Exception('Bus widths must match.'
' Cannot connect $this to $other which have different widths.');
}

We should add it back. Probably we should add a test to make sure it doesn't get removed, and also make it a unique type of exception instead of Exception. Perhaps some rewording is needed as well.

To Reproduce

Example from: #308 (reply in thread)

Expected behavior

An error something like this:

Exception: Bus widths must match. Cannot connect Logic(11): f to Logic(10): _swizzled which have different widths.

Actual behavior

Uncaught Error: Failed to put value on signal (f): Updated value width mismatch. The width of 10'bzzzz00111z should be 11

Additional: Dart SDK info

No response

Additional: pubspec.yaml

No response

Additional: Context

Present in v0.4.2

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions