[Cryptech Tech] FPGAs for Dummies

Joachim Strömbergson joachim at secworks.se
Fri Sep 19 17:22:58 UTC 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Aloha!

Warren Kumari wrote:
>> I can only very kinda sorta understand a single threaded program. 
>> Throw in some sort of parallelism (like a thread or two) and I
>> start going cross-eyed. My mind simply shuts down when I need to
>> imagine "do this thing every time there is a clock cycle, don't
>> worry, the data will be there."

Yes, it is a challenge. Drawing the design on paper really helps. And
for datapaths, drawing clock lines makes it much easier to see what
happens when. Also, Verilog (and VHDL) is much more low level - you
really describe everything.

The design style I use is to place all registers in one process that
means that the updates in that process happens in parallel. But in all
other processes (which only contains logic), the code chunks is
sequential more or less like in a programming language. It really helps
for the understanding (imho). Oh, and all proceeses "runs" in parallel
and one needs to figure out how they interact, solve sharing between
them etc.

Take a look at the SipHash core for example and see if it makes sense:

https://github.com/secworks/siphash/blob/master/src/rtl/siphash_core.v

There is a bunch of declarations for registers, wires etc. Then you have
the register updates - this is where the registers becomes the
registers. This is followed by the real functional logic. It is
basically separate blocks of logic connected to a MUX that selects what
block gets to update the state registers.

The SipHash needs a counter and the counter logic is placed in a
separate process. Finally at the bottom of the file there is the logic
that implements the control finite state machine that decides what needs
to be done and when.

Does it make sense and is understandable?

- -- 
Med vänlig hälsning, Yours

Joachim Strömbergson - Alltid i harmonisk svängning.
========================================================================
 Joachim Strömbergson          Secworks AB          joachim at secworks.se
========================================================================
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBCAAGBQJUHGZyAAoJEF3cfFQkIuyNpJAP/3Pk7Akd8ZT07sGNkFq8sBMd
W4w0R182V3UT62aP2a/BSbIoJhCwBmykY23S0r/weQ+fMykpDf5UETWm5AggniqQ
2OFo8AgtLfggmUhn3kN9fW2OwGFEabriieVst95Q5f3JcukHOJCo4cqtsdk3uxc9
Yej2SZFGj2Z2NDT/4Kp3r49I5Hks9RgWJ7GKSdFXNjcL4XSMHImiat/2Ue12YSY7
QuqBMz0qitzCW7bEIc5RMfyYFzeL03qUchIwf0Tg4FjhgE0aYykRXw9v7l5CGLjK
s+UXKmjxRwhsHxX2o+C6x1abAyNI2N9DN7uUhumiyCxuTmJ71A8LTCj4ZAh4oUeb
IxHnaYLj0sVxsiUEW0st+eYHvEUEfG/s2XOg2PsKv/4nXfNb8XivHjA7CKGDGI76
hL3HztnrywV2RuIWuiweh3DSoeyXH/PbBg9X4BhjL8VqkCB8m6ZCFKQqcXHNHZuI
C6xttHk6qlL+1AajwuCp1cJCKyEAJkQwKcgH1m/TVL9xs7DjShs8iCdne3j1H5kb
fDyFi5ZIu6CkFR8HjgwMRB4CwbbHw3sekWKRQx4duJKgzxN6H3lX1kJAU70VNOVH
79JGc8RePae0Ck24pMQw57TTRAd6kBUb993oyiKYidLlE+Lbnn/dYDXIhJrs4/qX
+dbQau5QKfURBAAfXJLl
=EiZK
-----END PGP SIGNATURE-----


More information about the Tech mailing list