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.

top_level.sv 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // Definition of top level
  2. module top(led_if.led_port_top l, dip_if.dip_port_top d, fram_if.fram_port_top f, clock_if.clock_port_top c);
  3. // Initialisation of bus
  4. bus fpga_bus();
  5. // Initialisation of modules
  6. timer t(fpga_bus, c);
  7. steuerung st(fpga_bus, l);
  8. spi s(fpga_bus, f);
  9. parallelport p(fpga_bus, d);
  10. endmodule : top
  11. // Definition of bus interface
  12. interface bus();
  13. // bus wires
  14. logic clk; // clock
  15. logic timer;
  16. logic [3:0]dip;
  17. logic [1:0]spi_read;
  18. // modports from modules pov
  19. modport timer_port(input dip, output timer, clk); //dip[0]
  20. modport parallel_port(output dip);
  21. modport steuerung_port(input dip, timer, clk, spi_read); //dip[3:0] / spi_read[1:0]
  22. modport spi_port(input dip, timer, clk, output spi_read); //spi_read[1:0]
  23. endinterface : bus
  24. // Definition of parallelport
  25. module parallelport(bus.parallel_port b, dip_if.dip_port_top d);
  26. //b.dip <= d.dip;
  27. endmodule
  28. module spi(bus.spi_port b, fram_if.fram_port_top i);
  29. /*...
  30. b.dip[3:0], b.timer, b.spi_read[1:0]
  31. i.ss, i.mosi, i.miso, i.sclk
  32. ...*/
  33. endmodule
  34. module timer(bus.timer_port b, clock_if.clock_port_top i);
  35. /*...
  36. b.clk, b.dip[0], b.timer
  37. i.clk
  38. ...*/
  39. endmodule
  40. module steuerung(bus.steuerung_port b, led_if.led_port_top i);
  41. /*...
  42. b.dip[3:0], b.timer, b.spi_read[1:0]
  43. i.rgb[2:0]
  44. ...*/
  45. endmodule
  46. /*
  47. _______________________________________________________________________________________________________________
  48. Testbench
  49. __________________ ___________________
  50. | | | |
  51. | DIP-Schalter | | FRAM-Speicher |
  52. | | | |
  53. |__________________| |___________________|
  54. | |
  55. ____________________________|________________________________________________________________|_________________
  56. Toplevel | |
  57. | |
  58. dip[3:0]-->| |<--mosi, miso, sclk, ss
  59. | |
  60. ________|_________ ________|__________
  61. | | | |
  62. | Parallelport | | SPI-Schnittstelle |
  63. | | | & FRAM-Kontroller |
  64. |__________________| |___________________|
  65. | |
  66. | |
  67. dip[3:0]-->| |<--dip[3:0], timer, spi_read[1:0]
  68. | |
  69. | |
  70. ---------------------------------------------------------------------BUS
  71. | |
  72. | |
  73. dip[0], clk, timer-->| |<--dip[3:0], timer, spi_read[1:0]
  74. | |
  75. ________|_________ ___________________ ________|__________
  76. | | | | | |
  77. | Timer | | Oszillator-Takt | | Ampel-Steuerung |
  78. | | | (auf Board) | | |
  79. |__________________| |___________________| |___________________|
  80. | | |
  81. | | |
  82. clk-->------------------------------ |<--rgb[2:0]
  83. | |
  84. ____________________________|________________________________________________________________|___________________
  85. | |
  86. ________|_________ ________|__________
  87. | | | |
  88. | Takt | | RGB-LED |
  89. | (der Testbench) | | |
  90. |__________________| |___________________|
  91. __________________________________________________________________________________________________________________
  92. */