This repository contains both a Python reference implementation of the Midori 128 bit block cipher and a hardware design written in VHDL.
To be able to run the VHDL project on Windows, you need to have the following things installed:
-
Make, can be installed through Cygwin. Make sure to add the
bin
folder (default location isC:\cygwin\bin
) to yourPATH
variable, as we will need to invoke the make utility from the command line later on. -
GHDL, can be found here. Also add the
bin
folder to your path (default location isC:\Program Files (x86)\ghdl-x.yz\bin
, wherex.yz
corresponds to the version you are using). -
gtkwave, can be found here. Also add the
bin
folder to your path (default location isC:\Program Files (x86)\gtkwave
) -
Sublime text. We will use a custom VHDL syntax highlighing. This requires you to install the Sublime Text Package manager called Package Control. Once you have this installed, press
CTRL + SHIFT + P
, selectinstall package
and search forVHDL
. The package you need to install is calledVHDL Package for Sublime Text 2/3
.
Take a look at the make file to see which targets are specified.
To simulate the project, do the following:
- Open the terminal
- Go to the
vhdl_source
folder. - Enter the command
make test_core
- It should have compiled and simulated the midori 128 core and written the simulation in
tb_midori128_core.ghw
- Enter the command
gtkwave tb_midori128_core.ghw
- GTKWave will open, however nothing will be shown. To be able to see something, you should add the signals you want to see.
- In the left corner there will be something called
\top
with a plus sign. If you click it will showtb_midori128_core
which is the test-bench. Below it will enumerate some "Signals". You can drag these from the left to the right. - After dragging all of them you will see the screen change. Press the button with the magnifying glass and a square inside, that is your "Zoom to fit". After you press it you should have the vision of the entire simulation.
- The more you click, the deeper you go into the design. Add as many signals if you want.
- You can also save the current preset of the signals. In GTKwave, go to
File -> Write Save File As
(Ctrl + Shift + S). Now choose a name and safe the preset. The next time you want to load this preset, you do the following: go toFile -> Read Save File
(Ctrl + O). This wil load all the signals that were stored in this preset.