## Denotational hardware design in Agda
*Note that this project replaces [agda-machines](https://github.com/conal/agda-machines).*
## Introduction
This Agda project aims to synthesize machine-verified, parallel hardware designs from high-level denotational specifications.
The common algebraic abstraction is categories, as described in the talks [*From Haskell to Hardware via CCCs*](https://github.com/conal/talk-2015-haskell-to-hardware/blob/post-tabula/README.md) and [*Teaching new tricks to old programs*](https://github.com/conal/2017-talk-teaching-new-tricks-to-old-programs#readme), as well as the paper [*Compiling to categories*](http://conal.net/papers/compiling-to-categories/).
The semantics of various representations are given by mappings from operationally motivated representations to their essential denotations.
Those mappings are required to be homomorphic with respect to the shared programming interface.
This requirement yields a collection of homomorphism equations all solutions of which are correct implementations.
As a happy byproduct, the homomorphisms also ensure that all expected laws hold (assuming equivalence is denotational).
## Dependencies
* [Agda compiler](https://agda.readthedocs.io/en/latest/getting-started/installation.html#installing-the-agda-and-the-agda-mode-programs).
Known to work with Agda 2.6.2
* The [Agda standard library (agda-stdlib)](https://github.com/agda/agda-stdlib).
Known to work with version 1.7.
* Haskell [ieee754 package](https://github.com/agda/agda/issues/3619) (as described under Troubleshooting below)
* [GraphViz](https://graphviz.org/) for circuit graph rendering
## Building
Makefile targets:
* `compile`: compiles the `Test` module, but you can compile faster from within the Emacs mode (`∁-c Cx C-c`).
* `tests`: generates circuit diagrams in the `Figures` subdirectory (dot files and their PDF renderings).
* `listings`: renders source code to deeply hyper-linked HTML.
Start perusing at `html/Everything.html`.
## Summary of important modules
* `Categorical`:
* `Object`: Shared interface to categorical products and exponentials as well as booleans.
* `Equiv`: Basic interface for morphism equivalences and homomorphisms.
* `Raw`: Category classes (including cartesian and cartesian closed).
"Raw" as in lacking laws (adopting this use of "raw" from agda-stdlib).
* `Homomorphism`: Homomorphism classes for categories, cartesian categories, etc.
* `Ty` (module and directory, as with a few others below): Inductive representation of types/objects with booleans, products, and exponentials, along with mappings to objects in other categories.
* `Primitive`: "Symbolic" (data type) representation of some common primitives, along with their homomorphic meanings.
Currently monolithic, but may need some rethinking for modularity.
* `Routing`: information-rearranging category, indexed by `Ty`.
* `Linearize`: linearized representation of morphisms as alternating routings and primitives.
Convenient for generating pictures and code.
* `Decode`: A category construction and change-of-representation functor.
* `SSA`: a simple static single-assignment ("SSA") program representation.
Recursive, in order to support exponentials.
Conversion from linearized morphisms.
* `Dot`: generation of GraphViz format from SSA.
* `Examples`: hardware-friendly algorithms.
* `Test`: generate pictures from morphisms.
* `Everything`: import all code as an easy check that everything works.
## Troubleshooting
You might see an error message like this:
```
Calling: ghc -O -o /Users/sseefried/code/agda-machines/Test -Werror -i/Users/sseefried/code/agda-machines -main-is MAlonzo.Code.Test /Users/sseefried/code/agda-machines/MAlonzo/Code/Test.hs --make -fwarn-incomplete-patterns -fno-warn-overlapping-patterns
[ 1 of 153] Compiling MAlonzo.RTE ( MAlonzo/RTE.hs, MAlonzo/RTE.o )
Compilation error:
MAlonzo/RTE.hs:9:1: error:
Could not find module ‘Numeric.IEEE’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
9 | import Numeric.IEEE ( IEEE(identicalIEEE, nan) )
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
You can fix this error with:
```
cabal install --lib ieee754
```
You can find out how to more about this issue [here](https://github.com/agda/agda/issues/3619#issuecomment-665232148) and
[here](https://agda.readthedocs.io/en/latest/getting-started/installation.html#installing-the-agda-and-the-agda-mode-programs).
## Contributing
I am trying to structure this project in such a way as to leave many clear opportunities to contribute (which I think I did poorly in agda-machines).
For this reason, most functionality is accompanied by semantic functions of type `Homomorphism _⇨₁_ _⇨₂_` for an established morphism type `_⇨₂_` and a new morphism type `_⇨₁_`.
A common first step is to prove specific homomorphism properties of type `CategoryH _⇨₁_ _⇨₂_`, `CartesianH _⇨₁_ _⇨₂_`, etc.
As of 2021-06-01, many of the proofs in [agda-machines](https://github.com/conal/agda-machines) have not been moved over.
You can peek there for hints or start fresh as an exercise.
See the [open issues](https://github.com/conal/agda-hardware/issues).
As another source of tasks, `git grep TODO`.
没有合适的资源?快使用搜索试试~ 我知道了~
Agda 中的 指称硬件设计_设计_文档_相关文件_下载_Agda
共71个文件
agda:63个
makefile:2个
md:2个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 32 浏览量
2022-07-05
20:41:38
上传
评论
收藏 78KB ZIP 举报
温馨提示
介绍 这个 Agda 项目旨在从高级表示规范综合机器验证的并行硬件设计。常见的代数抽象是类别,如从 Haskell 到硬件通过 CCC和向旧程序教授新技巧以及论文编译到类别中所述。 各种表示的语义是通过从操作动机的表示到它们的基本外延的映射给出的。这些映射需要与共享编程接口同态。这个要求产生了一个同态方程的集合,所有这些方程的解都是正确的实现。作为一个令人愉快的副产品,同态还确保所有预期的定律都成立(假设等价是指称的)。 依赖项 Agda 编译器。已知与 Agda 2.6.2 一起使用 Agda 标准库(agda-stdlib)。已知可与 1.7 版一起使用。 Haskell ieee754 软件包(如下面的故障排除所述) GraphViz用于电路图渲染 建造 Makefile 目标: compile: 编译模块,但您可以在 Emacs 模式 ( ) 中Test更快地编译。∁-c Cx C-c tests:在子目录中生成电路图Figures(点文件及其 PDF 效果图)。 更多详情、使用方法,请下载后阅读README.md文件
资源推荐
资源详情
资源评论
收起资源包目录
denotational-hardware-main.zip (71个子文件)
denotational-hardware-main
Categorical
Subcategory.agda 7KB
MakeLawful.agda 3KB
Comma
Type.agda 2KB
Raw.agda 16KB
Homomorphism.agda 2KB
Arrow.agda 2KB
Object.agda 1KB
Comma.agda 1KB
Laws.agda 11KB
Product.agda 10KB
Free
Laws.agda 838B
Type.agda 563B
Raw.agda 699B
Homomorphism.agda 2KB
Raw.agda 6KB
IdInstances.agda 1KB
Equiv.agda 2KB
Free.agda 533B
Reasoning.agda 15KB
Homomorphism.agda 27KB
SSA.agda 3KB
Index.agda 4KB
todo.md 56B
Finite
Object.agda 2KB
Routing.agda 182B
Everything.agda 709B
Functions
Laws.agda 3KB
Type.agda 2KB
Raw.agda 2KB
Linearize
Type.agda 1KB
Raw.agda 3KB
Homomorphism.agda 12KB
default.nix 990B
Primitive
Type.agda 835B
Raw.agda 1KB
Homomorphism.agda 3KB
Routing
Type.agda 923B
Raw.agda 685B
Homomorphism.agda 3KB
readme.md 5KB
Dot.agda 3KB
.github
workflows
build-agda.yaml 378B
Test.agda 2KB
hardware.agda-lib 51B
Primitive.agda 495B
Show.agda 795B
TFinite.agda 4KB
Equality.agda 150B
Examples
Add.agda 3KB
Conv.agda 3KB
Add
Properties.agda 3KB
Finite.agda 463B
Equality
Laws.agda 397B
Type.agda 191B
Raw.agda 536B
Homomorphism.agda 772B
Linearize.agda 174B
StronglyFinite.agda 10KB
.gitignore 110B
HasAlgebra.agda 6KB
Ty
Utils.agda 1KB
Makefile 465B
Figures
Makefile 632B
Old
Finite
Laws.agda 509B
Fun.agda 4KB
Type.agda 321B
Raw.agda 1KB
Homomorphism.agda 2KB
Finite.agda 148B
Functions.agda 145B
Ty.agda 4KB
共 71 条
- 1
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9154
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功