From 1b2a183d45a9e89d64c0437aa3c109cedb783d71 Mon Sep 17 00:00:00 2001 From: "Desmond A. Kirkpatrick" Date: Thu, 7 Nov 2024 09:01:30 -0800 Subject: [PATCH 1/3] bug fix for fp8e4m3 --- .../floating_point_values/floating_point_8_value.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/src/arithmetic/floating_point/floating_point_values/floating_point_8_value.dart b/lib/src/arithmetic/floating_point/floating_point_values/floating_point_8_value.dart index 69d6dd96d..2d61f6d59 100644 --- a/lib/src/arithmetic/floating_point/floating_point_values/floating_point_8_value.dart +++ b/lib/src/arithmetic/floating_point/floating_point_values/floating_point_8_value.dart @@ -61,12 +61,14 @@ class FloatingPoint8E4M3Value extends FloatingPointValue { /// binary representation FloatingPoint8E4M3Value.ofBigInts(super.exponent, super.mantissa, {super.sign}) - : super.ofBigInts(); + : super.ofBigInts( + exponentWidth: exponentWidth, mantissaWidth: mantissaWidth); /// [FloatingPoint8E4M3Value] constructor from a set of [int]s of the binary /// representation FloatingPoint8E4M3Value.ofInts(super.exponent, super.mantissa, {super.sign}) - : super.ofInts(); + : super.ofInts( + exponentWidth: exponentWidth, mantissaWidth: mantissaWidth); /// Numeric conversion of a [FloatingPoint8E4M3Value] from a host double factory FloatingPoint8E4M3Value.ofDouble(double inDouble) { From 7b7f71a97175c2e41eeb0de5bf70da04145b9857 Mon Sep 17 00:00:00 2001 From: "Desmond A. Kirkpatrick" Date: Mon, 11 Nov 2024 15:51:10 -0800 Subject: [PATCH 2/3] fp fixes --- lib/rohd_hcl.dart | 4 ++ lib/src/arithmetic/arithmetic.dart | 2 + lib/src/arithmetic/compound_adder.dart | 2 +- .../floating_point/floating_point.dart | 2 - .../floating_point_adder_round.dart | 40 ++++++++++-------- .../floating_point_adder_simple.dart | 2 +- lib/src/arithmetic/multiplier.dart | 14 ++----- lib/src/arithmetic/ones_complement_adder.dart | 6 +-- .../parallel_prefix_operations.dart | 42 ++++++------------- lib/src/arithmetic/sign_magnitude_adder.dart | 6 +-- .../floating_point_logic.dart | 0 .../floating_point_16_value.dart | 0 .../floating_point_32_value.dart | 0 .../floating_point_64_value.dart | 0 .../floating_point_8_value.dart | 0 .../floating_point_bf16_value.dart | 0 .../floating_point_tf32_value.dart | 0 .../floating_point_value.dart | 0 .../floating_point_values.dart | 0 .../floating_point_adder_round_test.dart | 27 ++++-------- test/arithmetic/multiplier_test.dart | 33 +++++++++------ 21 files changed, 80 insertions(+), 100 deletions(-) rename lib/src/arithmetic/{floating_point => signals}/floating_point_logic.dart (100%) rename lib/src/arithmetic/{floating_point => values}/floating_point_values/floating_point_16_value.dart (100%) rename lib/src/arithmetic/{floating_point => values}/floating_point_values/floating_point_32_value.dart (100%) rename lib/src/arithmetic/{floating_point => values}/floating_point_values/floating_point_64_value.dart (100%) rename lib/src/arithmetic/{floating_point => values}/floating_point_values/floating_point_8_value.dart (100%) rename lib/src/arithmetic/{floating_point => values}/floating_point_values/floating_point_bf16_value.dart (100%) rename lib/src/arithmetic/{floating_point => values}/floating_point_values/floating_point_tf32_value.dart (100%) rename lib/src/arithmetic/{floating_point => values}/floating_point_values/floating_point_value.dart (100%) rename lib/src/arithmetic/{floating_point => values}/floating_point_values/floating_point_values.dart (100%) diff --git a/lib/rohd_hcl.dart b/lib/rohd_hcl.dart index 5b95a5fb6..3c4d44e74 100644 --- a/lib/rohd_hcl.dart +++ b/lib/rohd_hcl.dart @@ -3,6 +3,10 @@ export 'src/arbiters/arbiters.dart'; export 'src/arithmetic/arithmetic.dart'; +export 'src/arithmetic/signals/fixed_point_logic.dart'; +export 'src/arithmetic/signals/floating_point_logic.dart'; +export 'src/arithmetic/values/fixed_point_value.dart'; +export 'src/arithmetic/values/floating_point_values/floating_point_values.dart'; export 'src/binary_gray.dart'; export 'src/clock_gating.dart'; export 'src/component_config/component_config.dart'; diff --git a/lib/src/arithmetic/arithmetic.dart b/lib/src/arithmetic/arithmetic.dart index 77973a046..442d58019 100644 --- a/lib/src/arithmetic/arithmetic.dart +++ b/lib/src/arithmetic/arithmetic.dart @@ -16,4 +16,6 @@ export 'parallel_prefix_operations.dart'; export 'ripple_carry_adder.dart'; export 'sign_magnitude_adder.dart'; export 'signals/fixed_point_logic.dart'; +export 'signals/floating_point_logic.dart'; export 'values/fixed_point_value.dart'; +export 'values/floating_point_values/floating_point_values.dart'; diff --git a/lib/src/arithmetic/compound_adder.dart b/lib/src/arithmetic/compound_adder.dart index cf88c71b1..027ef6af5 100644 --- a/lib/src/arithmetic/compound_adder.dart +++ b/lib/src/arithmetic/compound_adder.dart @@ -19,7 +19,7 @@ abstract class CompoundAdder extends Adder { /// Takes in input [a] and input [b] and return the [sum] of the addition /// result and [sum1] sum + 1. /// The width of input [a] and [b] must be the same. - CompoundAdder(super.a, super.b, {super.name}) { + CompoundAdder(super.a, super.b, {super.name = 'compound_adders'}) { if (a.width != b.width) { throw RohdHclException('inputs of a and b should have same width.'); } diff --git a/lib/src/arithmetic/floating_point/floating_point.dart b/lib/src/arithmetic/floating_point/floating_point.dart index d7cce9002..3b850d9b6 100644 --- a/lib/src/arithmetic/floating_point/floating_point.dart +++ b/lib/src/arithmetic/floating_point/floating_point.dart @@ -3,5 +3,3 @@ export 'floating_point_adder_round.dart'; export 'floating_point_adder_simple.dart'; -export 'floating_point_logic.dart'; -export 'floating_point_values/floating_point_values.dart'; diff --git a/lib/src/arithmetic/floating_point/floating_point_adder_round.dart b/lib/src/arithmetic/floating_point/floating_point_adder_round.dart index 97ee9d48d..c979f3bbc 100644 --- a/lib/src/arithmetic/floating_point/floating_point_adder_round.dart +++ b/lib/src/arithmetic/floating_point/floating_point_adder_round.dart @@ -95,7 +95,7 @@ class FloatingPointAdderRound extends Module { Adder Function(Logic, Logic) adderGen = ParallelPrefixAdder.new, ParallelPrefix Function(List, Logic Function(Logic, Logic)) ppTree = KoggeStone.new, - super.name = 'floating_point_adder'}) + super.name = 'floating_point_adder_round'}) : exponentWidth = a.exponent.width, mantissaWidth = a.mantissa.width { if (b.exponent.width != exponentWidth || @@ -116,7 +116,7 @@ class FloatingPointAdderRound extends Module { addOutput('sum', width: _sum.width) <= _sum; final exponentSubtractor = OnesComplementAdder(a.exponent, b.exponent, - subtract: true, adderGen: adderGen); + subtract: true, adderGen: adderGen, name: 'exponent_sub'); final signDelta = exponentSubtractor.sign; final delta = exponentSubtractor.sum; @@ -183,14 +183,16 @@ class FloatingPointAdderRound extends Module { largeOperandLatched, smallerOperandRPathLatched, subtractIn: effectiveSubtractionLatched, carryOut: carryRPath, - adderGen: adderGen); + adderGen: adderGen, + name: 'rpath_significand_adder'); final lowBitsRPath = smallerAlignRPathLatched.slice(extendWidthRPath - 1, 0); final lowAdderRPath = OnesComplementAdder( carryRPath.zeroExtend(extendWidthRPath), mux(effectiveSubtractionLatched, ~lowBitsRPath, lowBitsRPath), - adderGen: adderGen); + adderGen: adderGen, + name: 'rpath_lowadder'); final preStickyRPath = lowAdderRPath.sum.slice(lowAdderRPath.sum.width - 4, 0).or(); @@ -235,22 +237,21 @@ class FloatingPointAdderRound extends Module { final firstZeroRPath = mux(selectRPath, ~sumP1RPath[-1], ~sumRPath[-1]); + final expDecr = ParallelPrefixDecr(largerExpLatched, + ppGen: ppTree, name: 'exp_decrement'); + final expIncr = ParallelPrefixIncr(largerExpLatched, + ppGen: ppTree, name: 'exp_increment'); final exponentRPath = Logic(width: exponentWidth); Combinational([ If.block([ // Subtract 1 from exponent - Iff(~incExpRPath & effectiveSubtractionLatched & firstZeroRPath, [ - exponentRPath < - ParallelPrefixDecr(largerExpLatched, ppGen: ppTree).out - ]), + Iff(~incExpRPath & effectiveSubtractionLatched & firstZeroRPath, + [exponentRPath < expDecr.out]), // Add 1 to exponent ElseIf( ~effectiveSubtractionLatched & (incExpRPath & firstZeroRPath | ~incExpRPath & ~firstZeroRPath), - [ - exponentRPath < - ParallelPrefixIncr(largerExpLatched, ppGen: ppTree).out - ]), + [exponentRPath < expIncr.out]), // Add 2 to exponent ElseIf(incExpRPath & effectiveSubtractionLatched & ~firstZeroRPath, [exponentRPath < largerExpLatched << 1]), @@ -270,14 +271,17 @@ class FloatingPointAdderRound extends Module { final significandSubtractorNPath = OnesComplementAdder( largeOperand, smallOperandNPath, - subtractIn: effectiveSubtraction, adderGen: adderGen); + subtractIn: effectiveSubtraction, + adderGen: adderGen, + name: 'npath_significand_sub'); final significandNPath = significandSubtractorNPath.sum.slice(smallOperandNPath.width - 1, 0); final leadOneNPath = mux( significandNPath.or(), - ParallelPrefixPriorityEncoder(significandNPath.reversed, ppGen: ppTree) + ParallelPrefixPriorityEncoder(significandNPath.reversed, + ppGen: ppTree, name: 'npath_leadingOne') .out .zeroExtend(exponentWidth), Const(15, width: exponentWidth)); @@ -297,7 +301,9 @@ class FloatingPointAdderRound extends Module { final expCalcNPath = OnesComplementAdder( largerExpLatched, leadOneNPathLatched.zeroExtend(exponentWidth), - subtractIn: effectiveSubtractionLatched, adderGen: adderGen); + subtractIn: effectiveSubtractionLatched, + adderGen: adderGen, + name: 'npath_expcalc'); final preExpNPath = expCalcNPath.sum.slice(exponentWidth - 1, 0); @@ -307,8 +313,8 @@ class FloatingPointAdderRound extends Module { final preMinShiftNPath = ~leadOneNPathLatched.or() | ~largerExpLatched.or(); - final minShiftNPath = mux(posExpNPath | preMinShiftNPath, - leadOneNPathLatched, largerExpLatched - 1); + final minShiftNPath = + mux(posExpNPath | preMinShiftNPath, leadOneNPathLatched, expDecr.out); final notSubnormalNPath = aIsNormalLatched | bIsNormalLatched; final shiftedSignificandNPath = diff --git a/lib/src/arithmetic/floating_point/floating_point_adder_simple.dart b/lib/src/arithmetic/floating_point/floating_point_adder_simple.dart index ddb0338dc..eaab7bb73 100644 --- a/lib/src/arithmetic/floating_point/floating_point_adder_simple.dart +++ b/lib/src/arithmetic/floating_point/floating_point_adder_simple.dart @@ -41,7 +41,7 @@ class FloatingPointAdderSimple extends Module { FloatingPointAdderSimple(FloatingPoint a, FloatingPoint b, {ParallelPrefix Function(List, Logic Function(Logic, Logic)) ppGen = KoggeStone.new, - super.name}) + super.name = 'floatingpoint_adder_simple'}) : exponentWidth = a.exponent.width, mantissaWidth = a.mantissa.width { if (b.exponent.width != exponentWidth || diff --git a/lib/src/arithmetic/multiplier.dart b/lib/src/arithmetic/multiplier.dart index f79f1ff44..dcc87754e 100644 --- a/lib/src/arithmetic/multiplier.dart +++ b/lib/src/arithmetic/multiplier.dart @@ -88,12 +88,8 @@ class CompressionTreeMultiplier extends Multiplier { {Logic? selectSigned, ParallelPrefix Function(List, Logic Function(Logic, Logic)) ppTree = KoggeStone.new, - super.signed = false}) - : super( - name: 'Compression Tree Multiplier: ' - 'R${radix}_${ppTree.call([ - Logic() - ], (a, b) => Logic()).runtimeType}') { + super.signed = false, + super.name = 'compression_tree_multiplier'}) { final product = addOutput('product', width: a.width + b.width); final pp = PartialProductGeneratorCompactRectSignExtension( a, b, RadixEncoder(radix), @@ -128,10 +124,8 @@ class CompressionTreeMultiplyAccumulate extends MultiplyAccumulate { {required super.signed, Logic? selectSigned, ParallelPrefix Function(List, Logic Function(Logic, Logic)) - ppTree = KoggeStone.new}) - : super( - name: 'Compression Tree Multiply Accumulate: ' - 'R${radix}_${ppTree.call([Logic()], (a, b) => Logic()).name}') { + ppTree = KoggeStone.new, + super.name = 'compression_tree_mac'}) { final accumulate = addOutput('accumulate', width: a.width + b.width + 1); final pp = PartialProductGeneratorCompactRectSignExtension( a, b, RadixEncoder(radix), diff --git a/lib/src/arithmetic/ones_complement_adder.dart b/lib/src/arithmetic/ones_complement_adder.dart index eead4be08..813aa6e03 100644 --- a/lib/src/arithmetic/ones_complement_adder.dart +++ b/lib/src/arithmetic/ones_complement_adder.dart @@ -34,10 +34,8 @@ class OnesComplementAdder extends Adder { {Adder Function(Logic, Logic) adderGen = ParallelPrefixAdder.new, Logic? subtractIn, Logic? carryOut, - bool subtract = false}) - : super( - name: 'Ones Complement Adder: ' - '${adderGen.call(Logic(), Logic()).name}') { + bool subtract = false, + super.name = 'ones_complement_adder'}) { if (subtractIn != null) { subtractIn = addInput('subtractIn', subtractIn); } diff --git a/lib/src/arithmetic/parallel_prefix_operations.dart b/lib/src/arithmetic/parallel_prefix_operations.dart index e1af39542..0be9c7509 100644 --- a/lib/src/arithmetic/parallel_prefix_operations.dart +++ b/lib/src/arithmetic/parallel_prefix_operations.dart @@ -163,11 +163,8 @@ class ParallelPrefixOrScan extends Module { /// OrScan constructor ParallelPrefixOrScan(Logic inp, {ParallelPrefix Function(List, Logic Function(Logic, Logic)) - ppGen = KoggeStone.new}) - : super( - name: 'ParallelPrefixOrScan: ${ppGen.call([ - Logic() - ], (a, b) => Logic()).name}') { + ppGen = KoggeStone.new, + super.name = 'parallel_prefix_orscan'}) { inp = addInput('inp', inp, width: inp.width); final u = ppGen(inp.elements, (a, b) => a | b); addOutput('out', width: inp.width) <= u.val.rswizzle(); @@ -183,11 +180,8 @@ class ParallelPrefixPriorityFinder extends Module { /// Priority Finder constructor ParallelPrefixPriorityFinder(Logic inp, {ParallelPrefix Function(List, Logic Function(Logic, Logic)) - ppGen = KoggeStone.new}) - : super( - name: 'ParallelPrefixFinder: ${ppGen.call([ - Logic() - ], (a, b) => Logic()).name}') { + ppGen = KoggeStone.new, + super.name = 'parallel_prefix_finder'}) { inp = addInput('inp', inp, width: inp.width); final u = ParallelPrefixOrScan(inp, ppGen: ppGen); addOutput('out', width: inp.width) <= (u.out & ~(u.out << Const(1))); @@ -203,11 +197,8 @@ class ParallelPrefixPriorityEncoder extends Module { /// PriorityEncoder constructor ParallelPrefixPriorityEncoder(Logic inp, {ParallelPrefix Function(List, Logic Function(Logic, Logic)) - ppGen = KoggeStone.new}) - : super( - name: 'ParallelPrefixEncoder: ${ppGen.call([ - Logic() - ], (a, b) => Logic()).name}') { + ppGen = KoggeStone.new, + super.name = 'parallel_prefix_encoder'}) { inp = addInput('inp', inp, width: inp.width); addOutput('out', width: log2Ceil(inp.width)); final u = ParallelPrefixPriorityFinder(inp, ppGen: ppGen); @@ -220,11 +211,8 @@ class ParallelPrefixAdder extends Adder { /// Adder constructor ParallelPrefixAdder(super.a, super.b, {ParallelPrefix Function(List, Logic Function(Logic, Logic)) - ppGen = KoggeStone.new}) - : super( - name: 'ParallelPrefixAdder: ${ppGen.call([ - Logic() - ], (a, b) => Logic()).name}') { + ppGen = KoggeStone.new, + super.name = 'parallel_prefix_adder'}) { final u = ppGen( List.generate( a.width, (i) => [a[i] & b[i], a[i] | b[i]].swizzle()), @@ -247,11 +235,8 @@ class ParallelPrefixIncr extends Module { /// Increment constructor ParallelPrefixIncr(Logic inp, {ParallelPrefix Function(List, Logic Function(Logic, Logic)) - ppGen = KoggeStone.new}) - : super( - name: 'ParallelPrefixIncr: ${ppGen.call([ - Logic() - ], (a, b) => Logic()).name}') { + ppGen = KoggeStone.new, + super.name = 'parallel_prefix_incr'}) { inp = addInput('inp', inp, width: inp.width); final u = ppGen(inp.elements, (lhs, rhs) => rhs & lhs); addOutput('out', width: inp.width) <= @@ -269,11 +254,8 @@ class ParallelPrefixDecr extends Module { /// Decrement constructor ParallelPrefixDecr(Logic inp, {ParallelPrefix Function(List, Logic Function(Logic, Logic)) - ppGen = KoggeStone.new}) - : super( - name: 'ParallelPrefixDecr: ${ppGen.call([ - Logic() - ], (a, b) => Logic()).name}') { + ppGen = KoggeStone.new, + super.name = 'parallel_prefix_decr'}) { inp = addInput('inp', inp, width: inp.width); final u = ppGen((~inp).elements, (lhs, rhs) => rhs & lhs); addOutput('out', width: inp.width) <= diff --git a/lib/src/arithmetic/sign_magnitude_adder.dart b/lib/src/arithmetic/sign_magnitude_adder.dart index 008dcd984..360f780e3 100644 --- a/lib/src/arithmetic/sign_magnitude_adder.dart +++ b/lib/src/arithmetic/sign_magnitude_adder.dart @@ -37,10 +37,8 @@ class SignMagnitudeAdder extends Adder { // TODO(desmonddak): this adder may need a carry-in for rounding SignMagnitudeAdder(this.aSign, super.a, this.bSign, super.b, Adder Function(Logic, Logic) adderGen, - {this.largestMagnitudeFirst = false}) - : super( - name: 'Sign Magnitude Adder: ' - '${adderGen.call(Logic(), Logic()).name}') { + {this.largestMagnitudeFirst = false, + super.name = 'sign_magnitude_adder'}) { aSign = addInput('aSign', aSign); bSign = addInput('bSign', bSign); _sign = addOutput('sign'); diff --git a/lib/src/arithmetic/floating_point/floating_point_logic.dart b/lib/src/arithmetic/signals/floating_point_logic.dart similarity index 100% rename from lib/src/arithmetic/floating_point/floating_point_logic.dart rename to lib/src/arithmetic/signals/floating_point_logic.dart diff --git a/lib/src/arithmetic/floating_point/floating_point_values/floating_point_16_value.dart b/lib/src/arithmetic/values/floating_point_values/floating_point_16_value.dart similarity index 100% rename from lib/src/arithmetic/floating_point/floating_point_values/floating_point_16_value.dart rename to lib/src/arithmetic/values/floating_point_values/floating_point_16_value.dart diff --git a/lib/src/arithmetic/floating_point/floating_point_values/floating_point_32_value.dart b/lib/src/arithmetic/values/floating_point_values/floating_point_32_value.dart similarity index 100% rename from lib/src/arithmetic/floating_point/floating_point_values/floating_point_32_value.dart rename to lib/src/arithmetic/values/floating_point_values/floating_point_32_value.dart diff --git a/lib/src/arithmetic/floating_point/floating_point_values/floating_point_64_value.dart b/lib/src/arithmetic/values/floating_point_values/floating_point_64_value.dart similarity index 100% rename from lib/src/arithmetic/floating_point/floating_point_values/floating_point_64_value.dart rename to lib/src/arithmetic/values/floating_point_values/floating_point_64_value.dart diff --git a/lib/src/arithmetic/floating_point/floating_point_values/floating_point_8_value.dart b/lib/src/arithmetic/values/floating_point_values/floating_point_8_value.dart similarity index 100% rename from lib/src/arithmetic/floating_point/floating_point_values/floating_point_8_value.dart rename to lib/src/arithmetic/values/floating_point_values/floating_point_8_value.dart diff --git a/lib/src/arithmetic/floating_point/floating_point_values/floating_point_bf16_value.dart b/lib/src/arithmetic/values/floating_point_values/floating_point_bf16_value.dart similarity index 100% rename from lib/src/arithmetic/floating_point/floating_point_values/floating_point_bf16_value.dart rename to lib/src/arithmetic/values/floating_point_values/floating_point_bf16_value.dart diff --git a/lib/src/arithmetic/floating_point/floating_point_values/floating_point_tf32_value.dart b/lib/src/arithmetic/values/floating_point_values/floating_point_tf32_value.dart similarity index 100% rename from lib/src/arithmetic/floating_point/floating_point_values/floating_point_tf32_value.dart rename to lib/src/arithmetic/values/floating_point_values/floating_point_tf32_value.dart diff --git a/lib/src/arithmetic/floating_point/floating_point_values/floating_point_value.dart b/lib/src/arithmetic/values/floating_point_values/floating_point_value.dart similarity index 100% rename from lib/src/arithmetic/floating_point/floating_point_values/floating_point_value.dart rename to lib/src/arithmetic/values/floating_point_values/floating_point_value.dart diff --git a/lib/src/arithmetic/floating_point/floating_point_values/floating_point_values.dart b/lib/src/arithmetic/values/floating_point_values/floating_point_values.dart similarity index 100% rename from lib/src/arithmetic/floating_point/floating_point_values/floating_point_values.dart rename to lib/src/arithmetic/values/floating_point_values/floating_point_values.dart diff --git a/test/arithmetic/floating_point/floating_point_adder_round_test.dart b/test/arithmetic/floating_point/floating_point_adder_round_test.dart index a45fe4c99..29c6aacc5 100644 --- a/test/arithmetic/floating_point/floating_point_adder_round_test.dart +++ b/test/arithmetic/floating_point/floating_point_adder_round_test.dart @@ -8,6 +8,7 @@ // Author: Desmond A Kirkpatrick (a, b) => CompressionTreeMultiplier(a, b, radix, - selectSigned: selectSigned, ppTree: ppTree, signed: signed); + selectSigned: selectSigned, + ppTree: ppTree, + signed: signed, + name: 'Compression Tree Multiplier: ${ppTree.call([ + Logic() + ], (a, b) => Logic()).name}'); MultiplyAccumulateCallback curryMultiplierAsMultiplyAccumulate( int radix, - Logic? selectSign, ParallelPrefix Function(List, Logic Function(Logic, Logic)) ppTree, - {required bool signed}) => + {required bool signed, + Logic? selectSign}) => (a, b, c) => MutiplyOnly( a, b, @@ -128,15 +133,19 @@ void main() { selectSigned: selectSign, signed: signed)); MultiplyAccumulateCallback curryMultiplyAccumulate( - int radix, - Logic? selectSign, - ParallelPrefix Function(List, Logic Function(Logic, Logic)) - ppTree, - {required bool signed}) => + int radix, + ParallelPrefix Function(List, Logic Function(Logic, Logic)) ppTree, { + required bool signed, + Logic? selectSign, + }) => (a, b, c) => CompressionTreeMultiplyAccumulate(a, b, c, radix, - selectSigned: selectSign, ppTree: ppTree, signed: signed); + selectSigned: selectSign, + ppTree: ppTree, + signed: signed, + name: 'Compression Tree MAC: ${ppTree.call([ + Logic() + ], (a, b) => Logic()).name}'); - // TODO(desmonddak): fix the selectSign null group('Curried Test of Compression Tree Multiplier', () { for (final signed in [false, true]) { for (final radix in [2, 16]) { @@ -145,7 +154,7 @@ void main() { testMultiplyAccumulateRandom( width, 10, - curryMultiplierAsMultiplyAccumulate(radix, null, ppTree, + curryMultiplierAsMultiplyAccumulate(radix, ppTree, signed: signed)); } } @@ -159,7 +168,7 @@ void main() { for (final width in [5, 6]) { for (final ppTree in [KoggeStone.new, BrentKung.new]) { testMultiplyAccumulateRandom(width, 10, - curryMultiplyAccumulate(radix, null, ppTree, signed: signed)); + curryMultiplyAccumulate(radix, ppTree, signed: signed)); } } } From 90eb653389f96f607baf4e43e51320bbfecf06d3 Mon Sep 17 00:00:00 2001 From: "Desmond A. Kirkpatrick" Date: Tue, 12 Nov 2024 10:45:15 -0800 Subject: [PATCH 3/3] small test improvement, doc fix --- lib/rohd_hcl.dart | 5 +---- .../floating_point/floating_point_adder_round_test.dart | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/rohd_hcl.dart b/lib/rohd_hcl.dart index 3c4d44e74..557793041 100644 --- a/lib/rohd_hcl.dart +++ b/lib/rohd_hcl.dart @@ -3,10 +3,7 @@ export 'src/arbiters/arbiters.dart'; export 'src/arithmetic/arithmetic.dart'; -export 'src/arithmetic/signals/fixed_point_logic.dart'; -export 'src/arithmetic/signals/floating_point_logic.dart'; -export 'src/arithmetic/values/fixed_point_value.dart'; -export 'src/arithmetic/values/floating_point_values/floating_point_values.dart'; + export 'src/binary_gray.dart'; export 'src/clock_gating.dart'; export 'src/component_config/component_config.dart'; diff --git a/test/arithmetic/floating_point/floating_point_adder_round_test.dart b/test/arithmetic/floating_point/floating_point_adder_round_test.dart index 29c6aacc5..ef86b89c9 100644 --- a/test/arithmetic/floating_point/floating_point_adder_round_test.dart +++ b/test/arithmetic/floating_point/floating_point_adder_round_test.dart @@ -2,7 +2,7 @@ // SPDX-License-Identifier: BSD-3-Clause // // floating_point_rnd_test.dart -// Tests of FloatingPointAdderRnd -- a rounding FP Adder. +// Tests of FloatingPointAdderRound -- a rounding FP Adder. // // 2024 August 30 // Author: Desmond A Kirkpatrick