Browse Source

Minor update to TDES sim makefile and testbench

master
T. Meissner 8 months ago
parent
commit
2d708cbb51
2 changed files with 21 additions and 14 deletions
  1. +13
    -12
      tdes/sim/vhdl/Makefile
  2. +8
    -2
      tdes/sim/vhdl/tb_tdes.vhd

+ 13
- 12
tdes/sim/vhdl/Makefile View File

@ -19,30 +19,31 @@
# ======================================================================
DES_SRC_FILES := ../../../des/rtl/vhdl/des_pkg.vhd ../../../des/rtl/vhdl/des.vhd
TDES_SRC_FILES := ../../rtl/vhdl/tdes.vhd
SRC_FILES := $(DES_SRC_FILES) $(TDES_SRC_FILES)
DESIGN_NAME := tdes
SRC_FILES := ../../../des/rtl/vhdl/des_pkg.vhd \
../../../des/rtl/vhdl/des.vhd \
../../rtl/vhdl/$(DESIGN_NAME).vhd
VHD_STD := 08
.PHONY: sim
sim : tb_tdes.ghw
sim : tb_$(DESIGN_NAME).ghw
.PHONY: all
all : wave
tb_des.o: $(SRC_FILES) tb_tdes.vhd
ghdl -a --std=$(VHD_STD) $(SRC_FILES) tb_tdes.vhd
tb_$(DESIGN_NAME).o: $(SRC_FILES) tb_$(DESIGN_NAME).vhd
ghdl -a --std=$(VHD_STD) $(SRC_FILES) $(basename $@).vhd
tb_tdes.ghw : tb_des.o
ghdl -e --std=$(VHD_STD) tb_tdes
ghdl -r tb_tdes --wave=tb_tdes.ghw --assert-level=error --stop-time=45us
tb_$(DESIGN_NAME).ghw : tb_$(DESIGN_NAME).o
ghdl -e --std=$(VHD_STD) $(basename $@)
ghdl -r $(basename $@) --wave=$@ --assert-level=error
wave : tb_tdes.ghw
gtkwave -s tb_tdes.tcl tb_tdes.ghw
wave : tb_$(DESIGN_NAME).ghw
gtkwave -s tb_$(DESIGN_NAME).tcl tb_$(DESIGN_NAME).ghw
clean :
echo "# Cleaning files"
rm -f *.ghw *.o tb_tdes work*.cf
rm -f *.ghw *.o tb_$(DESIGN_NAME) work*.cf

+ 8
- 2
tdes/sim/vhdl/tb_tdes.vhd View File

@ -23,12 +23,15 @@ library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use std.env.all;
entity tb_tdes is
end entity tb_tdes;
architecture rtl of tb_tdes is
@ -124,21 +127,24 @@ begin
testcheckerP : process is
begin
s_acceptout <= '1';
report "# ENCRYPTION TESTS";
report "# ENCRYPTION";
for index in c_table_test_plain'range loop
wait until rising_edge(s_clk) and s_validout = '1';
s_tdes_answers(index) <= s_dataout;
report "TDES enc: 0x" & to_hstring(c_table_test_plain(index)) & " -> " & to_hstring(s_dataout);
end loop;
report "# DECRYPTION TESTS";
report "# tdes known answer test";
for index in c_table_test_plain'range loop
wait until rising_edge(s_clk) and s_validout = '1';
report "TDES dec: 0x" & to_hstring(s_tdes_answers(index)) & " -> " & to_hstring(s_dataout);
assert (s_dataout = c_table_test_plain(index))
report "decryption error"
severity error;
end loop;
report "# Successfully passed all tests";
wait;
wait for 10 us;
stop(0);
end process testcheckerP;


Loading…
Cancel
Save