hdmi_phy_1x.v 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * hdmi_phy_1x.v
  3. *
  4. * vim: ts=4 sw=4
  5. *
  6. * Simple HDMI PHY, registering all signals in IO
  7. *
  8. * Copyright (C) 2021 Sylvain Munaut <tnt@246tNt.com>
  9. * All rights reserved.
  10. *
  11. * BSD 3-clause, see LICENSE.bsd
  12. *
  13. * Redistribution and use in source and binary forms, with or without
  14. * modification, are permitted provided that the following conditions are met:
  15. * * Redistributions of source code must retain the above copyright
  16. * notice, this list of conditions and the following disclaimer.
  17. * * Redistributions in binary form must reproduce the above copyright
  18. * notice, this list of conditions and the following disclaimer in the
  19. * documentation and/or other materials provided with the distribution.
  20. * * Neither the name of the <organization> nor the
  21. * names of its contributors may be used to endorse or promote products
  22. * derived from this software without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  25. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  26. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27. * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  28. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  29. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  30. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  31. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  32. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  33. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. */
  35. `default_nettype none
  36. module hdmi_phy_1x #(
  37. parameter integer DW = 4
  38. )(
  39. // HDMI pads
  40. output wire [DW-1:0] hdmi_data,
  41. output wire hdmi_hsync,
  42. output wire hdmi_vsync,
  43. output wire hdmi_de,
  44. output wire hdmi_clk,
  45. // Input from fabric
  46. input wire [DW-1:0] in_data,
  47. input wire in_hsync,
  48. input wire in_vsync,
  49. input wire in_de,
  50. // Clock
  51. input wire clk
  52. );
  53. // Data bits
  54. SB_IO #(
  55. .PIN_TYPE (6'b0101_11),
  56. .PULLUP (1'b0),
  57. .NEG_TRIGGER (1'b0),
  58. .IO_STANDARD ("SB_LVCMOS")
  59. ) iob_hdmi_data_I[DW-1:0] (
  60. .PACKAGE_PIN (hdmi_data),
  61. .OUTPUT_CLK (clk),
  62. .D_OUT_0 (in_data)
  63. );
  64. // H-Sync / V-Sync / DE
  65. SB_IO #(
  66. .PIN_TYPE (6'b0101_11),
  67. .PULLUP (1'b0),
  68. .NEG_TRIGGER (1'b0),
  69. .IO_STANDARD ("SB_LVCMOS")
  70. ) iob_hdmi_ctrl_I[2:0] (
  71. .PACKAGE_PIN ({hdmi_hsync, hdmi_vsync, hdmi_de}),
  72. .OUTPUT_CLK (clk),
  73. .D_OUT_0 ({in_hsync, in_vsync, in_de})
  74. );
  75. // Clock
  76. SB_IO #(
  77. .PIN_TYPE (6'b0100_11),
  78. .PULLUP (1'b0),
  79. .NEG_TRIGGER (1'b0),
  80. .IO_STANDARD ("SB_LVCMOS")
  81. ) iob_hdmi_clk_I (
  82. .PACKAGE_PIN (hdmi_clk),
  83. .OUTPUT_CLK (clk),
  84. .D_OUT_0 (1'b0),
  85. .D_OUT_1 (1'b1)
  86. );
  87. endmodule // hdmi_phy_1x