hdmi_buf.v 785 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * hdmi_buf.v
  3. *
  4. * vim: ts=4 sw=4
  5. *
  6. * Copyright (C) 2020-2021 Sylvain Munaut <tnt@246tNt.com>
  7. * SPDX-License-Identifier: CERN-OHL-P-2.0
  8. */
  9. `default_nettype none
  10. module hdmi_buf (
  11. // Write port
  12. input wire [ 8:0] waddr,
  13. input wire [31:0] wdata,
  14. input wire wren,
  15. // Read port
  16. input wire [ 9:0] raddr,
  17. output wire [15:0] rdata,
  18. // Clock
  19. input wire clk
  20. );
  21. genvar i;
  22. generate
  23. for (i=0; i<4; i=i+1)
  24. ice40_ebr #(
  25. .READ_MODE (2), // 1024x4
  26. .WRITE_MODE (1) // 512x8
  27. ) ebr_wrap_I (
  28. .wr_addr (waddr),
  29. .wr_data ({wdata[i*4+:4], wdata[16+i*4+:4]}),
  30. .wr_mask (8'h00),
  31. .wr_ena (wren),
  32. .wr_clk (clk),
  33. .rd_addr (raddr),
  34. .rd_data (rdata[i*4+:4]),
  35. .rd_ena (1'b1),
  36. .rd_clk (clk)
  37. );
  38. endgenerate
  39. endmodule