Digital circuits often use bidirectional interfaces to provide back-pressure or to represent request-response channels. Writing such interfaces manually in Haskell, with arguments in the “forward” direction and results in the “backward” direction, is tedious and error prone. This is especially true when composing multiple interfaces together.
We introduce ‘circuit-notation’, a source plugin that introduces an arrow-like do notation DSL for constructing circuits with bidirectional interfaces in Clash; a GHC-based Haskell-to-Circuit compiler. The plugin automates all of the aspects that makes the manual composition of circuits with bidirectional interfaces tedious and error-prone and it is used in a significant portion of Myrtle.ai’s Clash code.
The prototype for the DSL was implemented as a QuasiQuoter, but has since transitioned to a source plugin with native looking syntax and error messages. In this talk you will get details on what makes bidirectional interfaces error prone to deal with in “native” Clash/Haskell, how the DSL solves these problems and what the advantages and disadvantages are of the source plugin vs the QuasiQuoter solution. While the circuit-notation DSL itself is specific to circuit design, the talk will also be relevant to anyone interested in making their own haskell syntax based DSL.
Fri 28 AugDisplayed time zone: Eastern Time (US & Canada) change
14:00 - 17:30 | |||
14:00 22mTalk | Implementation of linear types HIW | ||
14:22 22mTalk | Circuit Notation Source Plugin HIW Christopher Chalmers Myrtle.ai | ||
15:00 45mTalk | Lightning Talks 2 HIW | ||
15:45 12mTalk | Embracing a Mechanized Formalization Gap: Interactive reasoning for Haskell at scale HIW Antal Spector-Zabusky University of Pennsylvania, Joachim Breitner DFINITY Foundation, Stephanie Weirich University of Pennsylvania, Yao Li University of Pennsylvania | ||
16:00 20mTalk | Closing HIW Ben Gamari Well-Typed LLP |