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.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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); //dip[3:0]
  21. modport steuerung_port(input dip, timer, spi_read, clk); //dip[3:0] / spi_read[1:0]
  22. modport spi_port(input dip, clk, timer, 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. //always at change of the input dip, put the change on the bus
  27. always@(d.dip[0] or d.dip[1] or d.dip[2] or d.dip[3])
  28. b.dip = d.dip;
  29. endmodule
  30. module steuerung(bus.steuerung_port b, led_if.led_port_top i);
  31. /*...
  32. b.dip[3:0], b.timer, b.spi_read[1:0]
  33. i.rgb[2:0]
  34. ...*/
  35. endmodule
  36. /*
  37. _______________________________________________________________________________________________________________
  38. Testbench
  39. __________________ ___________________
  40. | | | |
  41. | DIP-Schalter | | FRAM-Speicher |
  42. | | | |
  43. |__________________| |___________________|
  44. | |
  45. ____________________________|________________________________________________________________|_________________
  46. Toplevel | |
  47. | |
  48. dip[3:0]-->| |<--mosi, miso, sclk, ss
  49. | |
  50. ________|_________ ________|__________
  51. | | | |
  52. | Parallelport | | SPI-Schnittstelle |
  53. | | | & FRAM-Kontroller |
  54. |__________________| |___________________|
  55. | |
  56. | |
  57. dip[3:0]-->| |<--dip[3:0], timer, spi_read[1:0]
  58. | |
  59. | |
  60. ---------------------------------------------------------------------BUS
  61. | |
  62. | |
  63. dip[0], clk, timer-->| |<--dip[3:0], timer, spi_read[1:0]
  64. | |
  65. ________|_________ ___________________ ________|__________
  66. | | | | | |
  67. | Timer | | Oszillator-Takt | | Ampel-Steuerung |
  68. | | | (auf Board) | | |
  69. |__________________| |___________________| |___________________|
  70. | | |
  71. | | |
  72. clk-->------------------------------ |<--rgb[2:0]
  73. | |
  74. ____________________________|________________________________________________________________|___________________
  75. | |
  76. ________|_________ ________|__________
  77. | | | |
  78. | Takt | | RGB-LED |
  79. | (der Testbench) | | |
  80. |__________________| |___________________|
  81. __________________________________________________________________________________________________________________
  82. */