Skip to content

Commit

Permalink
all: Add documentation headers in preparation for the release
Browse files Browse the repository at this point in the history
  • Loading branch information
cpitclaudel committed Nov 25, 2019
1 parent b41edd5 commit 9a4771c
Show file tree
Hide file tree
Showing 71 changed files with 73 additions and 26 deletions.
1 change: 1 addition & 0 deletions coq/CircuitCorrectness.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Circuits | Compiler correctness proof !*)
Require Import Coq.setoid_ring.Ring_theory Coq.setoid_ring.Ring Coq.setoid_ring.Ring.

Require Import
Expand Down
1 change: 1 addition & 0 deletions coq/CircuitProperties.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Circuits | Lemmas used in the compiler-correctness proof !*)
Require Export Koika.Circuits.
Require Import Koika.Common Koika.Environments Koika.Types.

Expand Down
1 change: 1 addition & 0 deletions coq/Circuits.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Circuits | Syntax, semantics, compilation, and optimization of circuits !*)
Require Export Koika.Common Koika.Environments.
Require Import Koika.Syntax Koika.TypedSyntax Koika.TypedSyntaxTools.

Expand Down
1 change: 1 addition & 0 deletions coq/Common.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Utilities | Shared utilities !*)
Require Export Coq.omega.Omega.
Require Export Coq.Lists.List Coq.Bool.Bool Coq.Strings.String.
Require Export Koika.EqDec Koika.Vect Koika.FiniteType Koika.Show.
Expand Down
1 change: 1 addition & 0 deletions coq/DeriveShow.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Utilities | Automatic derivation of Show instances !*)
Require Import Koika.Show.

Require Koika.IdentParsing.
Expand Down
1 change: 1 addition & 0 deletions coq/Desugaring.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Frontend | Desugaring of untyped actions !*)
Require Import Koika.Common Koika.Environments Koika.Syntax Koika.TypedSyntax Koika.ErrorReporting Koika.SyntaxMacros.

Section Desugaring.
Expand Down
1 change: 1 addition & 0 deletions coq/Environments.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Utilities | Environments used to track variable bindings !*)
Require Import Koika.Common.
Require Export Koika.Member.

Expand Down
1 change: 1 addition & 0 deletions coq/EqDec.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Utilities | Decidable equality typeclass !*)
Require Import Coq.Strings.String.
Require Import Coq.Vectors.Vector.

Expand Down
1 change: 1 addition & 0 deletions coq/ErrorReporting.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Frontend | Typechecking errors and error-reporting functions !*)
Require Import Koika.Common Koika.Types.

Section TypeErrors.
Expand Down
1 change: 1 addition & 0 deletions coq/Extraction.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Interop | Extraction to OCaml (compiler and utilities) !*)
Require Import Koika.ExtractionSetup.

Require Koika.Common
Expand Down
1 change: 1 addition & 0 deletions coq/ExtractionSetup.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Interop | Custom extraction settings (also used by external Kôika programs !*)
Require Export Coq.extraction.Extraction.
From Coq.extraction Require Export ExtrOcamlBasic ExtrOcamlString ExtrOcamlNatInt ExtrOcamlZInt.

Expand Down
1 change: 1 addition & 0 deletions coq/FiniteType.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Utilities | Finiteness typeclass !*)
Require Import Coq.Lists.List.
Require Import Coq.omega.Omega.
Import ListNotations.
Expand Down
4 changes: 3 additions & 1 deletion coq/Frontend.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Frontend | Top-level module imported by Kôika programs !*)
Require Export
Koika.SyntaxMacros
Koika.Desugaring
Expand All @@ -9,7 +10,8 @@ Require Export
Koika.TypedSyntaxTools
Koika.Interop
Koika.Parsing
Koika.DeriveShow.
Koika.DeriveShow
Koika.ExtractionSetup.

Notation compile_scheduler :=
(compile_scheduler opt_constprop).
Expand Down
1 change: 1 addition & 0 deletions coq/IdentParsing.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Frontend | Ltac2-based identifier parsing for prettier notations !*)
Require Import Coq.NArith.NArith Coq.Strings.String.
Require Import Coq.Init.Byte.
Require Import Ltac2.Ltac2.
Expand Down
1 change: 1 addition & 0 deletions coq/IndexUtils.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Utilities | Functions on Vect.index elements !*)
Require Coq.Logic.FinFun.
Require Import Koika.Common Koika.Vect Koika.Member.

Expand Down
1 change: 1 addition & 0 deletions coq/Interop.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Interop | Exporting Kôika programs for use with the cuttlec command-line tool !*)
Require Import Koika.Common Koika.Environments Koika.Types Koika.TypedSyntax Koika.Circuits.
Require Export Koika.Primitives.

Expand Down
1 change: 1 addition & 0 deletions coq/Member.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Utilities | Dependent type tracking membership into a list !*)
Require Import Koika.Common.

Inductive member {K: Type}: K -> list K -> Type :=
Expand Down
1 change: 1 addition & 0 deletions coq/OneRuleAtATime.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! ORAAT | Proof of the One-rule-at-a-time theorem !*)
Require Import Koika.Common Koika.Syntax Koika.TypedSyntax Koika.SemanticProperties.
Require Import Coq.setoid_ring.Ring_theory Coq.setoid_ring.Ring Coq.setoid_ring.Ring.

Expand Down
1 change: 1 addition & 0 deletions coq/Parsing.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Frontend | Parser for the Kôika EDSL !*)
Require Import
Koika.Common
Koika.Syntax
Expand Down
1 change: 1 addition & 0 deletions coq/PrimitiveProperties.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Equations showing how to implement functions on structures and arrays as bitfuns !*)
Require Import Koika.Primitives.
Import BitFuns.

Expand Down
1 change: 1 addition & 0 deletions coq/Primitives.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Language | Combinational primitivies available in all Kôika programs !*)
Require Export Koika.Common Koika.Environments Koika.IndexUtils Koika.Types Koika.ErrorReporting.

Inductive bits_comparison :=
Expand Down
1 change: 1 addition & 0 deletions coq/SemanticProperties.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! ORAAT | Properties of the semantics used in the one-rule-at-a-time theorem !*)
Require Export Koika.Common Koika.Semantics.

Section Lists.
Expand Down
1 change: 1 addition & 0 deletions coq/Semantics.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Language | Semantics of typed Kôika programs !*)
Require Export Koika.Common Koika.Environments Koika.Vect Koika.Syntax Koika.TypedSyntax.

Section Logs.
Expand Down
1 change: 1 addition & 0 deletions coq/Show.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Utilities | Show typeclass (α → string) !*)
Require Export Coq.Strings.String.

Class Show (A: Type) :=
Expand Down
1 change: 1 addition & 0 deletions coq/Std.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Stdlib | Standard library !*)
Require Import Koika.Frontend.

Module Type Fifo.
Expand Down
1 change: 1 addition & 0 deletions coq/Syntax.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Frontend | Untyped syntax !*)
Require Export Koika.Common Koika.Primitives Koika.Types Koika.ErrorReporting.

Section Syntax.
Expand Down
1 change: 1 addition & 0 deletions coq/SyntaxMacros.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Frontend | Macros used in untyped programs !*)
Require Import Koika.Common Koika.Syntax Koika.TypedSyntax Koika.Primitives.
Import PrimUntyped.

Expand Down
1 change: 1 addition & 0 deletions coq/TypeInference.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Frontend | Type inference and typechecking !*)
Require Import
Koika.Common Koika.Environments
Koika.Syntax Koika.TypedSyntax Koika.SyntaxMacros
Expand Down
1 change: 1 addition & 0 deletions coq/TypedSyntax.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Language | Typed ASTs !*)
Require Export Koika.Common Koika.Environments Koika.Types Koika.Primitives.

Import PrimTyped PrimSignatures.
Expand Down
1 change: 1 addition & 0 deletions coq/TypedSyntaxProperties.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Tools | Lemmas pertaining to tools on typed syntax !*)
Require Import Koika.TypedSyntaxTools Koika.Semantics.

Section TypedSyntaxProperties.
Expand Down
1 change: 1 addition & 0 deletions coq/TypedSyntaxTools.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Tools | Functions defined on typed ASTs !*)
Require Import Koika.Member Koika.TypedSyntax.

Section TypedSyntaxTools.
Expand Down
1 change: 1 addition & 0 deletions coq/Types.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Language | Types used by Kôika programs !*)
Require Export Coq.Strings.String.
Require Export Koika.Common Koika.Vect Koika.IndexUtils.

Expand Down
1 change: 1 addition & 0 deletions coq/UntypedSyntaxTools.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Frontend | Functions on untyped ASTs, including error localization !*)
Require Import Koika.Syntax.

Section SyntaxTools.
Expand Down
1 change: 1 addition & 0 deletions coq/Vect.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Utilities | Vectors and bitvector library !*)
Require Import Coq.Lists.List.
Require Import Coq.omega.Omega.
Require Export Coq.NArith.NArith. (* Coq bug: If this isn't exported, other files can't import Vect.vo *)
Expand Down
16 changes: 0 additions & 16 deletions etc/gen_dune.ml

This file was deleted.

2 changes: 2 additions & 0 deletions examples/collatz.lv
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
;;; Computing terms of the Collatz sequence (Lispy Verilog version)

(defun times_three ((v (bits 16))) (bits 16)
(+ (<< v 1'1) v))

Expand Down
1 change: 1 addition & 0 deletions examples/collatz.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Computing terms of the Collatz sequence (Coq version) !*)
Require Import Koika.Frontend.

Module Collatz.
Expand Down
1 change: 1 addition & 0 deletions examples/datatypes.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Using structures, enums, and arrays !*)
Require Import Koika.Frontend.

Inductive reg_t := input | output.
Expand Down
1 change: 1 addition & 0 deletions examples/external_rule.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Calling external (verilog) modules from Kôika !*)
Require Import Koika.Frontend.
Require Koika.Std.

Expand Down
1 change: 1 addition & 0 deletions examples/function_call.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Calling external functions !*)
Require Import Koika.Frontend.

Inductive reg_t := pc | next_instr.
Expand Down
1 change: 1 addition & 0 deletions examples/gcd_machine.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Computing GCDs !*)
Require Import Koika.Frontend.
Require Import Koika.Std.

Expand Down
1 change: 1 addition & 0 deletions examples/method_call.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Calling methods of internal modules !*)
Require Import Koika.Frontend.
Require Import Koika.Std.

Expand Down
1 change: 1 addition & 0 deletions examples/pipeline.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Building simple pipelines !*)
Require Import Koika.Frontend.

Inductive reg_t := r0 | outputReg | inputReg | invalid | correct.
Expand Down
1 change: 1 addition & 0 deletions examples/rv/RVCore.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Implementation of our RISC-V core !*)
Require Import Koika.Frontend.
Require Import Coq.Lists.List.

Expand Down
1 change: 1 addition & 0 deletions examples/rv/RVEncoding.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Encoding-related constants !*)
Require Import Koika.Frontend.

Definition opcode_LOAD := Ob~0~0~0~0~0~1~1.
Expand Down
1 change: 1 addition & 0 deletions examples/rv/Scoreboard.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Implementation of a scoreboard !*)
Require Import Coq.Lists.List.

Require Import Koika.Frontend.
Expand Down
1 change: 1 addition & 0 deletions examples/rv/TopLevel.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*! Verilog wrapper for the RISC-V processor !*/
module TopLevel(
input clock,
input reset,
Expand Down
1 change: 1 addition & 0 deletions examples/rv/rv32i_core_pipelined.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Pipelined instantiation of the RISC-V processor !*)
Require Import Koika.Frontend.
Require Import RV.RVCore.
Import RV32ICore.
Expand Down
1 change: 1 addition & 0 deletions examples/vector.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Representing vectors of registers using Coq inductives !*)
Require Import Koika.Frontend.

Definition nregs := 16.
Expand Down
1 change: 1 addition & 0 deletions ocaml/backends/coq.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Coq backend (from Lispy Verilog sources) !*)
open Common
open Frontends.Lv
open Format
Expand Down
1 change: 1 addition & 0 deletions ocaml/backends/cpp.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! C++ backend !*)
open Common
module Extr = Cuttlebone.Extr

Expand Down
1 change: 1 addition & 0 deletions ocaml/backends/dot.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Graphviz backend !*)
open Common
open Cuttlebone
open Cuttlebone.Graphs
Expand Down
1 change: 1 addition & 0 deletions ocaml/backends/gen.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Embed preamble.hpp into cppPreamble.ml at build time !*)
let cpp_preamble =
let inc = open_in "preamble.hpp" in
let preamble = really_input_string inc (in_channel_length inc) in
Expand Down
1 change: 1 addition & 0 deletions ocaml/backends/preamble.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*! Preamble shared by all Kôika programs compiled to C++ !*/
#ifndef _PREAMBLE_HPP
#define _PREAMBLE_HPP

Expand Down
2 changes: 1 addition & 1 deletion ocaml/backends/verilog.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

(*! Verilog backend !*)
open Common
open Cuttlebone
open Cuttlebone.Util
Expand Down
1 change: 1 addition & 0 deletions ocaml/common/common.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Shared utilities !*)
type size_t = int
type ptr_t = int

Expand Down
1 change: 1 addition & 0 deletions ocaml/cuttlebone/cuttlebone.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! OCaml wrappers around functionality provided by the library extracted from Coq !*)
type __ = Obj.t
let __ = let rec f _ = Obj.repr f in Obj.repr f

Expand Down
1 change: 1 addition & 0 deletions ocaml/cuttlec.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Command line interface to the compilers !*)
open Common
open Printf
open Frontends
Expand Down
1 change: 1 addition & 0 deletions ocaml/frontends/coq.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Simple frontend to compile and load OCaml files extracted from Coq !*)
let ensure_koikalib () =
Printf.eprintf "Path to Koika: %!";
Common.command "ocamlfind" ["query"; "koika"]
Expand Down
1 change: 1 addition & 0 deletions ocaml/frontends/lv.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Lispy Verilog frontend !*)
open Common

let lcnt x = x.lcnt
Expand Down
1 change: 1 addition & 0 deletions ocaml/interop.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Functions to use if compiling Kôika programs straight from Coq, without going through cuttlec !*)
open Cuttlebone

let fname ?directory (pkg: _ Extr.koika_package_t) ext =
Expand Down
1 change: 1 addition & 0 deletions ocaml/koika.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Top-level library definition !*)
module Common = Common
module Cuttlebone = Cuttlebone
module Frontends = Frontends
Expand Down
1 change: 1 addition & 0 deletions ocaml/registry.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(*! Stub used to load Kôika programs extracted from Coq into cuttlec !*)
let registered_interop_packages : Cuttlebone.Extr.interop_package_t list ref =
ref []

Expand Down
2 changes: 1 addition & 1 deletion tests/double_write.v
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(* Double writes *)
(*! Double-write detection and prevention !*)
Require Import Koika.Frontend.

Inductive reg_t := reg0.
Expand Down
2 changes: 1 addition & 1 deletion tests/errors.v
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(*;;; Syntax and typing errors *)
(*! Syntax and typing errors in Coq !*)
Require Import Koika.Frontend.

Inductive reg_t := R0.
Expand Down
2 changes: 1 addition & 1 deletion tests/extcall.v
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(* External functions *)
(*! External functions !*)
Require Import Koika.Frontend.

Inductive reg_t := reg0.
Expand Down
2 changes: 1 addition & 1 deletion tests/large_writeset.v
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(* Make sure that the large writeset heuristics in the scheduler don't break things *)
(*! Make sure that the large writeset heuristics in the scheduler don't break things !*)
Require Import Koika.Frontend.

Definition N := 10.
Expand Down
2 changes: 1 addition & 1 deletion tests/name_mangling.lv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; Name mangling unit tests
;;; Unit tests for name mangling

(enum lv_gensym_collisions
::_lvs_0 2'0
Expand Down
2 changes: 1 addition & 1 deletion tests/register_file_bypassing.v
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(* Ensure that area is reasonable when bypass doesn't need extra tracking *)
(*! Ensure that area is reasonable when bypasses don't need extra tracking !*)
Require Import Koika.Frontend.
Require Import Koika.Std.

Expand Down
2 changes: 1 addition & 1 deletion tests/shadowing.lv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; Shadowing unit tests
;;; Unit tests for name shadowing

(module shadowing
(register r 32'0)
Expand Down
2 changes: 1 addition & 1 deletion tests/unpack.v
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(*;;; Unpacking structures *)
(*! Structure unpacking !*)
Require Import Koika.Frontend.

Inductive reg_t := Rpacked | Runpacked.
Expand Down

0 comments on commit 9a4771c

Please sign in to comment.