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.

152 lines
4.5 KiB

1 year ago
1 year ago
1 year ago
  1. // module internal_timecode_generator #(
  2. // parameter SYS_CLOCK_FREQ = 100000000
  3. // ) (
  4. // input clk, //clock input
  5. // input rst_n, //asynchronous reset input, low active
  6. // input ctrl_sig,
  7. // input [31:0] timecode_format,
  8. // input timecode_tc_wr_en,
  9. // input [31:0] timecode_tc_wr_data,
  10. // output reg [31:0] out_timecode_uc_reg,
  11. // input timecode_uc_wr_en,
  12. // input [31:0] timecode_uc_wr_data,
  13. // output reg [31:0] out_timecode_tc_reg,
  14. // output reg out_timecode_tirgger_sig
  15. // );
  16. // localparam FPS2398Format = 0;
  17. // localparam FPS2400Format = 1;
  18. // localparam FPS2500Format = 2;
  19. // localparam FPS2997Format = 3;
  20. // localparam FPS2997DropFormat = 4;
  21. // localparam FPS3000Format = 5;
  22. // /*******************************************************************************
  23. // * smpte_timecode_clk_generator *
  24. // *******************************************************************************/
  25. // wire timecode_sig_clk_output;
  26. // zutils_smpte_timecode_clk_generator #(
  27. // .SYS_CLOCK_FREQ(SYS_CLOCK_FREQ)
  28. // ) smpte_timecode_clk_generator (
  29. // .clk(clk),
  30. // .rst_n(rst_n),
  31. // .ctrl_sig(ctrl_sig),
  32. // .fps2398format_clk(fps2398format_clk),
  33. // .fps2400format_clk(fps2400format_clk),
  34. // .fps2500format_clk(fps2500format_clk),
  35. // .fps2997format_clk(fps2997format_clk),
  36. // .fps2997dropformat_clk(fps2997dropformat_clk),
  37. // .fps3000format_clk(fps3000format_clk)
  38. // );
  39. // zutils_multiplexer_32t1_v2 timecode_clk_output_mult (
  40. // .chooseindex(timecode_format),
  41. // //in
  42. // .in0(fps2398format_clk),
  43. // .in1(fps2400format_clk),
  44. // .in2(fps2500format_clk),
  45. // .in3(fps2997format_clk),
  46. // .in4(fps2997dropformat_clk),
  47. // .in5(fps3000format_clk),
  48. // //out
  49. // .out(timecode_sig_clk_output)
  50. // );
  51. // zutils_edge_detecter timecode_sig_clk_output_edge_detecter (
  52. // .clk(clk),
  53. // .rst_n(rst_n),
  54. // .in_signal(timecode_sig_clk_output),
  55. // .in_signal_rising_edge(timecode_sig_clk_output_rising_edge)
  56. // );
  57. // reg [7:0] frameNum;
  58. // reg timecode_drop_frame;
  59. // wire [31:0] timecode_next;
  60. // always @(*) begin
  61. // case (timecode_format)
  62. // FPS2398Format: begin
  63. // frameNum <= 24;
  64. // timecode_drop_frame <= 0;
  65. // end
  66. // FPS2400Format: begin
  67. // frameNum <= 24;
  68. // timecode_drop_frame <= 0;
  69. // end
  70. // FPS2500Format: begin
  71. // frameNum <= 25;
  72. // timecode_drop_frame <= 0;
  73. // end
  74. // FPS2997Format: begin
  75. // frameNum <= 30;
  76. // timecode_drop_frame <= 0;
  77. // end
  78. // FPS2997DropFormat: begin
  79. // frameNum <= 30;
  80. // timecode_drop_frame <= 0;
  81. // end
  82. // default begin
  83. // frameNum <= 30;
  84. // timecode_drop_frame <= 0;
  85. // end
  86. // endcase
  87. // end
  88. // ztutils_timecode_next_code ztutils_timecode_next_code_inst (
  89. // .timecode(out_timecode_tc_reg),
  90. // .frameNum(frameNum),
  91. // .drop(timecode_drop_frame),
  92. // .timecode_next(timecode_next)
  93. // );
  94. // reg n_first_timecode_sig;
  95. // always @(posedge clk or negedge rst_n) begin
  96. // if (!rst_n || !ctrl_sig) begin
  97. // n_first_timecode_sig <= 0;
  98. // end else begin
  99. // if (!n_first_timecode_sig && timecode_sig_clk_output_rising_edge) begin
  100. // n_first_timecode_sig <= 1;
  101. // end
  102. // end
  103. // end
  104. // // always @(posedge clk or negedge rst_n) begin
  105. // // if (!rst_n) begin
  106. // // out_timecode_tc_reg <= 0;
  107. // // out_timecode_uc_reg <= 0;
  108. // // end else begin
  109. // // if (timecode_tc_wr_en) begin
  110. // // //外都写入时间码
  111. // // out_timecode_tc_reg <= timecode_tc_wr_data;
  112. // // end else if (timecode_uc_wr_en) begin
  113. // // //外都写入时间码-用户码
  114. // // out_timecode_uc_reg <= timecode_uc_wr_data;
  115. // // end else begin
  116. // // if (timecode_sig_clk_output_rising_edge) begin
  117. // // //第一次触发不改变时间码
  118. // // if (!n_first_timecode_sig) begin
  119. // // out_timecode_tc_reg <= out_timecode_tc_reg;
  120. // // end else begin
  121. // // out_timecode_tc_reg <= timecode_next;
  122. // // end
  123. // // out_timecode_tirgger_sig <= 1;
  124. // // end else begin
  125. // // out_timecode_tirgger_sig <= 0;
  126. // // end
  127. // // end
  128. // // end
  129. // // end
  130. // endmodule