Skip to content

Unsigned and Signed#271

Draft
ktbarrett wants to merge 6 commits into
devfrom
unsigned-signed
Draft

Unsigned and Signed#271
ktbarrett wants to merge 6 commits into
devfrom
unsigned-signed

Conversation

@ktbarrett

@ktbarrett ktbarrett commented Jun 8, 2026

Copy link
Copy Markdown
Owner

Closes #191.

These are useful for implementing a bunch of features currently found in cocotb's LogicArray (e.g. from_unsigned, to_unsigned) that we for binding coconext's DynLogicArray to Python in a way it can sit in place of cocotb's using the patcher.

This just uses uint64_t and int64_t. We will adapt UInt, and SInt from #278 once it's done.

@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.72%. Comparing base (3cd984a) to head (a5b17ca).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #271   +/-   ##
=======================================
  Coverage   91.72%   91.72%           
=======================================
  Files          23       23           
  Lines        1317     1317           
  Branches      330      330           
=======================================
  Hits         1208     1208           
  Misses         47       47           
  Partials       62       62           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ZiaCheemaGit ZiaCheemaGit mentioned this pull request Jun 25, 2026

@ktbarrett ktbarrett left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shape looks good.

Comment thread cpp/include/coconext/types.hpp
Comment on lines +126 to +129
for (auto const& bit : other) {
temp_bit = bit ? 1 : 0;
value_ = (value_ << 1) | temp_bit;
}

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welp, I guess we should move BitArray over to Bits as well now.

@ZiaCheemaGit ZiaCheemaGit Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrap BitArray around Bits? A packed Bitarray rework was mentioned in the unsigned signed docs. That is a similar thing?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's similar. Right now the implicit upcast is kind of an expensive operation. If everything was just Bits under the hood, we can just copy/move the Bits object around.

Comment thread cpp/include/coconext/types/unsigned.hpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Signed/Unsigned datatypes

2 participants