Skip to content

Commit

Permalink
Add more text
Browse files Browse the repository at this point in the history
VonTum committed Dec 24, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 935a50d commit e313d01
Showing 7 changed files with 210 additions and 16 deletions.
7 changes: 7 additions & 0 deletions philosophy/combinatorial_dependency.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
# Combinatorial Dependency

Still a vague idea.

Ports in interfaces are combinatorially dependent on each other. To break combinatorial dependency, one has to use multiple interfaces.

`module m : int a, int b -> int out`

`out` is combinatorially dependent on `a` and `b`
30 changes: 30 additions & 0 deletions philosophy/compiletime_and_runtime.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Separating Compiletime and Runtime

Requirements:
- Code that describes plain hardware should be minimal to write. One shouldn't have to 'break out' of the generative environment to write plain hardware code.
- It should be easy to write generative code mixed with plain hardware.

## Differences
### Compile Time
Arrays need not be bounded. Integers need not be bounded.

### Runtime
Arrays that have dynamic indices must have a fixed size.
Integers must be bounded.

## Multiplexer inference
There is quite a significant difference between an array access with a constant, and one which should infer a multiplexer, but in both cases the syntax in other languages is exactly the same: `my_arr[idx]`

The constant index should infer to just a wire connection which costs nothing. In this case the different wires that are part of an array don't have any relation to each other in hardware. This allows us to bestow other properties as well. For example constant indices don't conflict with each other if they don't point to the same element. Runtime indices do. Array wires with constant indices don't enforce any latency requirements upon each other. 'dynamically sized' arrays can only be indexed with compile time indices. Etc.

With a runtime index (based on an integer wire in the design) should infer to a multiplexer. And then of course the array wires do have a relation.

An initial thought to distinguish the two was to just check for constant-ness of the array argument, which can be done at flattening time. But that wouldn't make the distinction clear enough.

Proposal: Require `mux` keyword for any runtime array index which should infer to a multiplexer.

Examples:
- `a[5] = 1;` constant index write
- `a[mux b] = 1;` multiplexed write
- `x = a[5];` constant index read
- `x = a[mux b];` multiplexed index write
146 changes: 146 additions & 0 deletions philosophy/images/fifoExample.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<mxfile host="Electron" modified="2023-12-22T13:00:02.357Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/21.6.5 Chrome/114.0.5735.243 Electron/25.3.1 Safari/537.36" etag="nmkY5eePYpF2Rw_UxBth" version="21.6.5" type="device">
<diagram name="Page-1" id="dcd7RLzTctuGvcLFz3Xy">
<mxGraphModel dx="816" dy="466" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-1" value="wr_ptr" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="280" y="640" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-3" value="rd_ptr" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="360" y="640" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-4" value="-" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;" vertex="1" parent="1">
<mxGeometry x="320" y="720" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-5" value="0" style="endArrow=classic;html=1;rounded=0;" edge="1" parent="1" source="ZoZ5rRmwT-pbfFqS2m2y-3" target="ZoZ5rRmwT-pbfFqS2m2y-4">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="350" y="750" as="sourcePoint" />
<mxPoint x="400" y="700" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-6" value="0" style="endArrow=classic;html=1;rounded=0;" edge="1" parent="1" source="ZoZ5rRmwT-pbfFqS2m2y-1" target="ZoZ5rRmwT-pbfFqS2m2y-4">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="381" y="688" as="sourcePoint" />
<mxPoint x="359" y="732" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-7" value="&amp;lt; 5" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;" vertex="1" parent="1">
<mxGeometry x="320" y="800" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-8" value="0" style="endArrow=classic;html=1;rounded=0;" edge="1" parent="1" source="ZoZ5rRmwT-pbfFqS2m2y-4" target="ZoZ5rRmwT-pbfFqS2m2y-7">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="319" y="688" as="sourcePoint" />
<mxPoint x="341" y="732" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-9" value="almost&lt;br style=&quot;font-size: 10px;&quot;&gt;full" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="200" y="800" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-10" value="" style="endArrow=classic;html=1;rounded=0;fillColor=#f8cecc;strokeColor=#b85450;" edge="1" parent="1" source="ZoZ5rRmwT-pbfFqS2m2y-7" target="ZoZ5rRmwT-pbfFqS2m2y-9">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="350" y="770" as="sourcePoint" />
<mxPoint x="350" y="810" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-11" value="-5" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="ZoZ5rRmwT-pbfFqS2m2y-10">
<mxGeometry x="-0.2077" y="1" relative="1" as="geometry">
<mxPoint x="-4" y="9" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-13" value="+ 1 ?" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;" vertex="1" parent="1">
<mxGeometry x="240" y="720" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-14" value="0" style="endArrow=classic;html=1;rounded=0;" edge="1" parent="1" source="ZoZ5rRmwT-pbfFqS2m2y-1" target="ZoZ5rRmwT-pbfFqS2m2y-13">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="319" y="688" as="sourcePoint" />
<mxPoint x="341" y="732" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-15" value="0&amp;nbsp;&amp;nbsp;" style="endArrow=classic;html=1;curved=1;" edge="1" parent="1" source="ZoZ5rRmwT-pbfFqS2m2y-13" target="ZoZ5rRmwT-pbfFqS2m2y-1">
<mxGeometry x="0.2667" y="-6" width="50" height="50" relative="1" as="geometry">
<mxPoint x="301" y="688" as="sourcePoint" />
<mxPoint x="279" y="732" as="targetPoint" />
<Array as="points">
<mxPoint x="260" y="690" />
</Array>
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-16" value="push" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#dae8fc;strokeColor=#6c8ebf;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="200" y="640" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-17" value="0" style="endArrow=classic;html=1;rounded=0;" edge="1" parent="1" source="ZoZ5rRmwT-pbfFqS2m2y-16" target="ZoZ5rRmwT-pbfFqS2m2y-13">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="301" y="688" as="sourcePoint" />
<mxPoint x="279" y="732" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-18" value="MEM" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="280" y="520" width="80" height="80" as="geometry" />
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-19" value="0" style="endArrow=classic;html=1;rounded=0;entryX=0.25;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="ZoZ5rRmwT-pbfFqS2m2y-1" target="ZoZ5rRmwT-pbfFqS2m2y-18">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="239" y="688" as="sourcePoint" />
<mxPoint x="261" y="732" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-20" value="data" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#dae8fc;strokeColor=#6c8ebf;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="200" y="560" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-21" value="0" style="endArrow=classic;html=1;rounded=0;entryX=0;entryY=0.75;entryDx=0;entryDy=0;" edge="1" parent="1" source="ZoZ5rRmwT-pbfFqS2m2y-20" target="ZoZ5rRmwT-pbfFqS2m2y-18">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="310" y="650" as="sourcePoint" />
<mxPoint x="310" y="610" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-22" value="0" style="endArrow=classic;html=1;rounded=0;" edge="1" parent="1" source="ZoZ5rRmwT-pbfFqS2m2y-3" target="ZoZ5rRmwT-pbfFqS2m2y-23">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="381" y="688" as="sourcePoint" />
<mxPoint x="430" y="720" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-23" value="..." style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;" vertex="1" parent="1">
<mxGeometry x="400" y="720" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-24" value="" style="endArrow=none;dashed=1;html=1;dashPattern=1 3;strokeWidth=2;rounded=1;" edge="1" parent="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="440" y="850" as="sourcePoint" />
<mxPoint x="440" y="510" as="targetPoint" />
<Array as="points">
<mxPoint x="190" y="850" />
<mxPoint x="190" y="510" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-25" value="" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="60" y="530" width="120" height="290" as="geometry" />
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-26" value="" style="endArrow=classic;html=1;curved=1;" edge="1" parent="1" source="ZoZ5rRmwT-pbfFqS2m2y-9" target="ZoZ5rRmwT-pbfFqS2m2y-16">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="260" y="710" as="sourcePoint" />
<mxPoint x="310" y="660" as="targetPoint" />
<Array as="points">
<mxPoint x="120" y="720" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-27" value="" style="endArrow=classic;html=1;curved=1;" edge="1" parent="1" source="ZoZ5rRmwT-pbfFqS2m2y-9" target="ZoZ5rRmwT-pbfFqS2m2y-20">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="214" y="818" as="sourcePoint" />
<mxPoint x="214" y="682" as="targetPoint" />
<Array as="points">
<mxPoint x="100" y="700" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-28" value="FIFO with almostFull threshold 5" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="190" y="480" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="ZoZ5rRmwT-pbfFqS2m2y-29" value="up to&lt;br&gt;5 cycles" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="100" y="680" width="50" height="30" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
Binary file added philosophy/images/fifoExample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 13 additions & 13 deletions philosophy/images/negativeBackedgeConcept.drawio
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
<mxfile host="Electron" modified="2023-12-21T12:14:38.324Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/21.6.5 Chrome/114.0.5735.243 Electron/25.3.1 Safari/537.36" etag="So_O1-wY2gBbPd6y5lLl" version="21.6.5" type="device">
<mxfile host="Electron" modified="2023-12-22T13:00:26.122Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/21.6.5 Chrome/114.0.5735.243 Electron/25.3.1 Safari/537.36" etag="zIf6Q9BZYrETdHWFbZGq" version="21.6.5" type="device">
<diagram name="Page-1" id="dcd7RLzTctuGvcLFz3Xy">
<mxGraphModel dx="573" dy="375" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<mxGraphModel dx="539" dy="308" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="DO0DF_5hXSPnRoMzoDqR-16" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;fontColor=#333333;strokeColor=#666666;dashed=1;" vertex="1" parent="1">
<mxCell id="DO0DF_5hXSPnRoMzoDqR-16" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;fontColor=#333333;strokeColor=#666666;dashed=1;" parent="1" vertex="1">
<mxGeometry x="270" y="470" width="180" height="140" as="geometry" />
</mxCell>
<mxCell id="DO0DF_5hXSPnRoMzoDqR-1" value="t" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;" vertex="1" parent="1">
<mxCell id="DO0DF_5hXSPnRoMzoDqR-1" value="t" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;" parent="1" vertex="1">
<mxGeometry x="280" y="480" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="DO0DF_5hXSPnRoMzoDqR-2" value="state" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxCell id="DO0DF_5hXSPnRoMzoDqR-2" value="state" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#ffe6cc;strokeColor=#d79b00;" parent="1" vertex="1">
<mxGeometry x="400" y="480" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="DO0DF_5hXSPnRoMzoDqR-3" value="in" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1">
<mxCell id="DO0DF_5hXSPnRoMzoDqR-3" value="in" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="380" y="560" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="DO0DF_5hXSPnRoMzoDqR-4" value="" style="endArrow=classic;html=1;rounded=0;fillColor=#f8cecc;strokeColor=#b85450;" edge="1" parent="1" source="DO0DF_5hXSPnRoMzoDqR-2" target="DO0DF_5hXSPnRoMzoDqR-1">
<mxCell id="DO0DF_5hXSPnRoMzoDqR-4" value="" style="endArrow=classic;html=1;rounded=0;fillColor=#f8cecc;strokeColor=#b85450;" parent="1" source="DO0DF_5hXSPnRoMzoDqR-2" target="DO0DF_5hXSPnRoMzoDqR-1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="370" y="570" as="sourcePoint" />
<mxPoint x="420" y="520" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="DO0DF_5hXSPnRoMzoDqR-7" value="0" style="endArrow=classic;html=1;rounded=0;" edge="1" parent="1" source="DO0DF_5hXSPnRoMzoDqR-3" target="DO0DF_5hXSPnRoMzoDqR-2">
<mxCell id="DO0DF_5hXSPnRoMzoDqR-7" value="0" style="endArrow=classic;html=1;rounded=0;" parent="1" source="DO0DF_5hXSPnRoMzoDqR-3" target="DO0DF_5hXSPnRoMzoDqR-2" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="420" y="560" as="sourcePoint" />
<mxPoint x="380" y="560" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="DO0DF_5hXSPnRoMzoDqR-10" value="-3" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxCell id="DO0DF_5hXSPnRoMzoDqR-10" value="-3" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="330" y="500" width="60" height="20" as="geometry" />
</mxCell>
<mxCell id="DO0DF_5hXSPnRoMzoDqR-13" value="out" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#d5e8d4;strokeColor=#82b366;" vertex="1" parent="1">
<mxCell id="DO0DF_5hXSPnRoMzoDqR-13" value="out" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" vertex="1">
<mxGeometry x="300" y="560" width="40" height="40" as="geometry" />
</mxCell>
<mxCell id="DO0DF_5hXSPnRoMzoDqR-15" value="0" style="endArrow=classic;html=1;rounded=0;" edge="1" parent="1" source="DO0DF_5hXSPnRoMzoDqR-1" target="DO0DF_5hXSPnRoMzoDqR-13">
<mxCell id="DO0DF_5hXSPnRoMzoDqR-15" value="0" style="endArrow=classic;html=1;rounded=0;" parent="1" source="DO0DF_5hXSPnRoMzoDqR-1" target="DO0DF_5hXSPnRoMzoDqR-13" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="279" y="572" as="sourcePoint" />
<mxPoint x="500" y="590" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="DO0DF_5hXSPnRoMzoDqR-17" value="at most&lt;br&gt;latency 3" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxCell id="DO0DF_5hXSPnRoMzoDqR-17" value="at most&lt;br&gt;latency 3" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="300" y="620" width="120" height="80" as="geometry" />
</mxCell>
<mxCell id="DO0DF_5hXSPnRoMzoDqR-20" value="" style="endArrow=classic;html=1;curved=1;" edge="1" parent="1" source="DO0DF_5hXSPnRoMzoDqR-13" target="DO0DF_5hXSPnRoMzoDqR-3">
<mxCell id="DO0DF_5hXSPnRoMzoDqR-20" value="" style="endArrow=classic;html=1;curved=1;" parent="1" source="DO0DF_5hXSPnRoMzoDqR-13" target="DO0DF_5hXSPnRoMzoDqR-3" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="320" y="590" as="sourcePoint" />
<mxPoint x="370" y="540" as="targetPoint" />
Binary file modified philosophy/images/negativeBackedgeConcept.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 14 additions & 3 deletions philosophy/latency.md
Original file line number Diff line number Diff line change
@@ -41,6 +41,9 @@ Usually it negative backedges would be found on the output of a module, which is

![Negative Backedge Concept](images/negativeBackedgeConcept.png)

As a more concrete example, consider the write side of a FIFO.
![FIFO Negative Backedge](images/fifoExample.png)

## Requirements for the latency counting system
- Addition or Removal of any latency registers that do not violate a constraint must not affect the operation of the design.
- Feedback loops containing only latency are considered combinatorial feedback loops, and are therefore forbidden. Feedback loops must therefore have at least one state register in them.
@@ -96,6 +99,14 @@ The issue starts when the inputs and outputs don't have predefined absolute late

One may think the solution would simply be to prefer inputs over outputs or something, just to get a deterministic latency assignment. Just move b to be the earliest of the available latencies, but even in this case, if we instead looked at the possibilities of a, and fixed b, we would again make b later by making a earlier. And since there's no way to distinguish meaningfully between inputs, there's no deterministic solution either.

To this problem I only really see two solutions:
- Still perform full latency computation when compiling each module separately. In the case of non-deterministic latency assignment, reject the code and require the programmer to add explicit latency annotations. The benefit is better encapsulation, the programmer requires only the module itself to know what latencies are. The downside is of course less flexible modules.
- Perform latency computation at integration level,
To this problem I only really see three options:
- Still perform full latency computation when compiling each module separately. In the case of non-deterministic latency assignment, reject the code and require the programmer to add explicit latency annotations. The benefit is better encapsulation, the programmer requires only the module itself to know what latencies are. The downside is of course less flexible modules. Though is this flexibility _really_ needed?
- Infer absolute latencies on the inputs and outputs of submodules using templates which can be inferred. This would be really handy to allow latency information to flow back into the templating system, thus allowing a FIFO that alters its almostFull threshold based on its input latency. Of course, this makes absolute latency information flow from top-down instead of bottom up, so now getting the latency information back from the module would be impossible. The issue is that templates can't be instantiated partially. Either the submodule takes all of its port latencies from the calling module, or it determines its latencies itself.
- Perform latency computation at integration level, we don't define the absolute latencies on the ports of a module, unless the programmer explicitly does so. For simlpicity, this requires that every single module instantiation now compiles to its own Verilog module though, which is less than ideal for debugging.

### Latency Graph Cycles are the key
So assigning absolute latencies is difficult, and no good solution can be found in isolated cases. Perhaps another approach would work better.

In essense, what are the reasons for which we want to count out latencies? The initial one of course was keeping signals in sync. In the vast majority of cases when you pipeline a design, you don't want to cross signals from different time steps. But of course, after pipelining a design, you need to _deal_ with the effect that this module now takes several cycles, and has a certain capacity to store in progress data.

Maybe instead of trying to infer the latencies from the pipeline with inputs and outputs, we focussed our attention purely on the cycles. These are already nice and constrained.

0 comments on commit e313d01

Please sign in to comment.