cryptography ip-cores in vhdl / verilog
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
2.9 KiB

  1. # ======================================================================
  2. # AES CBC encryption/decryption
  3. # Copyright (C) 2021 Torsten Meissner
  4. #-----------------------------------------------------------------------
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program; if not, write to the Free Software
  15. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. # ======================================================================
  17. .SECONDARY:
  18. DESIGN_NAME := cbcaes
  19. RTL_SRC := \
  20. ../../../aes/rtl/vhdl/aes_pkg.vhd \
  21. ../../../aes/rtl/vhdl/aes_enc.vhd \
  22. ../../../aes/rtl/vhdl/aes_dec.vhd \
  23. ../../../aes/rtl/vhdl/aes.vhd \
  24. ../../rtl/vhdl/$(DESIGN_NAME).vhd
  25. SIM_SRC := tb_$(DESIGN_NAME).vhd
  26. C_SRC := tb_$(DESIGN_NAME).c
  27. OSVVM_DIR := ../../../lib/osvvm
  28. OSVVM_SRC := \
  29. $(OSVVM_DIR)/NamePkg.vhd \
  30. $(OSVVM_DIR)/OsvvmGlobalPkg.vhd \
  31. $(OSVVM_DIR)/VendorCovApiPkg.vhd \
  32. $(OSVVM_DIR)/TranscriptPkg.vhd \
  33. $(OSVVM_DIR)/TextUtilPkg.vhd \
  34. $(OSVVM_DIR)/AlertLogPkg.vhd \
  35. $(OSVVM_DIR)/MessagePkg.vhd \
  36. $(OSVVM_DIR)/SortListPkg_int.vhd \
  37. $(OSVVM_DIR)/RandomBasePkg.vhd \
  38. $(OSVVM_DIR)/RandomPkg.vhd \
  39. $(OSVVM_DIR)/CoveragePkg.vhd \
  40. $(OSVVM_DIR)/MemoryPkg.vhd \
  41. $(OSVVM_DIR)/ScoreboardGenericPkg.vhd \
  42. $(OSVVM_DIR)/ScoreboardPkg_slv.vhd \
  43. $(OSVVM_DIR)/ScoreboardPkg_int.vhd \
  44. $(OSVVM_DIR)/ResolutionPkg.vhd \
  45. $(OSVVM_DIR)/TbUtilPkg.vhd \
  46. $(OSVVM_DIR)/OsvvmContext.vhd
  47. VHD_STD := 08
  48. .PHONY: sim
  49. sim: tb_$(DESIGN_NAME).ghw
  50. .PHONY: compile
  51. compile: tb_$(DESIGN_NAME)
  52. osvvm work:
  53. mkdir $@
  54. osvvm/OsvvmContext.o: $(OSVVM_SRC) | osvvm
  55. @echo "Analyze OSVVM library ..."
  56. ghdl -a --std=$(VHD_STD) -Wno-hide --work=osvvm --workdir=osvvm $(OSVVM_SRC)
  57. tb_$(DESIGN_NAME): ${RTL_SRC} ${SIM_SRC} ${C_SRC} osvvm/OsvvmContext.o | work
  58. @echo "Analyze testbench & design ..."
  59. ghdl -a --std=$(VHD_STD) -fpsl --workdir=work -P=osvvm ${RTL_SRC} ${SIM_SRC}
  60. @echo "Elaborate testbench & design ..."
  61. ghdl -e --std=$(VHD_STD) -fpsl --workdir=work -P=osvvm -Wl,$@.c -Wl,-lcrypto -Wl,-lssl $@
  62. tb_$(DESIGN_NAME).ghw: tb_$(DESIGN_NAME)
  63. @echo "Run testbench ..."
  64. ghdl -r $(basename $@) --wave=$@ --assert-level=error --psl-report=$(basename $@)_psl_report.json
  65. .PHONY: wave
  66. wave: tb_$(DESIGN_NAME).ghw
  67. @echo "Run GTKwave ..."
  68. gtkwave -S tb_$(DESIGN_NAME).tcl tb_$(DESIGN_NAME).ghw
  69. .PHONY: clean
  70. clean:
  71. @echo "Cleaning simulation files ..."
  72. rm -rf tb_$(DESIGN_NAME) tb_$(DESIGN_NAME).ghw *.o *.json work/ osvvm/