top_tb.v 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * top_tb.v
  3. *
  4. * vim: ts=4 sw=4
  5. *
  6. * Copyright (C) 2019 Sylvain Munaut <tnt@246tNt.com>
  7. * All rights reserved.
  8. *
  9. * BSD 3-clause, see LICENSE.bsd
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions are met:
  13. * * Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. * * Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in the
  17. * documentation and/or other materials provided with the distribution.
  18. * * Neither the name of the <organization> nor the
  19. * names of its contributors may be used to endorse or promote products
  20. * derived from this software without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  23. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  24. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25. * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  26. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  27. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  28. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  29. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  31. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. */
  33. `default_nettype none
  34. module top_tb;
  35. // Signals
  36. // -------
  37. wire [3:0] spi_io;
  38. wire spi_sck;
  39. wire [1:0] spi_cs_n;
  40. wire uart_rx;
  41. wire uart_tx;
  42. // Setup recording
  43. // ---------------
  44. initial begin
  45. $dumpfile("top_tb.vcd");
  46. $dumpvars(0,top_tb);
  47. # 2000000 $finish;
  48. end
  49. // DUT
  50. // ---
  51. top dut_I (
  52. .spi_io (spi_io),
  53. .spi_sck (spi_sck),
  54. .spi_cs_n (spi_cs_n),
  55. .uart_rx (uart_rx),
  56. .uart_tx (uart_tx),
  57. .btn (1'b1),
  58. .rgb (),
  59. .clk_in (1'b0)
  60. );
  61. // Support
  62. // -------
  63. pullup(uart_tx);
  64. pullup(uart_rx);
  65. spiflash flash_I (
  66. .csb(spi_cs_n[0]),
  67. .clk(spi_sck),
  68. .io0(spi_io[0]),
  69. .io1(spi_io[1]),
  70. .io2(spi_io[2]),
  71. .io3(spi_io[3])
  72. );
  73. endmodule // top_tb