|
|
// module internal_timecode_generator #( // parameter SYS_CLOCK_FREQ = 100000000 // ) ( // input clk, //clock input // input rst_n, //asynchronous reset input, low active
// input ctrl_sig,
// input [31:0] timecode_format,
// input timecode_tc_wr_en, // input [31:0] timecode_tc_wr_data, // output reg [31:0] out_timecode_uc_reg,
// input timecode_uc_wr_en, // input [31:0] timecode_uc_wr_data, // output reg [31:0] out_timecode_tc_reg,
// output reg out_timecode_tirgger_sig // );
// localparam FPS2398Format = 0; // localparam FPS2400Format = 1; // localparam FPS2500Format = 2; // localparam FPS2997Format = 3; // localparam FPS2997DropFormat = 4; // localparam FPS3000Format = 5;
// /******************************************************************************* // * smpte_timecode_clk_generator * // *******************************************************************************/
// wire timecode_sig_clk_output; // zutils_smpte_timecode_clk_generator #( // .SYS_CLOCK_FREQ(SYS_CLOCK_FREQ) // ) smpte_timecode_clk_generator ( // .clk(clk), // .rst_n(rst_n), // .ctrl_sig(ctrl_sig), // .fps2398format_clk(fps2398format_clk), // .fps2400format_clk(fps2400format_clk), // .fps2500format_clk(fps2500format_clk), // .fps2997format_clk(fps2997format_clk), // .fps2997dropformat_clk(fps2997dropformat_clk), // .fps3000format_clk(fps3000format_clk) // );
// zutils_multiplexer_32t1_v2 timecode_clk_output_mult ( // .chooseindex(timecode_format), // //in // .in0(fps2398format_clk), // .in1(fps2400format_clk), // .in2(fps2500format_clk), // .in3(fps2997format_clk), // .in4(fps2997dropformat_clk), // .in5(fps3000format_clk), // //out // .out(timecode_sig_clk_output) // );
// zutils_edge_detecter timecode_sig_clk_output_edge_detecter ( // .clk(clk), // .rst_n(rst_n), // .in_signal(timecode_sig_clk_output), // .in_signal_rising_edge(timecode_sig_clk_output_rising_edge) // );
// reg [7:0] frameNum; // reg timecode_drop_frame; // wire [31:0] timecode_next;
// always @(*) begin
// case (timecode_format) // FPS2398Format: begin // frameNum <= 24; // timecode_drop_frame <= 0; // end // FPS2400Format: begin // frameNum <= 24; // timecode_drop_frame <= 0; // end // FPS2500Format: begin // frameNum <= 25; // timecode_drop_frame <= 0; // end // FPS2997Format: begin // frameNum <= 30; // timecode_drop_frame <= 0; // end // FPS2997DropFormat: begin // frameNum <= 30; // timecode_drop_frame <= 0; // end // default begin // frameNum <= 30; // timecode_drop_frame <= 0; // end // endcase // end
// ztutils_timecode_next_code ztutils_timecode_next_code_inst ( // .timecode(out_timecode_tc_reg), // .frameNum(frameNum), // .drop(timecode_drop_frame), // .timecode_next(timecode_next) // );
// reg n_first_timecode_sig;
// always @(posedge clk or negedge rst_n) begin // if (!rst_n || !ctrl_sig) begin // n_first_timecode_sig <= 0; // end else begin // if (!n_first_timecode_sig && timecode_sig_clk_output_rising_edge) begin // n_first_timecode_sig <= 1; // end // end // end
// // always @(posedge clk or negedge rst_n) begin // // if (!rst_n) begin // // out_timecode_tc_reg <= 0; // // out_timecode_uc_reg <= 0; // // end else begin
// // if (timecode_tc_wr_en) begin // // //外都写入时间码 // // out_timecode_tc_reg <= timecode_tc_wr_data; // // end else if (timecode_uc_wr_en) begin // // //外都写入时间码-用户码 // // out_timecode_uc_reg <= timecode_uc_wr_data; // // end else begin
// // if (timecode_sig_clk_output_rising_edge) begin // // //第一次触发,不改变时间码 // // if (!n_first_timecode_sig) begin // // out_timecode_tc_reg <= out_timecode_tc_reg; // // end else begin // // out_timecode_tc_reg <= timecode_next; // // end // // out_timecode_tirgger_sig <= 1; // // end else begin // // out_timecode_tirgger_sig <= 0; // // end // // end // // end // // end
// endmodule
|