Fakultät für Informatik und Mathematik


Paper Description

BibTeX entry

    author="C. Herrmann",
    title="Type-Sensitive Size Parameterization of Circuit Designs by Metaprogramming",
    institution="Fakult{\"a}t f{\"u}r Mathematik und Informatik, Universit{\"a}t Passau",


This report demonstrates that the expressive power of high-level descriptions can be combined with the generation of very specific code, if a metaprogramming language like Template Haskell is used and structural parameters are fixed at compile time. Our example domain is digital circuit design and the particular aspect under consideration is the parameterization of bundles of wires. Potential mismatches in sizes are caught by the Haskell type checker. We start with a general discussion of the aims and problems of functional circuit simulation and of the topic of observable sharing. Together with the size parameterization, Template Haskell can be used for the analysis of circuit structures for netlist generation, without sacrificing referential transparency. A short tour of Template Haskell and circuit simulation with a lazy functional language should help novices to become familiar with these topics. The main technical parts cover the generation of skeleton implementations from specifications, suggestions of example skeleton definitions for parallel and sequential composition, and the calculation of direct wiring patterns from compositions of index transformations. A library of circuit designs gives an impression of how the skeletons and wiring patterns are applied, going from multiplexers and adders via shift registers upto combinational and sequential multipliers. We show how a design definition can be simulated at the example of a sequential multiplier, and how internal values of the circuit can be made accessible by a conditional compilation