(no commit message)
[libreriscv.git] / nlnet_2019_formal.mdwn
1 # NL.net proposal
2
3 ## Project name
4
5 The Libre-RISCV SoC, Formal Correctness Proofs
6
7 ## Website / wiki
8
9 <https://libre-riscv.org/nlnet_2019_formal>
10
11 Please be short and to the point in your answers; focus primarily on
12 the what and how, not so much on the why. Add longer descriptions as
13 attachments (see below). If English isn't your first language, don't
14 worry - our reviewers don't care about spelling errors, only about
15 great ideas. We apologise for the inconvenience of having to submit in
16 English. On the up side, you can be as technical as you need to be (but
17 you don't have to). Do stay concrete. Use plain text in your reply only,
18 if you need any HTML to make your point please include this as attachment.
19
20 ## Abstract: Can you explain the whole project and its expected outcome(s).
21
22 The Libre RISC-V SoC is being developed to provide a privacy-respecting
23 modern processor, developed transparently and as libre to the bedrock
24 as possible.
25
26 The entire hardware design is libre licensed so that independent third party audits may be carried out, in order for endusers to have a degree of confidence that their privacy is not being violated through the addition of spying backdoor coprocessors or simply through hardware implementation oversights (SPECTRE, Meltdown, Intel Pentium FPU Divide Bug and so on)
27
28 However: not only is that an extremely daunting task, but "quis custodiet custodiens?" Who guards the guards?
29
30 A solution to this problem is to provide formal mathematical correctness proofs at every level of the hardware design. With mathematically inviolate proofs, even an enduser can run the tests for themselves.
31
32 # Have you been involved with projects or organisations relevant to this project before? And if so, can you tell us a bit about your contributions?
33
34 Luke Leighton is an ethical technology specialist who has a consistent
35 24-year track record of developing code in a real-time transparent
36 (fully libre) fashion, and in managing Software Libre teams. He is the
37 lead developer on the Libre RISC-V SoC.
38
39 Dan Leighton is a software entrepreneur and experienced tech leader. He has worked on delivering innovative open source software projects for over 25 years in education, publishing and internet infrastructure. He specialises in bridging the gap between engineering and commercial teams.
40
41 # Requested Amount
42
43 EUR 50,000.
44
45 # Explain what the requested budget will be used for?
46
47 Working with mathematically-minded Software Engineers, every module in the Libre RISCV SoC will have a "formal proof unit test written". This is an unusual design choice: most hardware designs will have monte carlo and corner case unit tests etc. written which, unfortunately, are both complex and often incomplete.
48
49 Examples include the IEEE754 Floating Point Unit, where in the 1990s Intel managed to introduce an actual hardware division bug. We seek to formally *prove* that the output from the FP Divide unit outputs the correct answer, for all possible inputs.
50
51 There are other areas which can benefit from correctness proofs, at the low level: pipelines, FIFOs, the basic building blocks. On this stable foundation the higher level capabilities will then also get their own proofs.
52
53 Finally a high level formal proof will be run, which already exists in the form of RISCV Conformance Tests, as well as unofficial formal correctness tests from SymbioticEDA.
54
55 Throughout this process, bugs will be found, including in code already written. These will require fixing, where previously it was believed that the work was completed.
56
57 # Does the project have other funding sources, both past and present?
58
59 The overall project has sponsorship from Purism as well as a prior grant
60 from NLNet. However that is for specifically covering the development
61 of the RTL (the hardware source code).
62
63 The formal correctness testing requires specialist expertise involving formal logic mathematical training, which is a different skillset from hardware design. Our initial proposal does not cover this scope.
64
65 # Compare your own project with existing or historical efforts.
66
67 There do exist high level formal RISCV Cotrectness proofs in various forms. One of these is the SymbioticEDA formal RISCV proof which can for example test the Register File, and test that the integer operation is correct and so on, working its way through all operations one by one. This however is at a high level.
68
69 The Kestrel 53000 Series of embedded controllers have some formal unit tests written in verilog, at the lowest level. We are following their development and porting to nmigen closely, and consulting with their part time developer.
70
71 A massive comprehensive suite of formal correctness proofs for a processor of the scope and size of the Libre RISCV SoC is just not normally done. The only reason we are considering it is because of the dramatic simplification of unit tests, and the mathematically inviolate guarantees it brings for endusers.
72
73 ## What are significant technical challenges you expect to solve during the project, if any?
74
75 This project is critically dependent on having software engineers that have the mathematical acumen for formal logic correctness proofs. This is quite rare.
76
77 In addition, we will be using an unusual choice of HDL: a python based tool. We will need to train engineers to adapt to the unique mathematics, or train mathematicians to the unique software quirks.
78
79 Luckily we have several examples already, in the form of the work carried out by the developer of the Kestrel 53000 series of CPUs.
80
81 The other main challenge is that as the size of the code being tested goes up, the CPU resources required go up exponentially. At the low level it is fine: tests can take several hours on a standard high end desktop. However as things progress to larger levels we may actually need access to Beowulf Clusters or other supercomputing resources.
82
83 ## Describe the ecosystem of the project, and how you will engage with relevant actors and promote the outcomes?
84
85 As mentioned in the 2018 submission, the Libre RISC-V
86 SoC has a full set of resources for Libre Project Management and development:
87 mailing list, bugtracker, git repository and wiki - all listed here:
88 <https://libre-riscv.org/>
89
90 In addition, we have a Crowdsupply page
91 <https://www.crowdsupply.com/libre-risc-v/m-class> which provides a public
92 gateway, and heise.de, reddit, phoronix, slashdot and other locations have
93 all picked up the story. The list is updated and maintained here:
94 <https://libre-riscv.org/3d_gpu/>
95
96 # Extra info to be submitted
97
98 * <http://libre-riscv.org/3d_gpu/>
99 * <https://nlnet.nl/project/Libre-RISCV/>
100 * <https://symbiyosys.readthedocs.io>