Skip to content

Add support for method output port splitting#1

Open
krame505 wants to merge 57 commits into
krame505:genwrapfrom
MatX-inc:split-output-ports
Open

Add support for method output port splitting#1
krame505 wants to merge 57 commits into
krame505:genwrapfrom
MatX-inc:split-output-ports

Conversation

@krame505

@krame505 krame505 commented Jan 8, 2026

Copy link
Copy Markdown
Owner

This pull request is based on the input port splitting branch on my fork of bsc, for the sake of reviewing without seeing the changes from B-Lang-org#729.

filterZeroWidthPorts _ _ = error "filterZeroWidthPorts: non-empty port names list"

-- Helper class to conditionally convert Bit 0 to ()
class NonEmptyBits n pb | n -> pb where

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.

@nanavati thinks this type class should have a different name. I'm unsure what to call it, though - maybeFilterEmptyBits? But that name sort of implies that we are filtering a tuple of Bit ns, while this actually deals with turning just a single Bit n into a ().

krame505 and others added 20 commits March 31, 2026 21:15
GitHub PR 729.

Co-authored-by: Ravi Nanavati <ravi@matx.com>
Co-authored-by: Julie Schwartz <quark@bluespec.com>
PR 883.
Add Functor and Applicative type classes as superclasses of Monad.
Remove 'return' from the Monad type class and make it an alias for 'pure'.
Update b1894 test to not hardcode the def number.

Co-authored-by: Julie Schwartz <quark@bluespec.com>
GitHub PR 893.
reducePred optimization: filter out preds that can't possibly match before calling newInst.
Sort preds by concreteness in satMany.
Update test suite expected outputs due to sorted preds appearing in a different order.
- Include headers and footers when dumping to files, just like when dumping to stdout
- Only overwrite a file the first time we dump to it in a run. Subsequent dumps append to the existing file.
  This means -dall=foo.txt collects everything instead of just the last dump.
so have them overwrite files to prevent double-dumps.
Some splitIf testcases compile a submodule. Previously, the submodule splitIf
dump was overwritten so the testing code only saw the top-level dump.
That changed when we started accumulating dumps, so we redirect each module's
dump to a different file with %m.
FileName actually stores paths, so there is no need to make a distinction.
  Previously, every file was parsed once to build the dependency graph
  and again for compilation.  The dependency pass now returns the parsed
  packages so they can be passed directly to compilation.

  As part of this, parseFile is extracted into Depend.hs as a clean
  public API (no global side effects); parsing functions now return
  warnings instead of printing them directly; and compilePackage now
  owns setSyntax and the path encoding that used to live in compileFile.

  Side effects visible in test output: WFilePackageNameMismatch warnings
  now appear before "compiling ..." with a real source position instead
  of Unknown position, and duplicate warnings/dumps from the second parse
  are gone.
Dump headers and footers are now written unconditionally, whether a
specific pass flag or -dall is in effect.  This makes accumulated dumps
in a single file readable without losing track of pass boundaries.

Headers now include a coordinate (file, package, module, or package and
module, whichever is most specific) so each section is identifiable.
(so the parse_pretty tests can share it)
So that generated CPP positions have an encoded absolute path.
This also affects the macOS behavior, as the CPP parsers on various
macOS versions handle relative paths differently.
The functions 'compile_with_deps' and 'compile_no_deps' are the two
ways of compiling and they share the common 'compilePackage' function.
GitHub PR 888. Adds syntax for declaring type functions as members of
typeclasses, based on the dependencies of the class. Re-implements
SizeOf as a type function member of the Bits class, rather than as a
primitive. Updates the evaluator to normalize types as it elaborates
(as proposed in the closed GitHub PR 843), eliminating the need for a
post-elaboration normalization pass (reverting GitHub PR 842).
Refactors ISyntax substitution to provide a normalization function
from the context. Adds a variety of tests for associated task
functions, including new messages for error conditions. Documentation
to come.

Includes a cleanup for previous Functor PR, moving the Functor
instance for Array into the Prelude, instead of the Array package.
GitHub PR 907.
The Assert library now uses $fatal instead of $display and $finish.
Bluesim tracks whether simulation terminated because of a call to
$fatal, and has a new C API routine for testing this.  It is exposed
in the Bluetcl API and used to make the Bluetcl simulation exit with a
failure status.  The standalone template is similarly updated.  Tests
added, including a routine for checking the exit status of Verilog
simulation.
nanavati and others added 22 commits April 19, 2026 08:15
This saves time when the evaluator needs to repeatedly evaluate
undefined values at the same types.
…alues.

Aggressively simplify empty tuples in ISimplify, remove unnecessary
undefined values.
The .gitignore listed each generated pretty-out file individually,
and TypeclassATF.bsv-pretty-out.bsv was missed when that test was
added, causing it to be accidentally committed. Replace the
per-file list with a *-pretty-out.bsv glob and remove the
generated file.
Use the List_$Cons struct type with _1/_2 field IDs instead of PrimPair,
and fix iConType arity from 2-arrow to 1-arrow to match the single
struct argument.
GitHub PR 947
CtxReduce removes unnecessary contexts on top-level types.  If the
only uses of an imported package are in removed contexts, that should
not trigger a warning.  The check for uses needs to be before
reduction.  Testcase added for type alias, but the issue could occur
for any type or typeclass defined in the imported package.
… ports.

Everything but the vertices will be ignored when scheduling the uses.
The Bits#(i,_) provisos implied them and stating the proviso explicitly with a
different type variable for the size relies on ctxreduce reducing the ZBit Bits
proviso so that the typechecker doesn't complain about two bound variables
being required to be equal.
The old lookup is still available with -legacy-inst-index for comparison
(and confirm the legacy lookup has exactly the same behavior)
@krame505 krame505 force-pushed the split-output-ports branch 2 times, most recently from b4653a8 to 7c3d707 Compare May 27, 2026 05:52
@krame505 krame505 force-pushed the split-output-ports branch from 7c3d707 to a958c55 Compare May 27, 2026 05:55
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.

5 participants