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.

76 lines
1.8 KiB

  1. // ======================================================================
  2. // DES encryption/decryption testbench
  3. // tests according to NIST 800-17 special publication
  4. // Copyright (C) 2012 Torsten Meissner
  5. //-----------------------------------------------------------------------
  6. // This program is free software; you can redistribute it and/or modify
  7. // it under the terms of the GNU General Public License as published by
  8. // the Free Software Foundation; either version 2 of the License, or
  9. // (at your option) any later version.
  10. //
  11. // This program is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. // GNU General Public License for more details.
  15. //
  16. // You should have received a copy of the GNU General Public License
  17. // along with this program; if not, write to the Free Software
  18. // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  19. // ======================================================================
  20. `timescale 1ns/1ps
  21. module tb_cbcdes;
  22. // set dumpfile
  23. initial begin
  24. $dumpfile ("tb_cbcdes.vcd");
  25. $dumpvars (0, tb_cbcdes);
  26. end
  27. reg reset;
  28. reg clk = 0;
  29. reg mode;
  30. reg [0:63] key;
  31. reg [0:63] datain;
  32. reg validin;
  33. reg start;
  34. reg [0:63] iv;
  35. wire [0:63] dataout;
  36. wire validout;
  37. wire readyout;
  38. // setup simulation
  39. initial begin
  40. reset = 1;
  41. #1 reset = 0;
  42. #20 reset = 1;
  43. end
  44. // generate clock with 100 mhz
  45. always #5 clk = !clk;
  46. // dut
  47. cbcdes i_cbcdes (
  48. .reset_i(reset),
  49. .clk_i(clk),
  50. .start_i(start),
  51. .mode_i(mode),
  52. .key_i(key),
  53. .iv_i(iv),
  54. .data_i(datain),
  55. .valid_i(validin),
  56. .ready_o(readyout),
  57. .data_o(dataout),
  58. .valid_o(validout)
  59. );
  60. endmodule