Files
crypto/ChaCha20_Poly1305_64/doc/qr_pipelining.drawio
2025-07-02 06:32:58 -07:00

155 lines
13 KiB
Plaintext

<mxfile host="Electron" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/25.0.2 Chrome/128.0.6613.186 Electron/32.2.5 Safari/537.36" version="25.0.2">
<diagram name="Page-1" id="de-ffv5K_z_w-HYk_-7N">
<mxGraphModel dx="721" dy="1186" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="ZoMeok9N2fHc0OsoVYq9-17" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="ZoMeok9N2fHc0OsoVYq9-1" target="ZoMeok9N2fHc0OsoVYq9-16">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-1" value="&lt;div&gt;Quarter Round&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="200" y="60" width="80" height="40" as="geometry" />
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-2" value="state in" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="80" y="40" width="40" height="80" as="geometry" />
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-5" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="ZoMeok9N2fHc0OsoVYq9-4" target="ZoMeok9N2fHc0OsoVYq9-1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-4" value="" style="shape=trapezoid;perimeter=trapezoidPerimeter;whiteSpace=wrap;html=1;fixedSize=1;rotation=90;" vertex="1" parent="1">
<mxGeometry x="115" y="65" width="80" height="30" as="geometry" />
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-6" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.125;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1" source="ZoMeok9N2fHc0OsoVYq9-2">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="170" y="100" as="sourcePoint" />
<mxPoint x="140" y="50" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-7" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.125;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="120" y="70" as="sourcePoint" />
<mxPoint x="140" y="70" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-8" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.125;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="120" y="90" as="sourcePoint" />
<mxPoint x="140" y="90" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-9" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.125;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="120" y="110" as="sourcePoint" />
<mxPoint x="140" y="110" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-12" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.125;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="340" y="49.88511627906976" as="sourcePoint" />
<mxPoint x="360" y="49.88511627906976" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-13" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.125;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="340" y="69.88511627906988" as="sourcePoint" />
<mxPoint x="360" y="69.88511627906988" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-14" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.125;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="340" y="89.88511627906988" as="sourcePoint" />
<mxPoint x="360" y="89.88511627906988" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-15" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.125;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="340" y="109.88511627906988" as="sourcePoint" />
<mxPoint x="360" y="109.88511627906988" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-16" value="" style="shape=trapezoid;perimeter=trapezoidPerimeter;whiteSpace=wrap;html=1;fixedSize=1;rotation=90;flipV=1;" vertex="1" parent="1">
<mxGeometry x="285" y="65" width="80" height="30" as="geometry" />
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-34" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="ZoMeok9N2fHc0OsoVYq9-18" target="ZoMeok9N2fHc0OsoVYq9-21">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-18" value="state out" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="360" y="40" width="40" height="80" as="geometry" />
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-19" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="ZoMeok9N2fHc0OsoVYq9-20" target="ZoMeok9N2fHc0OsoVYq9-32">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-20" value="&lt;div&gt;Quarter Round&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="560" y="60" width="80" height="40" as="geometry" />
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-21" value="state in" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="440" y="40" width="40" height="80" as="geometry" />
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-22" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="ZoMeok9N2fHc0OsoVYq9-23" target="ZoMeok9N2fHc0OsoVYq9-20">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-23" value="" style="shape=trapezoid;perimeter=trapezoidPerimeter;whiteSpace=wrap;html=1;fixedSize=1;rotation=90;" vertex="1" parent="1">
<mxGeometry x="475" y="65" width="80" height="30" as="geometry" />
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-24" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.125;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1" source="ZoMeok9N2fHc0OsoVYq9-21">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="530" y="100" as="sourcePoint" />
<mxPoint x="500" y="50" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-25" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.125;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="480" y="70" as="sourcePoint" />
<mxPoint x="500" y="70" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-26" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.125;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="480" y="90" as="sourcePoint" />
<mxPoint x="500" y="90" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-27" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.125;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="480" y="110" as="sourcePoint" />
<mxPoint x="500" y="110" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-28" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.125;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="700" y="49.88511627906976" as="sourcePoint" />
<mxPoint x="720" y="49.88511627906976" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-29" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.125;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="700" y="69.88511627906988" as="sourcePoint" />
<mxPoint x="720" y="69.88511627906988" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-30" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.125;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="700" y="89.88511627906988" as="sourcePoint" />
<mxPoint x="720" y="89.88511627906988" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-31" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.125;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="700" y="109.88511627906988" as="sourcePoint" />
<mxPoint x="720" y="109.88511627906988" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-32" value="" style="shape=trapezoid;perimeter=trapezoidPerimeter;whiteSpace=wrap;html=1;fixedSize=1;rotation=90;flipV=1;" vertex="1" parent="1">
<mxGeometry x="645" y="65" width="80" height="30" as="geometry" />
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-33" value="state out" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="720" y="40" width="40" height="80" as="geometry" />
</mxCell>
<mxCell id="ZoMeok9N2fHc0OsoVYq9-35" value="&lt;h1 style=&quot;margin-top: 0px;&quot;&gt;State Blocks&lt;/h1&gt;&lt;p&gt;Each round shuffles the state, so we cannot simply pipeline the quarter roundds all the way through. Before each round, we must regroup all of the words int a single 512 bit state, then separate them again into the desired words to put into the quarter round. Even and odd rounds use different words, but every even round and every odd round is the same, so this can still be done in a for loop.&lt;/p&gt;&lt;p&gt;Odd loops would pass in [0,4,8,12], [1,5,9,13], [2,6,10,14], then [3,7,11,15]. This means that the output of the first clock cycle is the new [0,4,8,12], however the first cycle of the next even round needs [0, 5, 10, 15], meaning we need to wait until the 4th cycle of the previous round. This is done by writing them 1 at a time to the state_out register to their respective locations in the 512 bit register. Then, when all 512 bits are ready, it gets passed in one cycle to the next block, where it is then split up again.&lt;/p&gt;&lt;p&gt;As it only takes 4 cycles to to do a complete round, and the QR is 8 cycles deep, it will be possible to have multiple rounds in a quarter cycle simultaneously.&amp;nbsp;&lt;/p&gt;" style="text;html=1;whiteSpace=wrap;overflow=hidden;rounded=0;" vertex="1" parent="1">
<mxGeometry x="80" y="160" width="680" height="330" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>