Skip to content

Commit

Permalink
doc, configurator, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mkorbel1 committed Dec 26, 2023
1 parent 77935a3 commit 3267c8c
Show file tree
Hide file tree
Showing 13 changed files with 122 additions and 10 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
name: Run Checks
permissions: {}
timeout-minutes: 30
runs-on: intel-ubuntu-latest
runs-on: ${{ github.repository_owner == 'intel' && 'intel-ubuntu-latest' || 'ubuntu-latest' }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
name: Run Flutter Checks
permissions: {}
timeout-minutes: 30
runs-on: intel-ubuntu-latest
runs-on: ${{ github.repository_owner == 'intel' && 'intel-ubuntu-latest' || 'ubuntu-latest' }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
permissions:
contents: write # required for "JamesIves/github-pages-deploy-action"
timeout-minutes: 30
runs-on: intel-ubuntu-latest
runs-on: ${{ github.repository_owner == 'intel' && 'intel-ubuntu-latest' || 'ubuntu-latest' }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -137,7 +137,7 @@ jobs:
permissions:
contents: write # required for "JamesIves/github-pages-deploy-action"
timeout-minutes: 30
runs-on: intel-ubuntu-latest
runs-on: ${{ github.repository_owner == 'intel' && 'intel-ubuntu-latest' || 'ubuntu-latest' }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions .pubignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
confapp
2 changes: 1 addition & 1 deletion lib/src/arbiters/arbiter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: BSD-3-Clause
//
// arbiter.dart
// Implementation of arbiters.
// Definition for an interface for a generic arbiter.
//
// 2023 March 13
// Author: Max Korbel <[email protected]>
Expand Down
3 changes: 3 additions & 0 deletions lib/src/arbiters/arbiters.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (C) 2023 Intel Corporation
// SPDX-License-Identifier: BSD-3-Clause

export 'arbiter.dart';
export 'mask_round_robin_arbiter.dart';
export 'priority_arbiter.dart';
Expand Down
12 changes: 9 additions & 3 deletions lib/src/arbiters/mask_round_robin_arbiter.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
// Copyright (C) 2023 Intel Corporation
// SPDX-License-Identifier: BSD-3-Clause
//
// mask_round_robin_arbiter.dart
// Implementation of a masked round-robin arbiter.
//
// 2023

import 'package:rohd/rohd.dart';
import 'package:rohd_hcl/rohd_hcl.dart';

/// Round Robin Arbiter.
/// A [RoundRobinArbiter] implemented using request and grant masks.
class MaskRoundRobinArbiter extends StatefulArbiter
implements RoundRobinArbiter {
/// Mask to define pending requests to be attended
Expand Down Expand Up @@ -51,8 +59,6 @@ class MaskRoundRobinArbiter extends StatefulArbiter
// In case [_grants] are all 0s, requestMask gets a reset
], defaultItem: [
// leave request mask as-is if there was no grant
//TODO: bug, shouldn't reset masks if no grants!
// for (var g = 0; g < count; g++) _requestMask[g] < 1,
])
])
]);
Expand Down
9 changes: 9 additions & 0 deletions lib/src/arbiters/priority_arbiter.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Copyright (C) 2023 Intel Corporation
// SPDX-License-Identifier: BSD-3-Clause
//
// priority_arbiter.dart
// Implementation of a priority arbiter.
//
// 2023 March 13
// Author: Max Korbel <[email protected]>

import 'package:rohd/rohd.dart';
import 'package:rohd_hcl/rohd_hcl.dart';

Expand Down
11 changes: 10 additions & 1 deletion lib/src/arbiters/rotate_round_robin_arbiter.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
// Copyright (C) 2023 Intel Corporation
// SPDX-License-Identifier: BSD-3-Clause
//
// rotate_round_robin_arbiter.dart
// Implementation of arbiters.
//
// 2023
// Author: Max Korbel <[email protected]>

import 'package:rohd/rohd.dart';
import 'package:rohd_hcl/rohd_hcl.dart';

/// A round-robin arbiter.
/// A [RoundRobinArbiter] implemented using rotations and a [PriorityArbiter].
class RotateRoundRobinArbiter extends StatefulArbiter
implements RoundRobinArbiter {
/// Creates an [Arbiter] that fairly takes turns between [requests].
Expand Down
11 changes: 11 additions & 0 deletions lib/src/arbiters/round_robin_arbiter.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
// Copyright (C) 2023 Intel Corporation
// SPDX-License-Identifier: BSD-3-Clause
//
// round_robin_arbiter.dart
// Interface for round-robin arbiters.
//
// 2023 December
// Author: Max Korbel <[email protected]>

import 'package:rohd/rohd.dart';
import 'package:rohd_hcl/rohd_hcl.dart';

/// A [StatefulArbiter] which fairly arbitrates between requests.
abstract class RoundRobinArbiter extends StatefulArbiter {
/// By default, creates an instance of a [MaskRoundRobinArbiter].
factory RoundRobinArbiter(List<Logic> requests,
{required Logic clk, required Logic reset}) =>
MaskRoundRobinArbiter(requests, clk: clk, reset: reset);
Expand Down
17 changes: 17 additions & 0 deletions lib/src/arbiters/stateful_arbiter.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
// Copyright (C) 2023 Intel Corporation
// SPDX-License-Identifier: BSD-3-Clause
//
// stateful_arbiter.dart
// Implementation of an arbiter that holds state.
//
// 2023 December
// Author: Max Korbel <[email protected]>

import 'package:meta/meta.dart';
import 'package:rohd/rohd.dart';
import 'package:rohd_hcl/rohd_hcl.dart';

/// An [Arbiter] which holds state in order to arbitrate.
abstract class StatefulArbiter extends Arbiter {
/// The clock used for sequential elements.
///
/// Should only be used by implementations.
@protected
late final Logic clk = input('clk');

/// The reset used for sequential elements (active high).
///
/// Should only be used by implementations.
@protected
late final Logic reset = input('reset');

/// Creates a new [StatefulArbiter] with associated [clk] and [reset].
StatefulArbiter(super.requests, {required Logic clk, required Logic reset}) {
addInput('clk', clk);
addInput('reset', reset);
Expand Down
2 changes: 2 additions & 0 deletions lib/src/component_config/components/component_registry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
// Author: Max Korbel <[email protected]>

import 'package:rohd_hcl/rohd_hcl.dart';
import 'package:rohd_hcl/src/component_config/components/config_round_robin_arbiter.dart';

/// A list of [Configurator]s for ROHD-HCL components.
List<Configurator> get componentRegistry => [
RotateConfigurator(),
FifoConfigurator(),
PriorityArbiterConfigurator(),
RoundRobinArbiterConfigurator(),
RippleCarryAdderConfigurator(),
CarrySaveMultiplierConfigurator(),
BitonicSortConfigurator(),
Expand Down
1 change: 1 addition & 0 deletions lib/src/component_config/components/components.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export 'config_priority_arbiter.dart';
export 'config_rf.dart';
export 'config_ripple_carry_adder.dart';
export 'config_rotate.dart';
export 'config_round_robin_arbiter.dart';
export 'config_sort.dart';
2 changes: 1 addition & 1 deletion lib/src/component_config/components/config_rotate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import 'package:rohd_hcl/rohd_hcl.dart';
class RotateConfigurator extends Configurator {
/// A knob controlling the direction of rotation.
final directionKnob = ChoiceConfigKnob<RotateDirection>(
[RotateDirection.left, RotateDirection.right],
RotateDirection.values,
value: RotateDirection.right,
);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Copyright (C) 2023 Intel Corporation
// SPDX-License-Identifier: BSD-3-Clause
//
// config_round_robin_arbiter.dart
// Configurator for a PriorityArbiter.
//
// 2023 December 26
// Author: Max Korbel <[email protected]>

import 'dart:collection';

import 'package:rohd/rohd.dart';
import 'package:rohd_hcl/rohd_hcl.dart';

/// The type of round-robin arbiter.
enum RoundRobinImplmentation {
/// A [MaskRoundRobinArbiter].
mask,

/// A [RotateRoundRobinArbiter]
rotate
}

/// A [Configurator] for [PriorityArbiter].
class RoundRobinArbiterConfigurator extends Configurator {
/// A knob controlling the number of requests and grants.
final IntConfigKnob numRequestKnob = IntConfigKnob(value: 8);

/// A knob controlling the implementation.
final ChoiceConfigKnob<RoundRobinImplmentation> implementationKnob =
ChoiceConfigKnob(RoundRobinImplmentation.values,
value: RoundRobinImplmentation.mask);

@override
final String name = 'Round Robin Arbiter';

@override
late final Map<String, ConfigKnob<dynamic>> knobs = UnmodifiableMapView({
'Number of Requestors': numRequestKnob,
'Implementation': implementationKnob,
});

@override
Module createModule() {
final reqs = List.generate(numRequestKnob.value, (i) => Logic());
switch (implementationKnob.value) {
case RoundRobinImplmentation.mask:
return MaskRoundRobinArbiter(reqs, clk: Logic(), reset: Logic());
case RoundRobinImplmentation.rotate:
return RotateRoundRobinArbiter(reqs, clk: Logic(), reset: Logic());
}
}
}

0 comments on commit 3267c8c

Please sign in to comment.