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.

97 lines
2.9 KiB

  1. # ======================================================================
  2. # AES encryption/decryption
  3. # Copyright (C) 2019 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 := ctraes
  19. RTL_SRC := \
  20. ../../../aes/rtl/vhdl/aes_pkg.vhd \
  21. ../../../aes/rtl/vhdl/aes_enc.vhd \
  22. ../../rtl/vhdl/$(DESIGN_NAME).vhd
  23. SIM_SRC := tb_$(DESIGN_NAME).vhd
  24. C_SRC := tb_ctraes.c
  25. OSVVM_DIR := ../../../lib/osvvm
  26. OSVVM_SRC := \
  27. $(OSVVM_DIR)/NamePkg.vhd \
  28. $(OSVVM_DIR)/OsvvmGlobalPkg.vhd \
  29. $(OSVVM_DIR)/VendorCovApiPkg.vhd \
  30. $(OSVVM_DIR)/TranscriptPkg.vhd \
  31. $(OSVVM_DIR)/TextUtilPkg.vhd \
  32. $(OSVVM_DIR)/AlertLogPkg.vhd \
  33. $(OSVVM_DIR)/MessagePkg.vhd \
  34. $(OSVVM_DIR)/SortListPkg_int.vhd \
  35. $(OSVVM_DIR)/RandomBasePkg.vhd \
  36. $(OSVVM_DIR)/RandomPkg.vhd \
  37. $(OSVVM_DIR)/CoveragePkg.vhd \
  38. $(OSVVM_DIR)/MemoryPkg.vhd \
  39. $(OSVVM_DIR)/ScoreboardGenericPkg.vhd \
  40. $(OSVVM_DIR)/ScoreboardPkg_slv.vhd \
  41. $(OSVVM_DIR)/ScoreboardPkg_int.vhd \
  42. $(OSVVM_DIR)/ResolutionPkg.vhd \
  43. $(OSVVM_DIR)/TbUtilPkg.vhd \
  44. $(OSVVM_DIR)/OsvvmContext.vhd
  45. VHD_STD := 08
  46. .PHONY: sim
  47. sim: tb_$(DESIGN_NAME).ghw
  48. .PHONY: compile
  49. compile: tb_$(DESIGN_NAME)
  50. osvvm work:
  51. mkdir $@
  52. osvvm/OsvvmContext.o: $(OSVVM_SRC) | osvvm
  53. @echo "Analyze OSVVM library ..."
  54. ghdl -a --std=$(VHD_STD) -Wno-hide --work=osvvm --workdir=osvvm $(OSVVM_SRC)
  55. tb_$(DESIGN_NAME): ${RTL_SRC} ${SIM_SRC} ${C_SRC} osvvm/OsvvmContext.o | work
  56. @echo "Analyze testbench & design ..."
  57. ghdl -a --std=$(VHD_STD) -fpsl --workdir=work -P=osvvm ${RTL_SRC} ${SIM_SRC}
  58. @echo "Elaborate testbench & design ..."
  59. ghdl -e --std=$(VHD_STD) -fpsl --workdir=work -P=osvvm -Wl,$@.c -Wl,-lcrypto -Wl,-lssl $@
  60. tb_$(DESIGN_NAME).ghw: tb_$(DESIGN_NAME)
  61. @echo "Run testbench ..."
  62. ghdl -r $(basename $@) --wave=$@ --assert-level=error --psl-report=$(basename $@)_psl_report.json
  63. .PHONY: wave
  64. wave: tb_$(DESIGN_NAME).ghw
  65. @echo "Run GTKwave ..."
  66. gtkwave -S tb_$(DESIGN_NAME).tcl tb_$(DESIGN_NAME).ghw
  67. .PHONY: clean
  68. clean:
  69. @echo "Cleaning simulation files ..."
  70. rm -rf tb_$(DESIGN_NAME) tb_$(DESIGN_NAME).ghw *.o *.json work/ osvvm/