FPGC_100MHz_tb.v 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Testbench
  3. * Simulates the entire FPGC
  4. * 100MHz experiment
  5. */
  6. // Set timescale
  7. `timescale 1 ns/1 ns
  8. // tld
  9. `include "/home/bart/Documents/FPGA/FPGC6/Verilog/modules/FPGC6.v"
  10. // other logic
  11. `include "/home/bart/Documents/FPGA/FPGC6/Verilog/modules/MultiStabilizer.v"
  12. // cpu
  13. `include "/home/bart/Documents/FPGA/FPGC6/Verilog/modules/CPU/CPU.v"
  14. `include "/home/bart/Documents/FPGA/FPGC6/Verilog/modules/CPU/ALU.v"
  15. `include "/home/bart/Documents/FPGA/FPGC6/Verilog/modules/CPU/ControlUnit.v"
  16. `include "/home/bart/Documents/FPGA/FPGC6/Verilog/modules/CPU/InstructionDecoder.v"
  17. `include "/home/bart/Documents/FPGA/FPGC6/Verilog/modules/CPU/Regbank.v"
  18. `include "/home/bart/Documents/FPGA/FPGC6/Verilog/modules/CPU/Stack.v"
  19. `include "/home/bart/Documents/FPGA/FPGC6/Verilog/modules/CPU/InstrMem.v"
  20. `include "/home/bart/Documents/FPGA/FPGC6/Verilog/modules/CPU/DataMem.v"
  21. `include "/home/bart/Documents/FPGA/FPGC6/Verilog/modules/CPU/Regr.v"
  22. `include "/home/bart/Documents/FPGA/FPGC6/Verilog/modules/CPU/Arbiter.v"
  23. `include "/home/bart/Documents/FPGA/FPGC6/Verilog/modules/CPU/IntController.v"
  24. // memory
  25. `include "/home/bart/Documents/FPGA/FPGC6/Verilog/modules/Memory/SRAM.v"
  26. `include "/home/bart/Documents/FPGA/FPGC6/Verilog/modules/Memory/L1Dcache.v"
  27. `include "/home/bart/Documents/FPGA/FPGC6/Verilog/modules/Memory/MemoryUnit.v"
  28. // Define testmodule
  29. module FPGC_tb;
  30. //Clock I/O
  31. reg clk;
  32. reg nreset;
  33. //Led I/O
  34. wire led;
  35. FPGC6 fpgc (
  36. .clk(clk),
  37. .nreset(nreset),
  38. //Led for debugging
  39. .led(led)
  40. );
  41. initial
  42. begin
  43. //Dump everything for GTKwave
  44. $dumpfile("/home/bart/Documents/FPGA/FPGC6/Verilog/output/wave.vcd");
  45. $dumpvars;
  46. clk = 0;
  47. nreset = 1;
  48. repeat(3)
  49. begin
  50. #5 clk = ~clk; //100MHz
  51. #5 clk = ~clk;
  52. end
  53. nreset = 0;
  54. repeat(3)
  55. begin
  56. #5 clk = ~clk; //100MHz
  57. #5 clk = ~clk;
  58. end
  59. nreset = 1;
  60. repeat(1000)
  61. begin
  62. #5 clk = ~clk; //100MHz
  63. #5 clk = ~clk;
  64. end
  65. #1 $finish;
  66. end
  67. endmodule