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.
Keywords
- Object Language
- Hardware Design
- Functional Language
- Recursive Structure
- Code Type
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
This is a preview of subscription content, access via your institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
Backus, J.: Can programming be liberated from the von neumann style? a functional style and its algebra of programs. Communications of the ACM 21(8), 613–641 (1978), http://doi.acm.org/10.1145/359576.359579
Bjesse, P., Claessen, K., Sheeran, M., Singh, S.: Lava: hardware design in haskell. In: ICFP 1998 (January 1998), http://portal.acm.org/citation.cfm?id=289440
Claessen, K., Sands, D.: Observable Sharing for Functional Circuit Description. In: Thiagarajan, P.S., Yap, R.H.C. (eds.) ASIAN 1999. LNCS, vol. 1742, pp. 62–73. Springer, Heidelberg (1999)
Erkök, L., Launchbury, J.: Recursive monadic bindings. In: Proceedings of ICFP 2000, pp. 174–185. ACM (2000), http://doi.acm.org/10.1145/351240.351257
Gill, A.: Type-safe observable sharing in haskell. In: Haskell Symposium, pp. 117–128. ACM (2009), http://doi.acm.org/10.1145/1596638.1596653
Gill, A., Bull, T., Kimmell, G., Perrins, E., Komp, E., Werling, B.: Introducing Kansas Lava. In: Morazán, M.T., Scholz, S.-B. (eds.) IFL 2009. LNCS, vol. 6041, pp. 18–35. Springer, Heidelberg (2010), http://www.ittc.ku.edu/csdl/fpg/sites/
Grundy, J., Melham, T., O’leary, J.: A reflective functional language for hardware design and theorem proving. Journal of Functional Programming 16(2), 157–196 (2005), http://journals.cambridge.org/abstract_S0956796805005757
Hasegawa, M.: Decomposing Typed Lambda Calculus into a Couple of Categorical Programming Languages. In: Johnstone, P.T., Rydeheard, D.E., Pitt, D.H. (eds.) CTCS 1995. LNCS, vol. 953, pp. 200–219. Springer, Heidelberg (1995), http://dx.doi.org/10.1007/3-540-60164-3_28
Hughes, J.: The Design of a Pretty-Printing Library. In: Jeuring, J., Meijer, E. (eds.) AFP 1995. LNCS, vol. 925, pp. 53–96. Springer, Heidelberg (1995), http://dx.doi.org/10.1007/3-540-59451-5%5f3
Matthews, J., Cook, B., Launchbury, J.: Microprocessor specification in hawk. In: Proceedings of 1998 International Conference on Computer Languages, pp. 90–101 (May 1998)
Megacz, A.: Multi-Level Languages are Generalized Arrows. CoRR, abs/1007.2885 (2010), http://arxiv.org/abs/1007.2885 , DBLP, http://dblp.uni-trier.de
Milner, R.: Calculi for interaction. Acta Inf. 33(8), 707–737 (1996), http://dx.doi.org/10.1007/BF03036472
Nielson, F., Neilson, H.R.: Two-Level Functional Languages. Cambridge University Press, Cambridge (1992)
Pfenning, F., Lee, P.: Metacircularity in the polymorphic λ-calculus. Theoretical Computer Science 89(1), 137–159 (1991), http://www.sciencedirect.com/science/article/pii/030439759090109U
Pfenning, F., Paulin-Mohring, C.: Inductively Defined Types in the Calculus of Constructions. In: Schmidt, D.A., Main, M.G., Melton, A.C., Mislove, M.W. (eds.) MFPS 1989. LNCS, vol. 442, pp. 209–228. Springer, Heidelberg (1990), http://www.sciencedirect.com/science/article/pii/030439759090109U
Selinger, P.: A survey of graphical languages for monoidal categories (August 23, 2009), http://arxiv.org/abs/0908.3347
Sheard, T., Linger, N.: Programming in omega. Tech. rep., 2nd Central European Functional Programming School (2007)
Sheeran, M.: muFP, A language for VLSI design. In: LISP and Functional Programming, pp. 104–112 (1984)
Taha, W., Sheard, T.: Multi-stage programming with explicit annotations. SIGPLAN Not. 32(12), 203–207 (1997) ISSN: 0362-1340, doi: 10.1145/258994.259019, http://doi.acm.org/10.1145/258994.259019
Taha, W., Nielsen, M.F.: Environment classifiers, pp. 26–37 (2003), http://doi.acm.org/10.1145/640128.604134
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2012 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
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. https://doi.org/10.1007/978-3-642-34407-7_11
Download citation
DOI: https://doi.org/10.1007/978-3-642-34407-7_11
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-34406-0
Online ISBN: 978-3-642-34407-7
eBook Packages: Computer ScienceComputer Science (R0)
