feat: add qualified Popcount and round-robin PYC primitives - #71
Open
HKU-LiBoyu wants to merge 1 commit into
Open
feat: add qualified Popcount and round-robin PYC primitives#71HKU-LiBoyu wants to merge 1 commit into
HKU-LiBoyu wants to merge 1 commit into
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR adds the pyCircuit implementation half of the qualified primitive vertical slice paired with PTO-ISA/agentic-circuit#18:
pyc.popcountandpyc.rr_arbiterto the PYC MLIR dialect with verifier checks for integer widths, legal popcount result width, arbiter request/grant width, cursor width, and the supported 2..64 input range.pyc::cpp::popcount<OutWidth, InWidth>andpyc::cpp::rr_arbiter<NumInputs, PointerWidth>calls.pyccprimitive packaging so generated RTL instantiates the parameterized primitives and includes their source files.Files changed
compiler/mlir/include/pyc/Dialect/PYC/PYCOps.td,compiler/mlir/lib/Dialect/PYC/PYCOps.cppcompiler/mlir/lib/Emit/CppEmitter.cpp,compiler/mlir/lib/Emit/VerilogEmitter.cppcompiler/mlir/tools/pycc.cppruntime/cpp/pyc_primitives.hppruntime/verilog/pyc_popcount.v,runtime/verilog/pyc_rr_arbiter.vContract
pyc.popcount: integer input widthWproducesceil(log2(W + 1))bits.pyc.rr_arbiter: packedreq[N-1:0], packedcursor[ceil(log2(N))-1:0], one-hotgrant[N-1:0], with2 <= N <= 64; invalid cursor values normalize to zero for non-power-of-twoN.Validation
prep/check/stat: 0 problems.mlir-tblgenPYC dialect syntax check: passed.The paired agentic-circuit lowering and ACIR fixtures are in PTO-ISA/agentic-circuit#18.