intel / rohd

The Rapid Open Hardware Development (ROHD) framework is a framework for describing and verifying hardware in the Dart programming language.
https://intel.github.io/rohd-website
BSD 3-Clause "New" or "Revised" License
374 stars 67 forks source link

Support compiling ROHD to JavaScript #445

Closed mkorbel1 closed 10 months ago

mkorbel1 commented 10 months ago

Description & Motivation

ROHD is written in Dart, and Dart can compile to JavaScript, so it should be possible to compile ROHD to JavaScript. In practice, there are a handful of differences when compiling Dart to JavaScript that make ROHD not quite work properly (mostly related to how numbers are handled).

See here for some details: https://dart.dev/guides/language/numbers#bitwise-operations

This PR makes changes so that ROHD can compile and run correctly in JavaScript. Most of the test suite has been adjusted to be runnable (and meaningful) when compiled to JavaScript, which validates that most functionality works properly now.

Additionally, the changes have revealed bugs in the native Dart ROHD functionality, so this PR fixes those bugs in both platforms.

Some of the changes:

NOTE: The translations test is failing in JavaScript, still not sure why.

Related Issue(s)

N/A

Testing

Added new tests, updated existing tests

Backwards-compatibility

Is this a breaking change that will not be backwards-compatible? If yes, how so?

Some minor things:

Documentation

Does the change require any updates to documentation? If so, where? Are they included?

No