forked from p_lusterinc_xsync/xsync_fpge
4 changed files with 132 additions and 352 deletions
-
22led_test.pds
-
152source/bak/internal_timecode_generator.v
-
163source/src/input/timecode_input.v
-
147source/src/zutils/zutils_timecode_serial_data_gen.v
@ -1,152 +0,0 @@ |
|||
|
|||
// module internal_timecode_generator #( |
|||
// parameter SYS_CLOCK_FREQ = 10000000 |
|||
// ) ( |
|||
// 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 |
@ -1,147 +0,0 @@ |
|||
|
|||
// module internal_timecode_generator #( |
|||
// parameter SYS_CLOCK_FREQ = 10000000 |
|||
// ) ( |
|||
// input clk, //clock input |
|||
// input rst_n, //asynchronous reset input, low active |
|||
|
|||
// input [31:0] timecode_format, |
|||
|
|||
|
|||
// input trigger_sig, |
|||
// input [31:0] timecode_tc_data, |
|||
// input [31:0] timecode_uc_data, |
|||
|
|||
// output reg out_timecode_serial_data, |
|||
// output reg out_trigger_sig, |
|||
// output reg [31:0] out_timecode_tc_data, |
|||
// output reg [31:0] out_timecode_uc_data |
|||
// ); |
|||
|
|||
// // Rate 1/2Fe 1Fe |
|||
// // 23.98 F/s 260.7 us 521.4 us |
|||
// // 24.00 F/s 260.4 us 520.8 us |
|||
// // 25.00 F/s 250.0 us 500.0 us |
|||
// // 29.97 F/s 208.5 us 417.1 us |
|||
// // 30.00 F/s 208.3 us 416.7 us |
|||
|
|||
// localparam FPS2398Format = 0; |
|||
// localparam FPS2400Format = 1; |
|||
// localparam FPS2500Format = 2; |
|||
// localparam FPS2997Format = 3; |
|||
// localparam FPS2997DropFormat = 4; |
|||
// localparam FPS3000Format = 5; |
|||
|
|||
// localparam FPS2398FormatOneHalfFe = (260.7 * 1000) / (1000000000 / SYS_CLOCK_FREQ); |
|||
// localparam FPS2400FormatOneHalfFe = (260.4 * 1000) / (1000000000 / SYS_CLOCK_FREQ); |
|||
// localparam FPS2500FormatOneHalfFe = (250.0 * 1000) / (1000000000 / SYS_CLOCK_FREQ); |
|||
// localparam FPS2997FormatOneHalfFe = (208.5 * 1000) / (1000000000 / SYS_CLOCK_FREQ); |
|||
// localparam FPS2997DropFormatOneHalfFe = (208.5 * 1000) / (1000000000 / SYS_CLOCK_FREQ); |
|||
// localparam FPS3000FormatOneHalfFe = (208.3 * 1000) / (1000000000 / SYS_CLOCK_FREQ); |
|||
|
|||
// reg [31:0] timecode_onehalf_bit_count; |
|||
// always @(*) begin |
|||
// case (freqtimecode_format) |
|||
// FPS2398Format: timecode_onehalf_bit_count = FPS2398FormatOneHalfFe; |
|||
// FPS2400Format: timecode_onehalf_bit_count = FPS2400FormatOneHalfFe; |
|||
// FPS2500Format: timecode_onehalf_bit_count = FPS2500FormatOneHalfFe; |
|||
// FPS2997Format: timecode_onehalf_bit_count = FPS2997FormatOneHalfFe; |
|||
// FPS2997DropFormat: timecode_onehalf_bit_count = FPS2997DropFormatOneHalfFe; |
|||
// FPS3000Format: timecode_onehalf_bit_count = FPS3000FormatOneHalfFe; |
|||
// default: timecode_onehalf_bit_count = FPS2398FormatOneHalfFe; |
|||
// endcase |
|||
// end |
|||
|
|||
// /******************************************************************************* |
|||
// * workflag * |
|||
// *******************************************************************************/ |
|||
// reg workflag; |
|||
// reg endsig; |
|||
// // |
|||
// // |
|||
// reg [31:0] timecode_tc_cache; |
|||
// reg [31:0] timecode_uc_cache; |
|||
// reg [64:0] timecode_bit_val; |
|||
// always @(posedge clk or negedge rst_n) begin |
|||
// if (!rst_n) begin |
|||
// workflag <= 0; |
|||
// timecode_tc_cache <= 0; |
|||
// timecode_uc_cache <= 0; |
|||
// end else begin |
|||
// if (trigger_sig) begin |
|||
// timecode_tc_cache <= timecode_tc_data; |
|||
// timecode_uc_cache <= timecode_uc_data; |
|||
|
|||
|
|||
|
|||
// workflag <= 1; |
|||
// end else if (workflag && endsig) begin |
|||
// workflag <= 0; |
|||
// end |
|||
// end |
|||
// end |
|||
|
|||
// /******************************************************************************* |
|||
// * tigger_sig * |
|||
// *******************************************************************************/ |
|||
// reg [31:0] halfbitcount; |
|||
// reg tigger_sig; |
|||
// always @(posedge clk or negedge rst_n) begin |
|||
// if (!rst_n || !workflag) begin |
|||
// halfbitcount <= 0; |
|||
// tigger_sig <= 0; |
|||
// end else begin |
|||
// if (halfbitcount == timecode_onehalf_bit_count) begin |
|||
// halfbitcount <= 0; |
|||
// end else begin |
|||
// halfbitcount <= halfbitcount + 1; |
|||
// end |
|||
|
|||
// if (halfbitcount == 0) begin |
|||
// tigger_sig <= 1; |
|||
// end else begin |
|||
// tigger_sig <= 0; |
|||
// end |
|||
// end |
|||
// end |
|||
|
|||
// // |
|||
// // trigger : | | | | | | |
|||
// // onebitoff: 0000000001111111111000000001111111110000000001 |
|||
// // bitoff : 0000000000000000000111111111111111112222222222 |
|||
// // |
|||
// // |
|||
|
|||
// reg [ 1:0] onebitoff; |
|||
// reg [31:0] bitoff; |
|||
// always @(posedge clk or negedge rst_n) begin |
|||
// if (!rst_n || !workflag) begin |
|||
// onebitoff <= 1; |
|||
// bitoff <= 0; |
|||
// end else begin |
|||
// if (tigger_sig) begin |
|||
// if (onebit_off == 1) begin |
|||
// bitoff <= bitoff + 1; |
|||
// onebit_off <= 0; |
|||
// end else begin |
|||
// onebit_off <= 1; |
|||
// end |
|||
// end |
|||
// end |
|||
// end |
|||
|
|||
|
|||
|
|||
|
|||
// reg change_sig; |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
// endmodule |
Write
Preview
Loading…
Cancel
Save
Reference in new issue