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

Naming definition #160

Merged
merged 77 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from 75 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
0b33234
extensive fp cleanup, support of Inf/NaN, addition of simple fp multi…
ganewto Jan 7, 2025
d70730f
broken link
ganewto Jan 8, 2025
446f5cd
dead link pub.dev
ganewto Jan 8, 2025
ba178bc
minor typo
ganewto Jan 8, 2025
8c3c15b
use NativeAdder by default
ganewto Jan 8, 2025
a283f76
general binary tree component and test
desmonddak Jan 9, 2025
b185b1d
documentation and an experimental LogicArray binary tree
desmonddak Jan 9, 2025
e11e57e
cleanup based on feedback in PR
ganewto Jan 10, 2025
f30787b
second phase of cleanup based on feedback
ganewto Jan 10, 2025
4b43929
more doc of FP Values, signedshifter, code warning that stopped build
ganewto Jan 10, 2025
b9fdf61
working binary tree
desmonddak Jan 10, 2025
6f15183
markdown lint issues
ganewto Jan 10, 2025
30b9eb3
updated code documentation
desmonddak Jan 10, 2025
a0760ea
working reduction tree
desmonddak Jan 12, 2025
57a7f76
refactored into an iterative function
desmonddak Jan 12, 2025
d73020b
preparted to merge iter into top class
desmonddak Jan 12, 2025
1563fd8
merged ReductionTree module with internal recursion, documentation
desmonddak Jan 12, 2025
343e45f
use floating_point.md from fpmult branch
desmonddak Jan 12, 2025
7a10bfe
don't use WaveDumper in regressions
desmonddak Jan 12, 2025
8593dcc
remove binary_tree as reduction_tree covers
desmonddak Jan 12, 2025
8db0a58
reduction_tree in rohd_hcl, remove binary_tree
desmonddak Jan 12, 2025
e7a24f7
forgot to saveall in vscode -- rohd_hcl.dart fix
desmonddak Jan 12, 2025
8fec4f9
Binary tree replaced bin reduction tree.
desmonddak Jan 13, 2025
fac01f3
better use of dart maps
desmonddak Jan 13, 2025
edac48f
use a record for capturing state
desmonddak Jan 13, 2025
a366b84
improve documentation with better examples
desmonddak Jan 13, 2025
8c10cae
doc fix, more code neatening for clarity
desmonddak Jan 13, 2025
aadd721
doc cleanup
desmonddak Jan 13, 2025
9d02b42
more doc cleanup
desmonddak Jan 13, 2025
60a4f03
more documentation cleanup in code and markdown
desmonddak Jan 13, 2025
d5d32f6
added reduction_tree to README.md
desmonddak Jan 13, 2025
9fbf7eb
first passing on naming signals
desmonddak Jan 14, 2025
5167ff8
good signal naming for fp components
desmonddak Jan 15, 2025
a5575a9
prefix and product generator signal naming
desmonddak Jan 15, 2025
a469072
dart format miss
ganewto Jan 15, 2025
b86f2fc
converted to naming utility
ganewto Jan 15, 2025
c6e6af9
remove synthesis output
ganewto Jan 15, 2025
cd5b452
unused import
desmonddak Jan 15, 2025
599a6d3
Merge branch 'main' into namingFP
desmonddak Jan 16, 2025
4eee34c
ensure multiplier tests sweep sign extension
desmonddak Jan 16, 2025
2547473
bad link due to class name change
desmonddak Jan 16, 2025
436ec64
format issues
desmonddak Jan 16, 2025
a970089
multiplier encoder and compressor internal signal naming
desmonddak Jan 16, 2025
58dc5f7
multiplier components produce clean Verilog
desmonddak Jan 17, 2025
c43be66
Merge branch 'main' into treeComponent
desmonddak Jan 17, 2025
c2ec6fa
doc fixes, remove deprecated calls
desmonddak Jan 17, 2025
259c5a9
doc fixes
desmonddak Jan 17, 2025
23f6f2d
Using Logic.named() for key components
desmonddak Jan 18, 2025
48141d1
point to namedclones branch temporarily
desmonddak Jan 19, 2025
8397325
bf16 missing override methods
desmonddak Jan 19, 2025
3b60f13
split out fpsubtype changes
desmonddak Jan 19, 2025
d240e27
update for confapp to point to upcoming ROHD naming api
desmonddak Jan 21, 2025
892cf56
point to ROHD 0.6.1
desmonddak Jan 21, 2025
b22b9ac
naming fixes and doc updates in code
desmonddak Jan 21, 2025
c4fc0b4
NativeMultiplier added and threaded through FloatingPointMultiplierSi…
desmonddak Jan 22, 2025
5e67ef3
widening fp mult
desmonddak Jan 22, 2025
3e69e07
naming cleanups for fp mult and simple add
desmonddak Jan 22, 2025
982a91a
more cleanup, fix confapp/pubspec
desmonddak Jan 23, 2025
c34e7b9
copyright updates and added some TODOs
desmonddak Jan 23, 2025
ac1daeb
cleanup Multiplier and MAC Apis
desmonddak Jan 23, 2025
ee8665b
check for widening on fpmult, sweep width tests
desmonddak Jan 23, 2025
9cef6c7
cleanup of extra clk addInputs
desmonddak Jan 24, 2025
6982392
update pubspec, native adder naming internals
desmonddak Jan 24, 2025
bf8b4f5
confapp pubspec update
desmonddak Jan 24, 2025
6b9d300
a start on naming generated definitions
desmonddak Jan 25, 2025
8b7920b
fp and multiplier naming changes
desmonddak Jan 25, 2025
6482cbd
onescomplement and incr/decr naming
desmonddak Jan 25, 2025
8e56dba
signmagadder name
desmonddak Jan 25, 2025
b3d8977
naming in tree operations
desmonddak Jan 29, 2025
b175764
remove reduction tree for another branch
desmonddak Jan 29, 2025
4c2bdc3
fairly complete definition naming
desmonddak Jan 30, 2025
0aaad9f
Merge branch 'main' into namingDefinition
desmonddak Jan 30, 2025
b5c3eff
md fixes (blank lines)
desmonddak Jan 30, 2025
f637956
format issues with web merging
desmonddak Jan 30, 2025
22557be
date and naming fixes
desmonddak Jan 31, 2025
91b4ccb
naming failure in configurator
desmonddak Jan 31, 2025
9da2a5e
cleanup test from outputing generated verilog
desmonddak Jan 31, 2025
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
14 changes: 7 additions & 7 deletions doc/components/floating_point.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Appropriate string representations, comparison operations, and operators are ava

### Floating Point Constants

The various IEEE constants representing corner cases of the field of floating-point values for a given size of [FloatingPointValue](https://intel.github.io/rohd-hcl/rohd_hcl/FloatingPointValue-class.html): infinities, zeros, limits for normal (e.g. mantissa in the range of $[1,2)$ and sub-normal numbers (zero exponent, and mantissa <1).
The various IEEE constants representing corner cases of the field of floating-point values for a given size of [FloatingPointValue](https://intel.github.io/rohd-hcl/rohd_hcl/FloatingPointValue-class.html): infinities, zeros, limits for normal (e.g. mantissa in the range of $[1,2)$) and sub-normal numbers (zero exponent, and mantissa <1).

For any basic arbitrary width `FloatingPointValue` ROHD-HCL supports the following constants in that format.

Expand All @@ -36,8 +36,8 @@ For any basic arbitrary width `FloatingPointValue` ROHD-HCL supports the followi
- `one`: The number one
- `smallestLargerThanOne`: Smallest number greater than one
- `largestNormal`: Largest positive number, most positive exponent, full mantissa
- `infinity`: Largest possible number: all 1s in the exponent, all 0s in the mantissa
- `nan`: Not a Number, demarked by all 1s in exponent and any 1 in mantissa (we use the LSB)
- `infinity`: Largest possible number: all 1s in the exponent, all 0s in the mantissa
- `nan`: Not a Number, designated by all 1s in exponent and any 1 in mantissa (we use the LSB)

### Special subtypes

Expand Down Expand Up @@ -73,7 +73,7 @@ A very basic [FloatingPointMultiplierSimple] component is available which does n

It has options to control its performance:

- 'radix': used to specify the radix of the Booth encoder (default radix=4: options are [2,4,8,16])'.

- 'adderGen': used to specify the kind of [Adder] used for key functions like the mantiss addition. Defaults to [NativeAdder], but you can select a [ParallelPrefixAdder] of your choice.
- 'ppTree': used to specify the type of ['ParallelPrefix'](https://intel.github.io/rohd-hcl/rohd_hcl/ParallelPrefix-class.html) used in the pther critical functions like leading-one detect.
- `radix`: used to specify the radix of the Booth encoder (default radix=4: options are [2,4,8,16])'.
- `adderGen`: used to specify the kind of [Adder] used for key functions like the mantissa addition. Defaults to [NativeAdder], but you can select a [ParallelPrefixAdder] of your choice.
- `seGen`: type of sign extension routine used, base class is [PartialProductSignExtension].
- `ppTree`: used to specify the type of ['ParallelPrefix'](https://intel.github.io/rohd-hcl/rohd_hcl/ParallelPrefix-class.html) used in the other critical functions like leading-one detect.
6 changes: 4 additions & 2 deletions lib/src/arbiters/arbiter.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2023-2024 Intel Corporation
// Copyright (C) 2023-2025 Intel Corporation
// SPDX-License-Identifier: BSD-3-Clause
//
// arbiter.dart
Expand Down Expand Up @@ -32,7 +32,9 @@ abstract class Arbiter extends Module {

/// Constructs an arbiter where each element in [requests] is a one-bit signal
/// requesting a corresponding bit from [grants].
Arbiter(List<Logic> requests, {super.name = 'arbiter'}) {
Arbiter(List<Logic> requests,
{super.name = 'arbiter', String? definitionName})
: super(definitionName: definitionName ?? 'Arbiter_W${requests.length}') {
for (var i = 0; i < requests.length; i++) {
if (requests[i].width != 1) {
throw RohdHclException('Each request must be 1 bit,'
Expand Down
5 changes: 3 additions & 2 deletions lib/src/arbiters/mask_round_robin_arbiter.dart
desmonddak marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2023-2024 Intel Corporation
// Copyright (C) 2023-2025 Intel Corporation
// SPDX-License-Identifier: BSD-3-Clause
//
// mask_round_robin_arbiter.dart
Expand Down Expand Up @@ -34,7 +34,8 @@ class MaskRoundRobinArbiter extends StatefulArbiter
/// and keeping record of requests already granted, in order to mask it until
/// granting the turn of each request to start again
MaskRoundRobinArbiter(super.requests,
{required super.clk, required super.reset}) {
{required super.clk, required super.reset})
: super(definitionName: 'MaskRoundRobinArbiter_W${requests.length}') {
_requestMask = List.generate(count, (i) => Logic(name: 'requestMask$i'));
_grantMask = List.generate(count, (i) => Logic(name: 'grantMask$i'));
Sequential(clk, [
Expand Down
5 changes: 3 additions & 2 deletions lib/src/arbiters/priority_arbiter.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2023-2024 Intel Corporation
// Copyright (C) 2023-2025 Intel Corporation
// SPDX-License-Identifier: BSD-3-Clause
//
// priority_arbiter.dart
Expand All @@ -14,7 +14,8 @@ import 'package:rohd_hcl/rohd_hcl.dart';
class PriorityArbiter extends Arbiter {
/// Constructs an arbiter where the grant is given to the lowest-indexed
/// request.
PriorityArbiter(super.requests, {super.name = 'priority_arbiter'}) {
PriorityArbiter(super.requests, {super.name = 'priority_arbiter'})
: super(definitionName: 'PriorityArbiter_W${requests.length}') {
Combinational([
CaseZ(requests.rswizzle(), conditionalType: ConditionalType.priority, [
for (var i = 0; i < count; i++)
Expand Down
5 changes: 3 additions & 2 deletions lib/src/arbiters/rotate_round_robin_arbiter.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2023-2024 Intel Corporation
// Copyright (C) 2023-2025 Intel Corporation
// SPDX-License-Identifier: BSD-3-Clause
//
// rotate_round_robin_arbiter.dart
Expand All @@ -15,7 +15,8 @@ class RotateRoundRobinArbiter extends StatefulArbiter
implements RoundRobinArbiter {
/// Creates an [Arbiter] that fairly takes turns between [requests].
RotateRoundRobinArbiter(super.requests,
{required super.clk, required super.reset}) {
{required super.clk, required super.reset})
: super(definitionName: 'RotateRoundRobinArbiter_W${requests.length}') {
final preference = Logic(name: 'preference', width: log2Ceil(count));

final rotatedReqs = requests
Expand Down
8 changes: 6 additions & 2 deletions lib/src/arbiters/stateful_arbiter.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2023-2024 Intel Corporation
// Copyright (C) 2023-2025 Intel Corporation
// SPDX-License-Identifier: BSD-3-Clause
//
// stateful_arbiter.dart
Expand Down Expand Up @@ -26,7 +26,11 @@ abstract class StatefulArbiter extends Arbiter {
late final Logic reset = input('reset');

/// Creates a new [StatefulArbiter] with associated [clk] and [reset].
StatefulArbiter(super.requests, {required Logic clk, required Logic reset}) {
StatefulArbiter(super.requests,
{required Logic clk, required Logic reset, String? definitionName})
: super(
definitionName:
definitionName ?? 'StatefulArbiter_W${requests.length}') {
addInput('clk', clk);
addInput('reset', reset);
}
Expand Down
6 changes: 4 additions & 2 deletions lib/src/arithmetic/adder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ abstract class Adder extends Module {

/// Takes in input [a] and input [b] and return the [sum] of the addition
/// result. The width of input [a] and [b] must be the same.
Adder(Logic a, Logic b, {Logic? carryIn, super.name}) : super() {
Adder(Logic a, Logic b, {Logic? carryIn, super.name, String? definitionName})
: super(definitionName: definitionName ?? 'Adder_W${a.width}') {
if (a.width != b.width) {
throw RohdHclException('inputs of a and b should have same width.');
}
Expand Down Expand Up @@ -72,7 +73,8 @@ class FullAdder extends Adder {
/// into other modules as a parameter for using the native operation.
class NativeAdder extends Adder {
/// The width of input [a] and [b] must be the same.
NativeAdder(super.a, super.b, {super.carryIn, super.name = 'native_adder'}) {
NativeAdder(super.a, super.b, {super.carryIn, super.name = 'native_adder'})
: super(definitionName: 'NativeAdder_W${a.width}') {
if (a.width != b.width) {
throw RohdHclException('inputs of a and b should have same width.');
}
Expand Down
5 changes: 4 additions & 1 deletion lib/src/arithmetic/carry_save_mutiplier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ class CarrySaveMultiplier extends Multiplier {
{required Logic clk,
required Logic reset,
super.name = 'carry_save_multiplier'})
: super(signedMultiplicand: false, signedMultiplier: false) {
: super(
signedMultiplicand: false,
signedMultiplier: false,
definitionName: 'CarrySaveMultiplier_W${a.width}') {
if (a.width != b.width) {
throw RohdHclException('inputs of a and b should have same width.');
}
Expand Down
6 changes: 4 additions & 2 deletions lib/src/arithmetic/divider.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2024 Intel Corporation
// Copyright (C) 2024-2025 Intel Corporation
// SPDX-License-Identifier: BSD-3-Clause
//
// divider.dart
Expand Down Expand Up @@ -128,7 +128,9 @@ class MultiCycleDivider extends Module {
MultiCycleDivider(MultiCycleDividerInterface interface)
: dataWidth = interface.dataWidth,
logDataWidth = log2Ceil(interface.dataWidth),
super(name: 'divider') {
super(
name: 'divider',
definitionName: 'MultiCycleDivider_W${interface.dataWidth}') {
intf = MultiCycleDividerInterface.match(interface)
..pairConnectIO(
this,
Expand Down
5 changes: 4 additions & 1 deletion lib/src/arithmetic/fixed_to_float.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ class FixedToFloat extends Module {
FixedToFloat(FixedPoint fixed,
{required this.exponentWidth,
required this.mantissaWidth,
super.name = 'FixedToFloat'}) {
super.name = 'FixedToFloat'})
: super(
definitionName:
'Fixed${fixed.width}ToFloatE${exponentWidth}M$mantissaWidth') {
desmonddak marked this conversation as resolved.
Show resolved Hide resolved
fixed = fixed.clone()..gets(addInput('fixed', fixed, width: fixed.width));
addOutput('float', width: _float.width) <= _float;

Expand Down
5 changes: 4 additions & 1 deletion lib/src/arithmetic/float_to_fixed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ class FloatToFixed extends Module {
late final FixedPoint fixed = _fixed.clone()..gets(output('fixed'));

/// Constructor
FloatToFixed(FloatingPoint float, {super.name = 'FloatToFixed'}) {
FloatToFixed(FloatingPoint float, {super.name = 'FloatToFixed'})
: super(
definitionName: 'FloatE${float.exponent.width}'
'M${float.mantissa.width}ToFixed') {
float = float.clone()..gets(addInput('float', float, width: float.width));

final bias = FloatingPointValue.computeBias(float.exponent.width);
Expand Down
8 changes: 6 additions & 2 deletions lib/src/arithmetic/floating_point/floating_point_adder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,14 @@ abstract class FloatingPointAdder extends Module {
{Logic? clk,
Logic? reset,
Logic? enable,
super.name = 'floating_point_adder'})
super.name = 'floating_point_adder',
String? definitionName})
: exponentWidth = a.exponent.width,
mantissaWidth = a.mantissa.width,
super() {
super(
definitionName: definitionName ??
'FloatingPointAdder_E${a.exponent.width}'
'M${a.mantissa.width}') {
if (b.exponent.width != exponentWidth ||
b.mantissa.width != mantissaWidth) {
throw RohdHclException('FloatingPoint widths must match');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ class FloatingPointAdderRound extends FloatingPointAdder {
ParallelPrefix Function(
List<Logic> inps, Logic Function(Logic term1, Logic term2) op)
ppTree = KoggeStone.new,
super.name = 'floating_point_adder_round'}) {
super.name = 'floating_point_adder_round'})
: super(
definitionName: 'FloatingPointAdderRound_'
'E${a.exponent.width}M${a.mantissa.width}') {
final outputSum = FloatingPoint(
exponentWidth: exponentWidth, mantissaWidth: mantissaWidth);
output('sum') <= outputSum;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ class FloatingPointAdderSimple extends FloatingPointAdder {
List<Logic> inps, Logic Function(Logic term1, Logic term2) op)
ppTree = KoggeStone.new,
super.name = 'floatingpoint_adder_simple'})
: super() {
: super(
definitionName: 'FloatingPointAdderSimple_'
'E${a.exponent.width}M${a.mantissa.width}') {
final outputSum = FloatingPoint(
exponentWidth: exponentWidth,
mantissaWidth: mantissaWidth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ abstract class FloatingPointMultiplier extends Module {
// ignore: avoid_unused_constructor_parameters
ParallelPrefix Function(List<Logic>, Logic Function(Logic, Logic)) ppGen =
KoggeStone.new,
super.name = 'floating_point_multiplier'}) {
super.name = 'floating_point_multiplier',
String? definitionName})
: super(
definitionName: definitionName ??
'FloatingPointMultiplier_E${a.exponent.width}'
desmonddak marked this conversation as resolved.
Show resolved Hide resolved
'M${a.mantissa.width}') {
if (b.exponent.width != a.exponent.width ||
b.mantissa.width != a.mantissa.width) {
throw RohdHclException('FloatingPoint widths must match');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ class FloatingPointMultiplierSimple extends FloatingPointMultiplier {
ParallelPrefix Function(
List<Logic> inps, Logic Function(Logic term1, Logic term2) op)
ppTree = KoggeStone.new,
super.name}) {
super.name})
: super(
definitionName: 'FloatingPointMultiplierSimple_'
'E${a.exponent.width}M${a.mantissa.width}'
'${outProduct != null ? '_OE${outProduct.exponent.width}_'
'OM${outProduct.mantissa.width}' : ''}') {
if (exponentWidth < a.exponent.width) {
throw RohdHclException('product exponent width must be >= '
' input exponent width');
Expand Down
26 changes: 22 additions & 4 deletions lib/src/arithmetic/multiplier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ abstract class Multiplier extends Module {
this.signedMultiplier = false,
Logic? selectSignedMultiplicand,
Logic? selectSignedMultiplier,
super.name = 'multiplier'}) {
super.name = 'multiplier',
String? definitionName})
: super(
definitionName:
definitionName ?? 'Multiplier_W${a.width}x${b.width}') {
if (signedMultiplicand && (selectSignedMultiplicand != null)) {
throw RohdHclException('multiplicand sign reconfiguration requires '
'signedMultiplicand=false');
Expand Down Expand Up @@ -136,7 +140,8 @@ class NativeMultiplier extends Multiplier {
super.signedMultiplier = false,
super.selectSignedMultiplicand,
super.selectSignedMultiplier,
super.name = 'native_multiplier'}) {
super.name = 'native_multiplier'})
: super(definitionName: 'NativeMultiplier_W${a.width}') {
if (a.width != b.width) {
throw RohdHclException('inputs of a and b should have same width.');
}
Expand Down Expand Up @@ -267,7 +272,12 @@ abstract class MultiplyAccumulate extends Module {
Logic? selectSignedMultiplicand,
Logic? selectSignedMultiplier,
Logic? selectSignedAddend,
super.name}) {
super.name,
String? definitionName})
: super(
definitionName: definitionName ??
'MultiplyAccumulate_W${a.width}x${b.width}_'
'Acc${c.width}') {
this.clk = (clk != null) ? addInput('clk', clk) : null;
this.reset = (reset != null) ? addInput('reset', reset) : null;
this.enable = (enable != null) ? addInput('enable', enable) : null;
Expand Down Expand Up @@ -343,7 +353,15 @@ class CompressionTreeMultiplier extends Multiplier {
PartialProductSignExtension Function(PartialProductGeneratorBase pp,
{String name})
seGen = CompactRectSignExtension.new,
super.name = 'compression_tree_multiplier'}) {
super.name = 'compression_tree_multiplier'})
: super(
definitionName: 'CompressionTreeMultiplier_W${a.width}x'
'${b.width}_'
'${signedMultiplicand ? 'SD_' : ''}'
'${signedMultiplier ? 'SM_' : ''}'
'${selectSignedMultiplicand != null ? 'SSD_' : ''}'
'${selectSignedMultiplier != null ? 'SSM_' : ''}'
'with${adderGen(a, b).definitionName}') {
// Should be done in base TODO(desmonddak):
final product = addOutput('product', width: a.width + b.width);
final pp = PartialProductGenerator(
Expand Down
3 changes: 2 additions & 1 deletion lib/src/arithmetic/ones_complement_adder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ class OnesComplementAdder extends Adder {
Logic? carryOut,
Logic? carryIn,
bool? subtract,
super.name = 'ones_complement_adder'}) {
super.name = 'ones_complement_adder'})
: super(definitionName: 'OnesComplementAdder_W${a.width}') {
if (subtractIn != null) {
subtractIn = addInput('subtractIn', subtractIn);
}
Expand Down
23 changes: 16 additions & 7 deletions lib/src/arithmetic/parallel_prefix_operations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ class ParallelPrefix extends Module {
List<Logic> get val => UnmodifiableListView(_oseq);

/// ParallePrefix recursion
ParallelPrefix(List<Logic> inps, String name) : super(name: name) {
ParallelPrefix(List<Logic> inps, String name)
: super(
name: name,
definitionName: 'ParallelPrefix_${name}_W${inps.length}') {
if (inps.isEmpty) {
throw Exception("Don't use {name} with an empty sequence");
}
Expand Down Expand Up @@ -169,7 +172,8 @@ class ParallelPrefixOrScan extends Module {
{ParallelPrefix Function(
List<Logic> inps, Logic Function(Logic term1, Logic term2) op)
ppGen = KoggeStone.new,
super.name = 'parallel_prefix_orscan'}) {
super.name = 'parallel_prefix_orscan'})
: super(definitionName: 'ParallelPrefixOrScan_W${inp.width}') {
inp = addInput('inp', inp, width: inp.width);
final u = ppGen(inp.elements, (a, b) => a | b);
addOutput('out', width: inp.width) <= u.val.rswizzle();
Expand All @@ -187,7 +191,8 @@ class ParallelPrefixPriorityFinder extends Module {
{ParallelPrefix Function(
List<Logic> inps, Logic Function(Logic term1, Logic term2) op)
ppGen = KoggeStone.new,
super.name = 'parallel_prefix_finder'}) {
super.name = 'parallel_prefix_finder'})
: super(definitionName: 'ParallelPrefixPriorityFinder_W${inp.width}') {
inp = addInput('inp', inp, width: inp.width);
final u = ParallelPrefixOrScan(inp, ppGen: ppGen);
addOutput('out', width: inp.width) <=
Expand Down Expand Up @@ -219,7 +224,8 @@ class ParallelPrefixPriorityEncoder extends Module {
List<Logic> inps, Logic Function(Logic term1, Logic term2) op)
ppGen = KoggeStone.new,
Logic? valid,
super.name = 'parallel_prefix_encoder'}) {
super.name = 'parallel_prefix_encoder'})
: super(definitionName: 'ParallelPrefixPriorityEncoder_W${inp.width}') {
inp = addInput('inp', inp, width: inp.width);
final sz = log2Ceil(inp.width + 1);
addOutput('out', width: sz);
Expand Down Expand Up @@ -249,7 +255,8 @@ class ParallelPrefixAdder extends Adder {
ParallelPrefix Function(
List<Logic> inps, Logic Function(Logic term1, Logic term2) op)
ppGen = KoggeStone.new,
super.name = 'parallel_prefix_adder'}) {
super.name = 'parallel_prefix_adder'})
: super(definitionName: 'ParallelPrefixAdder_W${a.width}') {
final l = List<Logic>.generate(a.width - 1,
(i) => [a[i + 1] & b[i + 1], a[i + 1] | b[i + 1]].swizzle());
final cin = carryIn ?? Const(0);
Expand Down Expand Up @@ -286,7 +293,8 @@ class ParallelPrefixIncr extends Module {
{ParallelPrefix Function(
List<Logic> inps, Logic Function(Logic term1, Logic term2) op)
ppGen = KoggeStone.new,
super.name = 'parallel_prefix_incr'}) {
super.name = 'parallel_prefix_incr'})
: super(definitionName: 'ParallelPrefixIncr_W${inp.width}') {
inp = addInput('inp', inp, width: inp.width);
final u = ppGen(inp.elements, (lhs, rhs) => rhs & lhs);
addOutput('out', width: inp.width) <=
Expand All @@ -308,7 +316,8 @@ class ParallelPrefixDecr extends Module {
{ParallelPrefix Function(
List<Logic> inps, Logic Function(Logic term1, Logic term2) op)
ppGen = KoggeStone.new,
super.name = 'parallel_prefix_decr'}) {
super.name = 'parallel_prefix_decr'})
: super(definitionName: 'ParallelPrefixDecr_W${inp.width}') {
inp = addInput('inp', inp, width: inp.width);
final u = ppGen((~inp).elements, (lhs, rhs) => rhs & lhs);
addOutput('out', width: inp.width) <=
Expand Down
Loading
Loading