
λ λ λ λ λ ASH λ דכ ל י שע רפ תו סב ו תא מכ אל הז השק הז DDigitaligital C Circuitsircuits i inn C λaaSHSH FFunctionalunctional S Speciicationspeciications a andnd Type-DirectedType-Directed SynthesisSynthesis CChristiaanhristiaan P P.R..R. B Baaijaaij Members of the dissertation committee: Prof. dr. ir. G.J.M. Smit University of Twente (promotor) Dr. ir. J. Kuper University of Twente (assistant-promotor) Prof. dr. J.C. van de Pol University of Twente Prof. dr. ir. B.R.H.M. Haverkort University of Twente Prof. dr. M. Sheeran Chalmers University of Technology Prof. dr. ir. T. Schrijvers Katholieke Universiteit Leuven Prof. dr. K. Hammond University of St. Andrews Prof. dr. P.M.G. Apers University of Twente (chairman and secretary) Faculty of Electrical Engineering, Mathematics and Computer Sci- ence, Computer Architecture for Embedded Systems (CAES) group his research is conducted within the Service-oriented Operating S(o)OS Service-oriented S OS Operating Systems Systems ( (o) ) project (Grant Agreement No. 248465) supported under the FP7-ICT-2009.8.1 program of the European Commission. his research is conducted within the Programming Large Scale Heterogeneous Infrastructure (Polca) project (Grant Agreement No. 610686) supported under the FP7-ICT-2013.3.4 program of the Eu- ropean Commission. CTIT Ph.D. thesis Series No. 14-335 CTIT Centre for Telematics and Information Technology University of Twente, P.O. Box 217, NLś7500 AE Enschede Copyright © 2014 by Christiaan P.R. Baaij, Enschede, he Nether- lands. his work is licensed under the Creative Commons Attribu- tion 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/. his thesis was typeset using LATEX 2ε, TikZ, and Sublime Text. his thesis was printed by Gildeprint Drukkerijen, he Netherlands. ISBN 978-90-365-3803-9 ISSN 1381-3617 (CTIT Ph.D. thesis Series No. 14-335) DOI 10.3990/1.9789036538039 Digital Circuits in CλaSH Functional Specifications and Type-Directed Synthesis Proefschrift ter verkrijging van de graad van doctor aan de Universiteit Twente, op gezag van de rector magniicus, prof. dr. H. Brinksma, volgens besluit van het College voor Promoties in het openbaar te verdedigen op vrijdag 23 januari 2015 om 14:45 uur door Christiaan Pieter Rudolf Baaij geboren op 1 februari 1985 te Leiderdorp Dit proefschrit is goedgekeurd door: Prof. dr. ir. G.J.M. Smit (promotor) Dr. ir. J. Kuper (assistent promotor) Copyright © 2014 Christiaan P.R. Baaij ISBN 978-90-365-3803-9 v Abstract Over the last three decades, the number of transistors used in microchips has in- creased by three orders of magnitude, from millions to billions. he productivity of the designers, however, lags behind. Designing a chip that uses ever more tran- sistors is complex, but doable, and is achieved by massive replication of function- ality. Managing to implement complex algorithms, while keeping non-functional properties, such as area and gate propagation latency, within desired bounds, and thoroughly verifying the design against its speciication, are the main diiculties in circuit design. It is diicult to measure design productivity quantitatively; transistors per hour would not be a good measure, as high transistor counts can be achieved by repli- cation. As a motivation for our work we make a qualitative analysis of the tools available to circuit designers. Furthermore, we show how these tools manage the complexity, and hence improve productivity. Here we see that progress has been slow, and that the same techniques have been used for over 20 years. Industry standard languages, such as VHDL and (System)Verilog, do provide means for abstractions, but they are distributed over separate language constructs and have ad hoc limitations. What is desired is a single abstraction mechanism that can capture most, if not all, common design patterns. Once we can abstract our com- mon patterns, we can reason about them with rigour. Rigorous analysis enables us to develop correct-by-construction transformations that capture trade-ofs in the non-functional properties. hese correct-by-construction transformations give us a straightforward path to reaching the desired bounds on non-functional properties, while signiicantly reducing the veriication burden. We claim that functional languages can be used to raise the abstraction level in circuit design. Especially higher-order functional languages, where functions are irst-class and can be manipulated by other functions, ofer a single abstraction mechanism that can capture many design patterns. An additional property of functional languages that make them a good candidate for circuit design is purity, which means that functions have no side-efects. When functions are pure, we can reason about their composition and decomposition locally, thus enabling us to reason formally about transformations on these functions. Without side-efects, synthesis can derive highly parallel circuits from a functional description because it only has to respect the direct data dependencies. In existing work, the functional language Haskell has been used as a host for em- bedded hardware description languages. An embedded language is actually a set of data types and expressions described within the host language. hese data types vi and expressions then act like the keywords of the embedded language. Functions in the host language are subsequently used to model functions in the embedded language. Although many features of the host language can be used to model equiv- alent behaviour in the embedded language, this is not true for all features. One of the most important features of the host language that cannot directly be used in the embedded language, are features that model choice, such as pattern matching. his thesis explores the idea of using the functional language Haskell directly as a hardware speciication language, and move beyond the limitations of embedded languages. Additionally, where applicable, we can use normal functions from exist- ing Haskell libraries to model the behaviour of our circuits. here are multiple ways to interpret a function as a circuit description. his thesis makes the choice of interpreting a function deinition as a structural composition of components. his means that every function application is interpreted as the com- ponent instantiation of the respective sub-circuit. Combinational circuits are then described as functions manipulating algebraic data types. Synchronous sequential circuits are described as functions manipulating ininite streams of values. In order to reduce the cognitive burden, and to guarantee synthesisable results, streams can- not be manipulated directly by the designer. Instead, our system ofers a limited set of combinators that can safely manipulate streams, including combinators that map combinational functions over streams. Additionally, the system ofers streams that are explicitly synchronised to a particular clock and thus enable the design of multi-clock circuits. Proper synchronisation between clock domains is checked by the type system. his thesis describes the inner workings of our CλaSH compiler, which translates the aforementioned circuit descriptions written in Haskell to low-level descriptions in VHDL. Because the compiler uses Haskell directly as a speciication language, synthesis of the description is based on (classic) static analysis. he challenge then becomes the reduction of the higher-level abstractions in the descriptions to a form where synthesis is feasible. his thesis describes a term rewrite system (with bound variables) to achieve this reduction. We prove that this term rewrite system always reduces a polymorphic, higher-order circuit description to a synthesisable variant. he only restriction is that the root of the function hierarchy is not polymorphic nor higher-order. here are, however, no restrictions on the use of polymorphism and higher-order functionality in the rest of the function hierarchy. Even when descriptions use high-level abstractions, the CλaSH compiler can syn- thesize eicient circuits. Case studies show that circuits designed in Haskell, and synthesized with the CλaSH compiler, are on par with hand-written VHDL, in both area and gate propagation delay. Even in the presence of contemporary Haskell id- ioms and abstractions to write imperative code (for a control-oriented circuit), does the CλaSH compiler create results with decent non-functional properties. To emphasize that our approach enables correct-by-construction descriptions, we demonstrate abstractions that allow us to automatically compose components that use back-pressure as their synchronisation method. Additionally, we show how vii cycle delays can be encoded in the type-signatures of components, allowing us to catch any synchronisation error at compile-time. his thesis thus shows the merits of using a modern functional language for circuit design. he advanced type system and higher-order functions allow us to design circuits that have the desired property of being correct-by-construction. Finally, our synthesis approach enables us to derive eicient circuits from descriptions that use high-level abstractions. viii ix Samenvatting Gedurende de laatste drie decennia is het aantal transistors in een processor met drie ordegroottes toegenomen, van miljoenen naar miljarden. De productiviteit van de ontwerpers loopt hier echter op achter. Het ontwerpen van een processor met telkens meer transistors is complex, maar doenlijk, en wordt bereikt door het veelvuldig kopiëren van functionaliteit.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages228 Page
-
File Size-