Hardware Design with Generalized Arrows

  • Adam Megacz
Conference paper

DOI: 10.1007/978-3-642-34407-7_11

Volume 7257 of the book series Lecture Notes in Computer Science (LNCS)
Cite this paper as:
Megacz A. (2012) Hardware Design with Generalized Arrows. In: Gill A., Hage J. (eds) Implementation and Application of Functional Languages. IFL 2011. Lecture Notes in Computer Science, vol 7257. Springer, Berlin, Heidelberg

Abstract

Ordinarily, a compiler for a multi-level language will contain some knowledge of the object language; for example, in a multi-stage programming language with runtime code generation, the compiler will know how to produce code which emits machine code for object language expressions. This means that adding, extending, or replacing the object language requires knowledge of compiler internals.

Generalized arrows act as an intermediate language, separating the meta language compiler from the object language implementation. Two-level expressions are flattened [11] into ordinary one-level expressions polymorphic in an instance of the GArrow class, which is used to represent object language expressions. Operations on object language expressions are then packaged in an instance of the GArrow class, which is a library rather than part of the compiler.

This paper presents an example application of this approach: a bit-serial circuit which searches for SHA-256 hash collisions. A two-level circuit-building program is passed through the GHC flattening pass (which is not specific to hardware design in any way) and the resulting one-level program is combined with a GArrow instance that emits Verilog code; this instance is an ordinary Haskell library which can be written without knowledge of compiler internals.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Adam Megacz
    • 1
  1. 1.Computer Science DivisionUC BerkeleyUSA