Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",

"updateContentCommand": "tool/gh_codespaces/run_setup.sh",
"postCreateCommand": "tool/gh_codespaces/run_setup.sh",

"customizations": {
"codespaces": {
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build_devtool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Setup Flutter SDK
uses: flutter-actions/setup-flutter@v2
with:
channel: stable
version: 3.29.0
- name: Setup Flutter and Dart
run: tool/gh_codespaces/install_flutter.sh

- name: Install project dependencies
run: tool/gh_actions/install_dependencies.sh

- name: Run Flutter Test
run: tool/gh_actions/devtool/run_devtool_test.sh
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Dart
uses: dart-lang/setup-dart@v1
- name: Setup Flutter and Dart
run: tool/gh_codespaces/install_flutter.sh

- name: Install dependencies
run: tool/gh_actions/install_dependencies.sh
Expand Down
19 changes: 9 additions & 10 deletions .github/workflows/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ jobs:
use-quiet-mode: yes # output is too noisy, see https://github.com/gaurav-nelson/github-action-markdown-link-check/issues/121
config-file: .github/configs/mlc_config.json

- name: Setup Dart
uses: dart-lang/setup-dart@v1
- name: Setup Flutter and Dart
run: tool/gh_codespaces/install_flutter.sh

- name: Setup Node
uses: actions/setup-node@v4
Expand Down Expand Up @@ -85,8 +85,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Dart
uses: dart-lang/setup-dart@v1
- name: Setup Flutter and Dart
run: tool/gh_codespaces/install_flutter.sh

- name: Install project dependencies
run: tool/gh_actions/install_dependencies.sh
Expand All @@ -107,11 +107,11 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Setup Flutter SDK
uses: flutter-actions/setup-flutter@v2
with:
channel: stable
version: 3.29.0
- name: Setup Flutter and Dart
run: tool/gh_codespaces/install_flutter.sh

- name: Install project dependencies
run: tool/gh_actions/install_dependencies.sh

- name: Run Flutter Test
run: tool/gh_actions/devtool/run_devtool_test.sh
Expand All @@ -121,4 +121,3 @@ jobs:

- name: Test DevTools Installation
run: tool/gh_actions/devtool/test_devtools_install.sh extension/devtools

97 changes: 90 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Anyone interested in participating in ROHD is more than welcome to help!

## Code of Conduct

ROHD adopts the [Contributor Covenant](https://www.contributor-covenant.org/) v2.1 for the code of conduct. It can be accessed [here](CODE_OF_CONDUCT.md).
ROHD adopts the [Contributor Covenant](https://www.contributor-covenant.org/) v2.1 for the [Code of Conduct](CODE_OF_CONDUCT.md).

## Getting Help

Expand Down Expand Up @@ -40,7 +40,14 @@ The [ROHD Forum](https://intel.github.io/rohd-website/forum/rohd-forum/) is a pe

### Requirements

You must have [Dart](https://dart.dev/) installed on your system to use ROHD. You can find detailed instructions for how to install Dart here: <https://dart.dev/get-dart>
ROHD uses a [pub workspace](https://dart.dev/tools/pub/workspaces) for its
active packages. Pub resolves every workspace member together, and some
members declare `sdk: flutter`, so
[Flutter](https://docs.flutter.dev/get-started/install), which includes a
compatible Dart SDK, is required to resolve dependencies anywhere in the
workspace, even for core-ROHD-only development. Once dependencies are
resolved, day-to-day analysis and testing of the core ROHD package uses plain
[Dart](https://dart.dev/get-dart) tooling (`dart analyze`, `dart test`).

To run the complete ROHD test suite for development, you need to install [Icarus Verilog](https://steveicarus.github.io/iverilog/). It is used to compare SystemVerilog functionality with the ROHD simulator functionality. Installation instructions are available here: <https://iverilog.fandom.com/wiki/Installation_Guide>

Expand All @@ -64,17 +71,87 @@ The below button will allow you to create a GitHub Codespace with ROHD already c

[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=409325108)

### Cloning and Running the Tests
### Core ROHD Setup and Validation

Once requirements are installed, you can clone and run the test suite:
The root [`pubspec.yaml`](pubspec.yaml) `workspace:` list defines the active
packages.

For core ROHD development, clone the repository and resolve the workspace with
Flutter, then use Dart for everyday analysis and testing:

```shell
git clone https://github.com/intel/rohd.git
cd rohd
dart pub get

# Resolve the workspace dependencies. Flutter is required because pub
# resolves every workspace member together and some members declare
# `sdk: flutter`.
flutter pub get

# Open Folder: open only the root ROHD package in VSCode.
code .

# Analyze and test the core package.
dart analyze
dart test
```

As a local convenience, `tool/gh_actions/install_dependencies.sh` performs the
same dependency-resolution step and requires Flutter to be installed.

In VSCode, this is equivalent to **File > Open Folder...** and selecting the
repository root. Use this mode when working only on the core ROHD package.

### Full Workspace Setup, VSCode, and Validation

For DevTools development or repository-wide validation, use Flutter to resolve
the mixed Dart/Flutter workspace. The checked-in
[`rohd-multipackage.code-workspace`](rohd-multipackage.code-workspace) is
generated from the root `workspace:` list, so it can be opened immediately
after cloning:

```shell
# Open Workspace from File: open every active member in its own package context.
code rohd-multipackage.code-workspace

# Resolve every workspace member from a terminal at the repository root.
flutter pub get
```

In VSCode, this is equivalent to **File > Open Workspace from File...** and
selecting `rohd-multipackage.code-workspace`. Do not use **Open Folder** for
all-package work: the generated multi-root workspace gives each active package
its own Dart or Flutter package context.

After opening the generated workspace, select the Flutter-bundled Dart SDK if
the Dart extension does not select it automatically. The generated workspace
includes every active member, so Dart and Flutter analysis can resolve package
boundaries correctly.

Run repository-wide validation from the repository root:

```shell
# Analyze every active workspace member.
dart run tool/workspace.dart analyze

# Run native non-benchmark tests, using flutter test for Flutter packages.
dart run tool/workspace.dart test

# Run non-benchmark Node.js tests for each non-Flutter workspace member.
dart run tool/workspace.dart test-node
```

The Node.js pass can take substantially longer than native tests because Dart
compiles browser test bundles. Run an individual package or test file directly
while iterating, then use the workspace commands before submitting a change.
The workspace test commands exclude the long-running `benchmark` tag; run the
[benchmark suite](benchmark/README.md) separately when measuring performance.

When adding or removing an active package, update the root `workspace:` list,
regenerate `rohd-multipackage.code-workspace` with
`dart run tool/workspace.dart vscode`, and commit the generated workspace file
alongside the `pubspec.yaml` change. Then run `flutter pub get`.

## How to Contribute

### Reporting Vulnerabilities
Expand Down Expand Up @@ -109,7 +186,13 @@ Take a look around the issues on the repo and see if there's any you'd like to t

If you have a change that you have implemented and would like to contribute, you can open a pull request. Please try to make sure you have implemented tests covering the changes, if applicable. Smaller, simpler pull requests are easier to review.

Be sure to run the test suite (`dart test`) before asking for your code to be merged. You may also locally generate API documentation (`dart doc`) to make sure it looks right and doesn't have any errors. You should use the dart formatter on all code (`dart format .`), and may prefer to have it automatically format on every file save. If you are using VSCode with the Dart extension, then consider using the recommended settings: <https://dartcode.org/docs/recommended-settings/>
Be sure to run the applicable workspace validation commands described above
before asking for your code to be merged. You may also locally generate API
documentation (`dart doc`) to make sure it looks right and doesn't have any
errors. You should use the dart formatter on all code (`dart format .`), and
may prefer to have it automatically format on every file save. If you are using
VSCode with the Dart extension, then consider using the recommended settings:
<https://dartcode.org/docs/recommended-settings/>

**Tests must pass, documentation must generate, and the formatter must be run on every pull request or the automated GitHub Actions flow will fail.**

Expand All @@ -124,7 +207,7 @@ Please include the SPDX tag near the top of any new files you create:
Here is an example of a recommended file header template:

```dart
// Copyright (C) 2021-2023 Intel Corporation
// Copyright (C) 2021-2026 Intel Corporation
// SPDX-License-Identifier: BSD-3-Clause
//
// example.dart
Expand Down
11 changes: 7 additions & 4 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ analyzer:
strict-raw-types: true
exclude:
- doc/tutorials/chapter_9/rohd_vf_example
- packages/rohd_hierarchy
- packages/rohd_waveform
- rohd_devtools_extension
- rohd_extension
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**

# keep up to date, matching https://dart.dev/tools/linter-rules/all
# some lints are not yet available, so disabled and marked with [not currently recognized]
Expand Down
8 changes: 4 additions & 4 deletions lib/src/collections/iterable_removable_queue.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class IterableRemovableQueue<T> {
return;
}

if (_first == _last && _removeWhere!(_first!.item)) {
if (_first == _last && _removeWhere(_first!.item)) {
// if size is 1 and its removable, then we can just clear the queue and be
// done with it
clear();
Expand All @@ -77,7 +77,7 @@ class IterableRemovableQueue<T> {
}

while (_patrol != null) {
if (_removeWhere!(_patrol!.item)) {
if (_removeWhere(_patrol!.item)) {
assert(size > 0, 'Should not be removing if size is already 0.');

if (_patrol == _first && _first == _last) {
Expand Down Expand Up @@ -118,7 +118,7 @@ class IterableRemovableQueue<T> {
/// Also may remove items from the queue if they are indicated by
/// [_removeWhere].
void add(T item) {
if (_removeWhere != null && _removeWhere!(item)) {
if (_removeWhere != null && _removeWhere(item)) {
// If the item should be removed, we don't add it.
return;
}
Expand Down Expand Up @@ -184,7 +184,7 @@ class IterableRemovableQueue<T> {
var element = _first;
_IterableRemovableElement<T>? previous;
while (element != null) {
if (_removeWhere != null && _removeWhere!(element.item)) {
if (_removeWhere != null && _removeWhere(element.item)) {
assert(size > 0, 'Should not be removing if size is already 0.');

previous?.next = element.next;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/modules/conditionals/flop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class FlipFlop extends Module with SystemVerilog {
var contents = [q < _d];

if (_en != null) {
contents = [If(_en!, then: contents)];
contents = [If(_en, then: contents)];
}

Sequential(
Expand Down
1 change: 0 additions & 1 deletion packages/rohd_hierarchy/analysis_options.yaml

This file was deleted.

4 changes: 3 additions & 1 deletion packages/rohd_hierarchy/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ issue_tracker: https://github.com/intel/rohd/issues

publish_to: none

resolution: workspace

environment:
sdk: '>=3.0.0 <4.0.0'
sdk: ^3.6.0

dependencies:
collection: ^1.15.0
Expand Down
Loading
Loading