Types and associated type families for hardware simulation and synthesis

In this article we overview the design and implementation of the second generation of Kansas Lava. Driven by the needs and experiences of implementing telemetry decoders and other circuits, we have made a number of improvements to both the external API and the internal representations used. We have retained our dual shallow/deep representation of signals in general, but now have a number of externally visible abstractions for combinatorial and sequential circuits, and enabled signals. We introduce these abstractions, as well as our abstractions for reading and writing memory. Internally, we found the need to represent unknown values inside our circuits, so we made aggressive use of associated type families to lift our values to allow unknowns, in a principled and regular way. We discuss this design decision, how it unfortunately complicates the internals of Kansas Lava, and how we mitigate this complexity. Finally, when connecting Kansas Lava to the real world, the standardized idiom of using named input and output ports is provided by Kansas Lava using a new monad, called Fabric. We present the design of this Fabric monad, and illustrate its use in a small but complete example.

[1]  Richard S. Bird,et al.  Algebra of programming , 1997, Prentice Hall International series in computer science.

[2]  Graham Hutton,et al.  The Ruby Interpreter , 1993 .

[3]  Tristan Bull,et al.  Types and Type Families for Hardware Simulation and Synthesis - The Internals and Externals of Kansas Lava , 2010, Trends in Functional Programming.

[4]  Erik Perrins,et al.  Introducing Kansas Lava , 2009, IFL.

[5]  T. Moon Error Correction Coding: Mathematical Methods and Algorithms , 2005 .

[6]  Pieter H. Hartel,et al.  1st Functional Programming languages in Education (FPLE) , 1995 .

[7]  James Cheney Scrap your nameplate: (functional pearl) , 2005, ICFP '05.

[8]  Levent Erkok,et al.  Value recursion in monadic computations , 2002 .

[9]  Colin Runciman,et al.  The Reduceron: Widening the von Neumann Bottleneck for Graph Reduction Using an FPGA , 2008, IFL.

[10]  John T. O'Donnell,et al.  Hardware Description with Recursion Equations , 1987 .

[11]  John T. O'Donnell Embedding a Hardware Description Language in Template Haskell , 2003, Domain-Specific Program Generation.

[12]  Zoltán Horváth,et al.  Feldspar: A domain specific language for digital signal processing algorithms , 2010, Eighth ACM/IEEE International Conference on Formal Methods and Models for Codesign (MEMOCODE 2010).

[13]  John Launchbury,et al.  A recursive do for Haskell , 2002, Haskell '02.

[14]  Andy Gill,et al.  Type-safe observable sharing in Haskell , 2009, Haskell.

[15]  Simon L. Peyton Jones,et al.  Associated type synonyms , 2005, ICFP '05.

[16]  Andy Gill Declarative FPGA Circuit Synthesis using Kansas Lava , 2011 .

[17]  Andy Gill,et al.  Deriving an efficient FPGA implementation of a low density parity check forward error corrector , 2011, ICFP.

[18]  Axel Jantsch,et al.  Models of computation and languages for embedded system design , 2005 .

[19]  Peyton Jones,et al.  Haskell 98 language and libraries : the revised report , 2003 .

[20]  Satnam Singh Designing reconfigurable systems in Lava , 2004, 17th International Conference on VLSI Design. Proceedings..

[21]  Daan Leijen,et al.  Domain specific embedded compilers , 1999, DSL '99.

[22]  Nick Benton,et al.  Implementation and Application of Functional Languages , 2005 .

[23]  Koen Claessen,et al.  Observable Sharing for Functional Circuit Description , 1999, ASIAN.

[24]  Conor McBride,et al.  Applicative programming with effects , 2008, J. Funct. Program..

[25]  Koen Claessen Embedded Languages for Describing and Verifying Hardware , 2001 .

[26]  Gérard Berry,et al.  The constructive semantics of pure esterel , 1996 .

[27]  Mary Sheeran,et al.  Lava: hardware design in Haskell , 1998, ICFP '98.

[28]  John T. O'Donnell,et al.  Generating Netlists from Executable Circuit Specifications , 1992, Functional Programming.

[29]  Erik Poll,et al.  Algebra of Programming by Richard Bird and Oege de Moor, Prentice Hall, 1996 (dated 1997). , 1999 .

[30]  Oege de Moor,et al.  Compiling embedded languages , 2003, J. Funct. Program..

[31]  Richard S. Bird,et al.  Pearls of Functional Algorithm Design , 2010 .

[32]  Emil Axelsson,et al.  Functional Programming Enabling Flexible Hardware Design at Low Levels of Abstraction , 2008 .

[33]  John J. O'Donnell From Transistors to Computer Architecture: Teaching Functional Circuit Specification in Hydra , 1995, FPLE.

[34]  Andy Gill,et al.  Handshaking in Kansas Lava Using Patch Logic , 2012, PADL.

[35]  Peter G. Harrison,et al.  Functional Programming , 1988 .

[36]  James Cheney,et al.  Functional programs that explain their work , 2012, ICFP.

[37]  Brad L. Hutchings,et al.  JHDL-an HDL for reconfigurable systems , 1998, Proceedings. IEEE Symposium on FPGAs for Custom Computing Machines (Cat. No.98TB100251).

[38]  Mary Sheeran,et al.  muFP, a language for VLSI design , 1984, LFP '84.

[39]  Martin Odersky,et al.  Domain-Specific Program Generation , 2004, Lecture Notes in Computer Science.

[40]  Ingo Sander,et al.  System Modeling and Design Refinement in ForSyDe , 2003 .

[41]  John O'Donnell,et al.  Overview of hydra: a concurrent language for synchronous digital circuit design , 2002, Proceedings 16th International Parallel and Distributed Processing Symposium.

[42]  Erik Perrins,et al.  Using Functional Programming to Generate an LDPC Forward Error Corrector , 2011, 2011 IEEE 19th Annual International Symposium on Field-Programmable Custom Computing Machines.