-
Notifications
You must be signed in to change notification settings - Fork 25
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
42compress #142
Open
desmonddak
wants to merge
18
commits into
intel:main
Choose a base branch
from
desmonddak:42compress
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
42compress #142
Changes from 5 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
5668789
4:2 compressors working
desmonddak 73aac77
BitCompressors use terms instead of bitvector
desmonddak 0658a17
fix unused variable
desmonddak c98c7dd
add use42Compressors to configurator and resolve trace error
desmonddak ffe15af
typos
desmonddak d562567
4:2 compressors validate
ganewto 3dd5a04
Merge branch 'main' into 42compress
ganewto d23fd0c
some code cleanup (e.g., commented out already)
ganewto 219c84e
Merge branch 'main' into 42compress
desmonddak 7f85a6e
make LogicValue extensions private to test file
desmonddak 1cfbeef
Merge branch '42compress' of https://github.com/desmonddak/rohd-hcl i…
desmonddak 1d52ff5
merge fixes
desmonddak 94c2b9f
Merge branch '42compress' of https://github.com/desmonddak/rohd-hcl i…
desmonddak 252be00
cleanup logicvalue extension
desmonddak a34bc10
Merge branch 'main' into 42compress
desmonddak 0bf12e0
fixed merge issues from web edits
desmonddak eaa6cdc
pattern for generating cin for compressor4 worked, but would not exte…
desmonddak 21081a8
remove unused import dart:io used for checking Verilog output
desmonddak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright (C) 2025 Intel Corporation | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
// | ||
// logicvalue_extension.dart | ||
// Utilities for LogicValue as an extension. | ||
// | ||
// 2025 January 31 | ||
// Author: Desmond Kirkpatrick <[email protected]> | ||
|
||
import 'package:rohd/rohd.dart'; | ||
import 'package:rohd_hcl/rohd_hcl.dart'; | ||
|
||
/// This extension will eventually move to ROHD once it is proven useful | ||
extension LogicValueMajority on LogicValue { | ||
/// Compute the unary majority on LogicValue | ||
bool majority() { | ||
if (!isValid) { | ||
return false; | ||
} | ||
final zero = LogicValue.filled(width, LogicValue.zero); | ||
var shiftedValue = this; | ||
var result = 0; | ||
while (shiftedValue != zero) { | ||
result += (shiftedValue[0] & LogicValue.one == LogicValue.one) ? 1 : 0; | ||
shiftedValue >>>= 1; | ||
} | ||
return result > (width ~/ 2); | ||
} | ||
|
||
/// Compute the first One find operation on LogicValue, returning its position | ||
int? firstOne() { | ||
if (!isValid) { | ||
return null; | ||
} | ||
var shiftedValue = this; | ||
var result = 0; | ||
while (shiftedValue[0] != LogicValue.one) { | ||
result++; | ||
if (result == width) { | ||
return null; | ||
} | ||
shiftedValue >>>= 1; | ||
} | ||
return result; | ||
} | ||
|
||
/// Return the populationCount of 1s in a LogicValue | ||
int popCount() { | ||
final r = RegExp('1'); | ||
final matches = r.allMatches(bitString); | ||
return matches.length; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this call to
adderGen
i think will actually construct an adder connected to those ports, which could lead to additional verilog generation (outside of the module, even) and also slow down simulation since it's simulating a whole additional adder. i think i remember seeing this pattern in a few other places as well and didnt think it through.