OpenCores
URL https://opencores.org/ocsvn/spacewiresystemc/spacewiresystemc/trunk

Subversion Repositories spacewiresystemc

[/] [spacewiresystemc/] [trunk/] [rtl/] [RTL_VB/] [tx_spw.v] - Diff between revs 38 and 39

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 38 Rev 39
Line 62... Line 62...
                 tx_spw_null               = 7'b0000001,
                 tx_spw_null               = 7'b0000001,
                 tx_spw_fct                = 7'b0000010,
                 tx_spw_fct                = 7'b0000010,
                 tx_spw_null_c             = 7'b0000100,
                 tx_spw_null_c             = 7'b0000100,
                 tx_spw_fct_c              = 7'b0001000,
                 tx_spw_fct_c              = 7'b0001000,
                 tx_spw_data_c             = 7'b0010000,
                 tx_spw_data_c             = 7'b0010000,
                 tx_spw_time_code_c        = 7'b0100000;
                 tx_spw_data_c_0           = 7'b0100000,
 
                 tx_spw_time_code_c        = 7'b1000000;
 
 
localparam [5:0] NULL     = 6'b000001,
localparam [5:0] NULL     = 6'b000001,
                 FCT      = 6'b000010,
                 FCT      = 6'b000010,
                 EOP      = 6'b000100,
                 EOP      = 6'b000100,
                 EEP      = 6'b001000,
                 EEP      = 6'b001000,
Line 97... Line 98...
        reg [13:0] timecode_s;
        reg [13:0] timecode_s;
 
 
        reg [5:0]  last_type;
        reg [5:0]  last_type;
        reg [8:0]  txdata_flagctrl_tx_last;
        reg [8:0]  txdata_flagctrl_tx_last;
        reg [8:0]  tx_data_in;
        reg [8:0]  tx_data_in;
        reg [8:0]  tx_data_took;
        reg [8:0]  tx_data_in_0;
 
        reg process_data;
 
        reg process_data_0;
 
        reg last_process_data;
 
 
        reg [7:0]  last_timein_control_flag_tx;
        reg [7:0]  last_timein_control_flag_tx;
        reg [7:0]  tx_tcode_in;
        reg [7:0]  tx_tcode_in;
        reg tcode_rdy_trnsp;
        reg tcode_rdy_trnsp;
 
 
        reg [2:0] fct_send;
        reg [2:0] fct_send;
        reg [2:0] fct_flag;
        reg [2:0] fct_flag;
 
 
        reg [5:0] fct_counter_receive;
        reg [5:0] fct_counter_receive;
 
 
        reg data_ready_took;
 
        reg block_decrement;
        reg block_decrement;
        reg char_sent;
        reg char_sent;
 
 
        reg fct_sent;
        reg fct_sent;
 
 
Line 130... Line 132...
 
 
        reg [3:0] global_counter_transfer;
        reg [3:0] global_counter_transfer;
 
 
 
 
 
 
always@(*)
always@(posedge pclk_tx or negedge enable_tx)
 
begin
 
        if(!enable_tx)
 
        begin
 
                tx_dout <= 1'b0;
 
        end
 
        else
begin
begin
                tx_dout = last_tx_dout;
 
 
 
                case(state_tx)
                case(state_tx)
                tx_spw_start:
                tx_spw_start:
                begin
                begin
 
                        if(send_null_tx && enable_tx)
 
                        begin
 
                                tx_dout <= !(null_s[6]^null_s[0]^null_s[1]);
 
                        end
 
                        else
 
                        begin
 
                                tx_dout <= 1'b0;
 
                        end
                end
                end
                tx_spw_null,tx_spw_null_c:
                tx_spw_null,tx_spw_null_c:
                begin
                begin
                         if(last_type == NULL  && global_counter_transfer[3:0] == 4'd0)
                         if(last_type == NULL  && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(null_s[6]^null_s[0]^null_s[1]);
                                tx_dout <= !(null_s[6]^null_s[0]^null_s[1]);
                         end
                         end
                         else if(last_type == FCT  && global_counter_transfer[3:0] == 4'd0)
                         else if(last_type == FCT  && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(null_s[6]^fct_s[0]^fct_s[1]);
                                tx_dout <= !(null_s[6]^fct_s[0]^fct_s[1]);
                         end
                         end
                         else if(last_type == EOP  && global_counter_transfer[3:0] == 4'd0)
                         else if(last_type == EOP  && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(null_s[6]^eop_s[0]^eop_s[1]);
                                tx_dout <= !(null_s[6]^eop_s[0]^eop_s[1]);
                         end
                         end
                         else if(last_type == EEP  && global_counter_transfer[3:0] == 4'd0)
                         else if(last_type == EEP  && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(null_s[6]^eep_s[0]^eep_s[1]);
                                tx_dout <= !(null_s[6]^eep_s[0]^eep_s[1]);
                         end
                         end
                         else if(last_type == DATA  && global_counter_transfer[3:0] == 4'd0)
                         else if(last_type == DATA  && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout =  !(null_s[6]^txdata_flagctrl_tx_last[0]^txdata_flagctrl_tx_last[1]^txdata_flagctrl_tx_last[2]^txdata_flagctrl_tx_last[3]^ txdata_flagctrl_tx_last[4]^txdata_flagctrl_tx_last[5]^txdata_flagctrl_tx_last[6]^txdata_flagctrl_tx_last[7]);
                                tx_dout <=  !(null_s[6]^txdata_flagctrl_tx_last[0]^txdata_flagctrl_tx_last[1]^txdata_flagctrl_tx_last[2]^txdata_flagctrl_tx_last[3]^ txdata_flagctrl_tx_last[4]^txdata_flagctrl_tx_last[5]^txdata_flagctrl_tx_last[6]^txdata_flagctrl_tx_last[7]);
                         end
                         end
                         else if(last_type == TIMEC && global_counter_transfer[3:0] == 4'd0)
                         else if(last_type == TIMEC && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout =  !(null_s[6]^last_timein_control_flag_tx[7]^last_timein_control_flag_tx[6]^last_timein_control_flag_tx[5]^last_timein_control_flag_tx[4]^last_timein_control_flag_tx[3]^last_timein_control_flag_tx[2]^last_timein_control_flag_tx[1]^last_timein_control_flag_tx[0]);
                                tx_dout <=  !(null_s[6]^last_timein_control_flag_tx[7]^last_timein_control_flag_tx[6]^last_timein_control_flag_tx[5]^last_timein_control_flag_tx[4]^last_timein_control_flag_tx[3]^last_timein_control_flag_tx[2]^last_timein_control_flag_tx[1]^last_timein_control_flag_tx[0]);
                         end
                         end
                         else if(global_counter_transfer[3:0] == 4'd1)
                         else if(global_counter_transfer[3:0] == 4'd1)
                         begin
                         begin
                                tx_dout = null_s[6];
                                tx_dout <= null_s[6];
                         end
                         end
                         else if(global_counter_transfer[3:0] == 4'd2)
                         else if(global_counter_transfer[3:0] == 4'd2)
                         begin
                         begin
                                tx_dout = null_s[5];
                                tx_dout <= null_s[5];
                         end
                         end
                         else if(global_counter_transfer[3:0] == 4'd3)
                         else if(global_counter_transfer[3:0] == 4'd3)
                         begin
                         begin
                                tx_dout = null_s[4];
                                tx_dout <= null_s[4];
                         end
                         end
                         else if(global_counter_transfer[3:0] == 4'd4)
                         else if(global_counter_transfer[3:0] == 4'd4)
                         begin
                         begin
                                tx_dout = null_s[3];
                                tx_dout <= null_s[3];
                         end
                         end
                         else if(global_counter_transfer[3:0] == 4'd5)
                         else if(global_counter_transfer[3:0] == 4'd5)
                         begin
                         begin
                                tx_dout = null_s[2];
                                tx_dout <= null_s[2];
                         end
                         end
                         else if(global_counter_transfer[3:0] == 4'd6)
                         else if(global_counter_transfer[3:0] == 4'd6)
                         begin
                         begin
                                tx_dout = null_s[1];
                                tx_dout <= null_s[1];
                         end
                         end
                         else if(global_counter_transfer[3:0] == 4'd7)
                         else if(global_counter_transfer[3:0] == 4'd7)
                         begin
                         begin
                                tx_dout = null_s[0];
                                tx_dout <= null_s[0];
                         end
                         end
                end
                end
                tx_spw_fct,tx_spw_fct_c:
                tx_spw_fct,tx_spw_fct_c:
                begin
                begin
                         if(last_type == NULL  && global_counter_transfer[3:0] == 4'd0)
                         if(last_type == NULL  && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(fct_s[2]^null_s[0]^null_s[1]);
                                tx_dout <= !(fct_s[2]^null_s[0]^null_s[1]);
                         end
                         end
                         else if(last_type == FCT  && global_counter_transfer[3:0] == 4'd0)
                         else if(last_type == FCT  && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(fct_s[2]^fct_s[0]^fct_s[1]);
                                tx_dout <= !(fct_s[2]^fct_s[0]^fct_s[1]);
                         end
                         end
                         else if(last_type == EOP  && global_counter_transfer[3:0] == 4'd0)
                         else if(last_type == EOP  && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(fct_s[2]^eop_s[0]^eop_s[1]);
                                tx_dout <= !(fct_s[2]^eop_s[0]^eop_s[1]);
                         end
                         end
                         else if(last_type == EEP  && global_counter_transfer[3:0] == 4'd0)
                         else if(last_type == EEP  && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(fct_s[2]^eep_s[0]^eep_s[1]);
                                tx_dout <= !(fct_s[2]^eep_s[0]^eep_s[1]);
                         end
                         end
                         else if (last_type == DATA && global_counter_transfer[3:0] == 4'd0)
                         else if (last_type == DATA && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(fct_s[2]^txdata_flagctrl_tx_last[0]^txdata_flagctrl_tx_last[1]^txdata_flagctrl_tx_last[2]^txdata_flagctrl_tx_last[3]^ txdata_flagctrl_tx_last[4]^txdata_flagctrl_tx_last[5]^txdata_flagctrl_tx_last[6]^txdata_flagctrl_tx_last[7]);
                                tx_dout <= !(fct_s[2]^txdata_flagctrl_tx_last[0]^txdata_flagctrl_tx_last[1]^txdata_flagctrl_tx_last[2]^txdata_flagctrl_tx_last[3]^ txdata_flagctrl_tx_last[4]^txdata_flagctrl_tx_last[5]^txdata_flagctrl_tx_last[6]^txdata_flagctrl_tx_last[7]);
                         end
                         end
                         else if(last_type == TIMEC && global_counter_transfer[3:0] == 4'd0)
                         else if(last_type == TIMEC && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(fct_s[2]^last_timein_control_flag_tx[7]^last_timein_control_flag_tx[6]^last_timein_control_flag_tx[5]^last_timein_control_flag_tx[4]^last_timein_control_flag_tx[3]^last_timein_control_flag_tx[2]^last_timein_control_flag_tx[1]^last_timein_control_flag_tx[0]);
                                tx_dout <= !(fct_s[2]^last_timein_control_flag_tx[7]^last_timein_control_flag_tx[6]^last_timein_control_flag_tx[5]^last_timein_control_flag_tx[4]^last_timein_control_flag_tx[3]^last_timein_control_flag_tx[2]^last_timein_control_flag_tx[1]^last_timein_control_flag_tx[0]);
                         end
                         end
                         else if(global_counter_transfer[3:0] == 4'd1)
                         else if(global_counter_transfer[3:0] == 4'd1)
                         begin
                         begin
                                tx_dout = fct_s[2];
                                tx_dout <= fct_s[2];
                         end
                         end
                         else if(global_counter_transfer[3:0] == 4'd2)
                         else if(global_counter_transfer[3:0] == 4'd2)
                         begin
                         begin
                                tx_dout = fct_s[1];
                                tx_dout <= fct_s[1];
                         end
                         end
                         else if(global_counter_transfer[3:0] == 4'd3)
                         else if(global_counter_transfer[3:0] == 4'd3)
                         begin
                         begin
                                tx_dout = fct_s[0];
                                tx_dout <= fct_s[0];
                         end
                         end
                end
                end
                tx_spw_data_c:
                tx_spw_data_c:
                begin
                begin
                        if(!tx_data_in[8] && last_type == NULL  && global_counter_transfer[3:0] == 4'd0)
                        if(!tx_data_in[8] && last_type == NULL  && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(tx_data_in[8]^null_s[0]^null_s[1]);
                                tx_dout <= !(tx_data_in[8]^null_s[0]^null_s[1]);
                         end
                         end
                         else if(!tx_data_in[8] && last_type == FCT && global_counter_transfer[3:0] == 4'd0)
                         else if(!tx_data_in[8] && last_type == FCT && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(tx_data_in[8]^fct_s[0]^fct_s[1]);
                                tx_dout <= !(tx_data_in[8]^fct_s[0]^fct_s[1]);
                         end
                         end
                         else if(!tx_data_in[8] && last_type == EOP  && global_counter_transfer[3:0] == 4'd0)
                         else if(!tx_data_in[8] && last_type == EOP  && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(tx_data_in[8]^eop_s[0]^eop_s[1]);
                                tx_dout <= !(tx_data_in[8]^eop_s[0]^eop_s[1]);
                         end
                         end
                         else if(!tx_data_in[8] && last_type == EEP  && global_counter_transfer[3:0] == 4'd0)
                         else if(!tx_data_in[8] && last_type == EEP  && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(tx_data_in[8]^eep_s[0]^eep_s[1]);
                                tx_dout <= !(tx_data_in[8]^eep_s[0]^eep_s[1]);
                         end
                         end
                         else if(!tx_data_in[8] && last_type == DATA  && global_counter_transfer[3:0] == 4'd0)
                         else if(!tx_data_in[8] && last_type == DATA  && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(tx_data_in[8]^txdata_flagctrl_tx_last[0]^txdata_flagctrl_tx_last[1]^txdata_flagctrl_tx_last[2]^txdata_flagctrl_tx_last[3]^ txdata_flagctrl_tx_last[4]^txdata_flagctrl_tx_last[5]^txdata_flagctrl_tx_last[6]^txdata_flagctrl_tx_last[7]);
                                tx_dout <= !(tx_data_in[8]^txdata_flagctrl_tx_last[0]^txdata_flagctrl_tx_last[1]^txdata_flagctrl_tx_last[2]^txdata_flagctrl_tx_last[3]^ txdata_flagctrl_tx_last[4]^txdata_flagctrl_tx_last[5]^txdata_flagctrl_tx_last[6]^txdata_flagctrl_tx_last[7]);
                         end
                         end
                         else if(!tx_data_in[8] && last_type == TIMEC && global_counter_transfer[3:0] == 4'd0)
                         else if(!tx_data_in[8] && last_type == TIMEC && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(tx_data_in[8]^last_timein_control_flag_tx[7]^last_timein_control_flag_tx[6]^last_timein_control_flag_tx[5]^last_timein_control_flag_tx[4]^last_timein_control_flag_tx[3]^last_timein_control_flag_tx[2]^last_timein_control_flag_tx[1]^last_timein_control_flag_tx[0]);
                                tx_dout <= !(tx_data_in[8]^last_timein_control_flag_tx[7]^last_timein_control_flag_tx[6]^last_timein_control_flag_tx[5]^last_timein_control_flag_tx[4]^last_timein_control_flag_tx[3]^last_timein_control_flag_tx[2]^last_timein_control_flag_tx[1]^last_timein_control_flag_tx[0]);
                         end
                         end
                         else if(tx_data_in[8]  && tx_data_in[1:0] == 2'b00 && last_type == NULL  && global_counter_transfer[3:0] == 4'd0)
                         else if(tx_data_in[8]  && tx_data_in[1:0] == 2'b00 && last_type == NULL  && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(eop_s[2]^null_s[0]^null_s[1]);
                                tx_dout <= !(eop_s[2]^null_s[0]^null_s[1]);
                         end
                         end
                         else if(tx_data_in[8] && tx_data_in[1:0] == 2'b00 && last_type == FCT   && global_counter_transfer[3:0] == 4'd0)
                         else if(tx_data_in[8] && tx_data_in[1:0] == 2'b00 && last_type == FCT   && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(eop_s[2]^fct_s[0]^fct_s[1]);
                                tx_dout <= !(eop_s[2]^fct_s[0]^fct_s[1]);
                         end
                         end
                         else if(tx_data_in[8] && tx_data_in[1:0] == 2'b00 && last_type == EOP  && global_counter_transfer[3:0] == 4'd0)
                         else if(tx_data_in[8] && tx_data_in[1:0] == 2'b00 && last_type == EOP  && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(eop_s[2]^eop_s[0]^eop_s[1]);
                                tx_dout <= !(eop_s[2]^eop_s[0]^eop_s[1]);
                         end
                         end
                         else if(tx_data_in[8] && tx_data_in[1:0] == 2'b00 && last_type == EEP  && global_counter_transfer[3:0] == 4'd0)
                         else if(tx_data_in[8] && tx_data_in[1:0] == 2'b00 && last_type == EEP  && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(eop_s[2]^eep_s[0]^eep_s[1]);
                                tx_dout <= !(eop_s[2]^eep_s[0]^eep_s[1]);
                         end
                         end
                         else if(tx_data_in[8]  && tx_data_in[1:0] == 2'b00 && last_type == DATA  && global_counter_transfer[3:0] == 4'd0)
                         else if(tx_data_in[8]  && tx_data_in[1:0] == 2'b00 && last_type == DATA  && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(eop_s[2]^txdata_flagctrl_tx_last[0]^txdata_flagctrl_tx_last[1]^txdata_flagctrl_tx_last[2]^txdata_flagctrl_tx_last[3]^ txdata_flagctrl_tx_last[4]^txdata_flagctrl_tx_last[5]^txdata_flagctrl_tx_last[6]^txdata_flagctrl_tx_last[7]);
                                tx_dout <= !(eop_s[2]^txdata_flagctrl_tx_last[0]^txdata_flagctrl_tx_last[1]^txdata_flagctrl_tx_last[2]^txdata_flagctrl_tx_last[3]^ txdata_flagctrl_tx_last[4]^txdata_flagctrl_tx_last[5]^txdata_flagctrl_tx_last[6]^txdata_flagctrl_tx_last[7]);
                         end
                         end
                         else if(tx_data_in[8]  && tx_data_in[1:0] == 2'b00 && last_type == TIMEC && global_counter_transfer[3:0] == 4'd0)
                         else if(tx_data_in[8]  && tx_data_in[1:0] == 2'b00 && last_type == TIMEC && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(eop_s[2]^last_timein_control_flag_tx[7]^last_timein_control_flag_tx[6]^last_timein_control_flag_tx[5]^last_timein_control_flag_tx[4]^last_timein_control_flag_tx[3]^last_timein_control_flag_tx[2]^last_timein_control_flag_tx[1]^last_timein_control_flag_tx[0]);
                                tx_dout <= !(eop_s[2]^last_timein_control_flag_tx[7]^last_timein_control_flag_tx[6]^last_timein_control_flag_tx[5]^last_timein_control_flag_tx[4]^last_timein_control_flag_tx[3]^last_timein_control_flag_tx[2]^last_timein_control_flag_tx[1]^last_timein_control_flag_tx[0]);
                         end
                         end
                         else if(tx_data_in[8] && tx_data_in[1:0] == 2'b01 && last_type == NULL  && global_counter_transfer[3:0] == 4'd0)
                         else if(tx_data_in[8] && tx_data_in[1:0] == 2'b01 && last_type == NULL  && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(eep_s[2]^null_s[0]^null_s[1]);
                                tx_dout <= !(eep_s[2]^null_s[0]^null_s[1]);
                         end
                         end
                         else if(tx_data_in[8] && tx_data_in[1:0] == 2'b01 && last_type == FCT  && global_counter_transfer[3:0] == 4'd0)
                         else if(tx_data_in[8] && tx_data_in[1:0] == 2'b01 && last_type == FCT  && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(eep_s[2]^fct_s[0]^fct_s[1]);
                                tx_dout <= !(eep_s[2]^fct_s[0]^fct_s[1]);
                         end
                         end
                         else if(tx_data_in[8] && tx_data_in[1:0] == 2'b01 && last_type == EOP  && global_counter_transfer[3:0] == 4'd0)
                         else if(tx_data_in[8] && tx_data_in[1:0] == 2'b01 && last_type == EOP  && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(eep_s[2]^eop_s[0]^eop_s[1]);
                                tx_dout <= !(eep_s[2]^eop_s[0]^eop_s[1]);
                         end
                         end
                         else if(tx_data_in[8] && tx_data_in[1:0] == 2'b01 && last_type == EEP && global_counter_transfer[3:0] == 4'd0)
                         else if(tx_data_in[8] && tx_data_in[1:0] == 2'b01 && last_type == EEP && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(eep_s[2]^eep_s[0]^eep_s[1]);
                                tx_dout <= !(eep_s[2]^eep_s[0]^eep_s[1]);
                         end
                         end
                         else if(tx_data_in[8]  && tx_data_in[1:0] == 2'b01 && last_type == DATA && global_counter_transfer[3:0] == 4'd0)
                         else if(tx_data_in[8]  && tx_data_in[1:0] == 2'b01 && last_type == DATA && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(eep_s[2]^txdata_flagctrl_tx_last[0]^txdata_flagctrl_tx_last[1]^txdata_flagctrl_tx_last[2]^txdata_flagctrl_tx_last[3]^ txdata_flagctrl_tx_last[4]^txdata_flagctrl_tx_last[5]^txdata_flagctrl_tx_last[6]^txdata_flagctrl_tx_last[7]);
                                tx_dout <= !(eep_s[2]^txdata_flagctrl_tx_last[0]^txdata_flagctrl_tx_last[1]^txdata_flagctrl_tx_last[2]^txdata_flagctrl_tx_last[3]^ txdata_flagctrl_tx_last[4]^txdata_flagctrl_tx_last[5]^txdata_flagctrl_tx_last[6]^txdata_flagctrl_tx_last[7]);
                         end
                         end
                         else if(tx_data_in[8]  &&  tx_data_in[1:0] == 2'b01 && last_type == TIMEC && global_counter_transfer[3:0] == 4'd0)
                         else if(tx_data_in[8]  &&  tx_data_in[1:0] == 2'b01 && last_type == TIMEC && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(eep_s[2]^last_timein_control_flag_tx[7]^last_timein_control_flag_tx[6]^last_timein_control_flag_tx[5]^last_timein_control_flag_tx[4]^last_timein_control_flag_tx[3]^last_timein_control_flag_tx[2]^last_timein_control_flag_tx[1]^last_timein_control_flag_tx[0]);
                                tx_dout <= !(eep_s[2]^last_timein_control_flag_tx[7]^last_timein_control_flag_tx[6]^last_timein_control_flag_tx[5]^last_timein_control_flag_tx[4]^last_timein_control_flag_tx[3]^last_timein_control_flag_tx[2]^last_timein_control_flag_tx[1]^last_timein_control_flag_tx[0]);
                         end
                         end
                         else if(!tx_data_in[8] &&  global_counter_transfer[3:0] == 4'd1)
                         else if(!tx_data_in[8] &&  global_counter_transfer[3:0] == 4'd1)
                         begin
                         begin
                                tx_dout = tx_data_in[8];
                                tx_dout <= tx_data_in[8];
                         end
                         end
                         else if(!tx_data_in[8] && global_counter_transfer[3:0] == 4'd2)
                         else if(!tx_data_in[8] && global_counter_transfer[3:0] == 4'd2)
                         begin
                         begin
                                tx_dout = tx_data_in[0];
                                tx_dout <= tx_data_in[0];
                         end
                         end
                         else if(!tx_data_in[8] &&  global_counter_transfer[3:0] == 4'd3)
                         else if(!tx_data_in[8] &&  global_counter_transfer[3:0] == 4'd3)
                         begin
                         begin
                                tx_dout = tx_data_in[1];
                                tx_dout <= tx_data_in[1];
                         end
                         end
                         else if(!tx_data_in[8] && global_counter_transfer[3:0] == 4'd4)
                         else if(!tx_data_in[8] && global_counter_transfer[3:0] == 4'd4)
                         begin
                         begin
                                tx_dout = tx_data_in[2];
                                tx_dout <= tx_data_in[2];
                         end
                         end
                         else if(!tx_data_in[8]  && global_counter_transfer[3:0] == 4'd5)
                         else if(!tx_data_in[8]  && global_counter_transfer[3:0] == 4'd5)
                         begin
                         begin
                                tx_dout = tx_data_in[3];
                                tx_dout <= tx_data_in[3];
                         end
                         end
                         else if(!tx_data_in[8]  && global_counter_transfer[3:0] == 4'd6)
                         else if(!tx_data_in[8]  && global_counter_transfer[3:0] == 4'd6)
                         begin
                         begin
                                tx_dout = tx_data_in[4];
                                tx_dout <= tx_data_in[4];
                         end
                         end
                         else if(!tx_data_in[8]  && global_counter_transfer[3:0] == 4'd7)
                         else if(!tx_data_in[8]  && global_counter_transfer[3:0] == 4'd7)
                         begin
                         begin
                                tx_dout = tx_data_in[5];
                                tx_dout <= tx_data_in[5];
                         end
                         end
                         else if(!tx_data_in[8] &&  global_counter_transfer[3:0] == 4'd8)
                         else if(!tx_data_in[8] &&  global_counter_transfer[3:0] == 4'd8)
                         begin
                         begin
                                tx_dout = tx_data_in[6];
                                tx_dout <= tx_data_in[6];
                         end
                         end
                         else if(!tx_data_in[8] &&  global_counter_transfer[3:0] == 4'd9)
                         else if(!tx_data_in[8] &&  global_counter_transfer[3:0] == 4'd9)
                         begin
                         begin
                                tx_dout = tx_data_in[7];
                                tx_dout <= tx_data_in[7];
                         end
                         end
                         else if(tx_data_in[8] && tx_data_in[1:0] == 2'b01 && global_counter_transfer[3:0] == 4'd1)
                         else if(tx_data_in[8] && tx_data_in[1:0] == 2'b01 && global_counter_transfer[3:0] == 4'd1)
                         begin
                         begin
                                tx_dout = eep_s[2];
                                tx_dout <= eep_s[2];
                         end
                         end
                         else if( tx_data_in[8] && tx_data_in[1:0] == 2'b01 && global_counter_transfer[3:0] == 4'd2)
                         else if( tx_data_in[8] && tx_data_in[1:0] == 2'b01 && global_counter_transfer[3:0] == 4'd2)
                         begin
                         begin
                                tx_dout = eep_s[1];
                                tx_dout <= eep_s[1];
                         end
                         end
                         else if(tx_data_in[8] && tx_data_in[1:0] == 2'b01 && global_counter_transfer[3:0] == 4'd3)
                         else if(tx_data_in[8] && tx_data_in[1:0] == 2'b01 && global_counter_transfer[3:0] == 4'd3)
                         begin
                         begin
                                tx_dout = eep_s[0];
                                tx_dout <= eep_s[0];
                         end
                         end
                         else if(tx_data_in[8] && tx_data_in[1:0] == 2'b00 && global_counter_transfer[3:0] == 4'd1)
                         else if(tx_data_in[8] && tx_data_in[1:0] == 2'b00 && global_counter_transfer[3:0] == 4'd1)
                         begin
                         begin
                                tx_dout = eop_s[2];
                                tx_dout <= eop_s[2];
                         end
                         end
                         else if(tx_data_in[8] && tx_data_in[1:0] == 2'b00 && global_counter_transfer[3:0] == 4'd2)
                         else if(tx_data_in[8] && tx_data_in[1:0] == 2'b00 && global_counter_transfer[3:0] == 4'd2)
                         begin
                         begin
                                tx_dout = eop_s[1];
                                tx_dout <= eop_s[1];
                         end
                         end
                         else if(tx_data_in[8] && tx_data_in[1:0] == 2'b00 && global_counter_transfer[3:0] == 4'd3)
                         else if(tx_data_in[8] && tx_data_in[1:0] == 2'b00 && global_counter_transfer[3:0] == 4'd3)
                         begin
                         begin
                                tx_dout = eop_s[0];
                                tx_dout <= eop_s[0];
 
                         end
 
                end
 
                tx_spw_data_c_0:
 
                begin
 
                        if(!tx_data_in_0[8] && last_type == NULL  && global_counter_transfer[3:0] == 4'd0)
 
                         begin
 
                                tx_dout <= !(tx_data_in_0[8]^null_s[0]^null_s[1]);
 
                         end
 
                         else if(!tx_data_in_0[8] && last_type == FCT && global_counter_transfer[3:0] == 4'd0)
 
                         begin
 
                                tx_dout <= !(tx_data_in_0[8]^fct_s[0]^fct_s[1]);
 
                         end
 
                         else if(!tx_data_in_0[8] && last_type == EOP  && global_counter_transfer[3:0] == 4'd0)
 
                         begin
 
                                tx_dout <= !(tx_data_in_0[8]^eop_s[0]^eop_s[1]);
 
                         end
 
                         else if(!tx_data_in_0[8] && last_type == EEP  && global_counter_transfer[3:0] == 4'd0)
 
                         begin
 
                                tx_dout <= !(tx_data_in_0[8]^eep_s[0]^eep_s[1]);
 
                         end
 
                         else if(!tx_data_in_0[8] && last_type == DATA  && global_counter_transfer[3:0] == 4'd0)
 
                         begin
 
                                tx_dout <= !(tx_data_in_0[8]^txdata_flagctrl_tx_last[0]^txdata_flagctrl_tx_last[1]^txdata_flagctrl_tx_last[2]^txdata_flagctrl_tx_last[3]^ txdata_flagctrl_tx_last[4]^txdata_flagctrl_tx_last[5]^txdata_flagctrl_tx_last[6]^txdata_flagctrl_tx_last[7]);
 
                         end
 
                         else if(!tx_data_in_0[8] && last_type == TIMEC && global_counter_transfer[3:0] == 4'd0)
 
                         begin
 
                                tx_dout <= !(tx_data_in_0[8]^last_timein_control_flag_tx[7]^last_timein_control_flag_tx[6]^last_timein_control_flag_tx[5]^last_timein_control_flag_tx[4]^last_timein_control_flag_tx[3]^last_timein_control_flag_tx[2]^last_timein_control_flag_tx[1]^last_timein_control_flag_tx[0]);
 
                         end
 
                         else if(tx_data_in_0[8]  && tx_data_in_0[1:0] == 2'b00 && last_type == NULL  && global_counter_transfer[3:0] == 4'd0)
 
                         begin
 
                                tx_dout <= !(eop_s[2]^null_s[0]^null_s[1]);
 
                         end
 
                         else if(tx_data_in_0[8] && tx_data_in_0[1:0] == 2'b00 && last_type == FCT   && global_counter_transfer[3:0] == 4'd0)
 
                         begin
 
                                tx_dout <= !(eop_s[2]^fct_s[0]^fct_s[1]);
 
                         end
 
                         else if(tx_data_in_0[8] && tx_data_in_0[1:0] == 2'b00 && last_type == EOP  && global_counter_transfer[3:0] == 4'd0)
 
                         begin
 
                                tx_dout <= !(eop_s[2]^eop_s[0]^eop_s[1]);
 
                         end
 
                         else if(tx_data_in_0[8] && tx_data_in_0[1:0] == 2'b00 && last_type == EEP  && global_counter_transfer[3:0] == 4'd0)
 
                         begin
 
                                tx_dout <= !(eop_s[2]^eep_s[0]^eep_s[1]);
 
                         end
 
                         else if(tx_data_in_0[8]  && tx_data_in_0[1:0] == 2'b00 && last_type == DATA  && global_counter_transfer[3:0] == 4'd0)
 
                         begin
 
                                tx_dout <= !(eop_s[2]^txdata_flagctrl_tx_last[0]^txdata_flagctrl_tx_last[1]^txdata_flagctrl_tx_last[2]^txdata_flagctrl_tx_last[3]^ txdata_flagctrl_tx_last[4]^txdata_flagctrl_tx_last[5]^txdata_flagctrl_tx_last[6]^txdata_flagctrl_tx_last[7]);
 
                         end
 
                         else if(tx_data_in_0[8]  && tx_data_in_0[1:0] == 2'b00 && last_type == TIMEC && global_counter_transfer[3:0] == 4'd0)
 
                         begin
 
                                tx_dout <= !(eop_s[2]^last_timein_control_flag_tx[7]^last_timein_control_flag_tx[6]^last_timein_control_flag_tx[5]^last_timein_control_flag_tx[4]^last_timein_control_flag_tx[3]^last_timein_control_flag_tx[2]^last_timein_control_flag_tx[1]^last_timein_control_flag_tx[0]);
 
                         end
 
                         else if(tx_data_in_0[8] && tx_data_in_0[1:0] == 2'b01 && last_type == NULL  && global_counter_transfer[3:0] == 4'd0)
 
                         begin
 
                                tx_dout <= !(eep_s[2]^null_s[0]^null_s[1]);
 
                         end
 
                         else if(tx_data_in_0[8] && tx_data_in_0[1:0] == 2'b01 && last_type == FCT  && global_counter_transfer[3:0] == 4'd0)
 
                         begin
 
                                tx_dout <= !(eep_s[2]^fct_s[0]^fct_s[1]);
 
                         end
 
                         else if(tx_data_in_0[8] && tx_data_in_0[1:0] == 2'b01 && last_type == EOP  && global_counter_transfer[3:0] == 4'd0)
 
                         begin
 
                                tx_dout <= !(eep_s[2]^eop_s[0]^eop_s[1]);
 
                         end
 
                         else if(tx_data_in_0[8] && tx_data_in_0[1:0] == 2'b01 && last_type == EEP && global_counter_transfer[3:0] == 4'd0)
 
                         begin
 
                                tx_dout <= !(eep_s[2]^eep_s[0]^eep_s[1]);
 
                         end
 
                         else if(tx_data_in_0[8]  && tx_data_in_0[1:0] == 2'b01 && last_type == DATA && global_counter_transfer[3:0] == 4'd0)
 
                         begin
 
                                tx_dout <= !(eep_s[2]^txdata_flagctrl_tx_last[0]^txdata_flagctrl_tx_last[1]^txdata_flagctrl_tx_last[2]^txdata_flagctrl_tx_last[3]^ txdata_flagctrl_tx_last[4]^txdata_flagctrl_tx_last[5]^txdata_flagctrl_tx_last[6]^txdata_flagctrl_tx_last[7]);
 
                         end
 
                         else if(tx_data_in_0[8]  &&  tx_data_in_0[1:0] == 2'b01 && last_type == TIMEC && global_counter_transfer[3:0] == 4'd0)
 
                         begin
 
                                tx_dout <= !(eep_s[2]^last_timein_control_flag_tx[7]^last_timein_control_flag_tx[6]^last_timein_control_flag_tx[5]^last_timein_control_flag_tx[4]^last_timein_control_flag_tx[3]^last_timein_control_flag_tx[2]^last_timein_control_flag_tx[1]^last_timein_control_flag_tx[0]);
 
                         end
 
                         else if(!tx_data_in_0[8] &&  global_counter_transfer[3:0] == 4'd1)
 
                         begin
 
                                tx_dout <= tx_data_in_0[8];
 
                         end
 
                         else if(!tx_data_in_0[8] && global_counter_transfer[3:0] == 4'd2)
 
                         begin
 
                                tx_dout <= tx_data_in_0[0];
 
                         end
 
                         else if(!tx_data_in_0[8] &&  global_counter_transfer[3:0] == 4'd3)
 
                         begin
 
                                tx_dout <= tx_data_in_0[1];
 
                         end
 
                         else if(!tx_data_in_0[8] && global_counter_transfer[3:0] == 4'd4)
 
                         begin
 
                                tx_dout <= tx_data_in_0[2];
 
                         end
 
                         else if(!tx_data_in_0[8]  && global_counter_transfer[3:0] == 4'd5)
 
                         begin
 
                                tx_dout <= tx_data_in_0[3];
 
                         end
 
                         else if(!tx_data_in_0[8]  && global_counter_transfer[3:0] == 4'd6)
 
                         begin
 
                                tx_dout <= tx_data_in_0[4];
 
                         end
 
                         else if(!tx_data_in_0[8]  && global_counter_transfer[3:0] == 4'd7)
 
                         begin
 
                                tx_dout <= tx_data_in_0[5];
 
                         end
 
                         else if(!tx_data_in_0[8] &&  global_counter_transfer[3:0] == 4'd8)
 
                         begin
 
                                tx_dout <= tx_data_in_0[6];
 
                         end
 
                         else if(!tx_data_in_0[8] &&  global_counter_transfer[3:0] == 4'd9)
 
                         begin
 
                                tx_dout <= tx_data_in_0[7];
 
                         end
 
                         else if(tx_data_in_0[8] && tx_data_in_0[1:0] == 2'b01 && global_counter_transfer[3:0] == 4'd1)
 
                         begin
 
                                tx_dout <= eep_s[2];
 
                         end
 
                         else if( tx_data_in_0[8] && tx_data_in_0[1:0] == 2'b01 && global_counter_transfer[3:0] == 4'd2)
 
                         begin
 
                                tx_dout <= eep_s[1];
 
                         end
 
                         else if(tx_data_in_0[8] && tx_data_in_0[1:0] == 2'b01 && global_counter_transfer[3:0] == 4'd3)
 
                         begin
 
                                tx_dout <= eep_s[0];
 
                         end
 
                         else if(tx_data_in_0[8] && tx_data_in_0[1:0] == 2'b00 && global_counter_transfer[3:0] == 4'd1)
 
                         begin
 
                                tx_dout <= eop_s[2];
 
                         end
 
                         else if(tx_data_in_0[8] && tx_data_in_0[1:0] == 2'b00 && global_counter_transfer[3:0] == 4'd2)
 
                         begin
 
                                tx_dout <= eop_s[1];
 
                         end
 
                         else if(tx_data_in_0[8] && tx_data_in_0[1:0] == 2'b00 && global_counter_transfer[3:0] == 4'd3)
 
                         begin
 
                                tx_dout <= eop_s[0];
                         end
                         end
                end
                end
                tx_spw_time_code_c:
                tx_spw_time_code_c:
                begin
                begin
                         if(last_type == NULL  && global_counter_transfer[3:0] == 4'd0)
                         if(last_type == NULL  && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(timecode_s[12]^null_s[0]^null_s[1]);
                                tx_dout <= !(timecode_s[12]^null_s[0]^null_s[1]);
                         end
                         end
                         else if(last_type == FCT   && global_counter_transfer[3:0] == 4'd0)
                         else if(last_type == FCT   && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(timecode_s[12]^fct_s[0]^fct_s[1]);
                                tx_dout <= !(timecode_s[12]^fct_s[0]^fct_s[1]);
                         end
                         end
                         else if (last_type == EOP   && global_counter_transfer[3:0] == 4'd0)
                         else if (last_type == EOP   && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(timecode_s[12]^eop_s[0]^eop_s[1]);
                                tx_dout <= !(timecode_s[12]^eop_s[0]^eop_s[1]);
                         end
                         end
                         else if( last_type == EEP   && global_counter_transfer[3:0] == 4'd0)
                         else if( last_type == EEP   && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(timecode_s[12]^eep_s[0]^eep_s[1]);
                                tx_dout <= !(timecode_s[12]^eep_s[0]^eep_s[1]);
                         end
                         end
                         else if( last_type == DATA  && global_counter_transfer[3:0] == 4'd0)
                         else if( last_type == DATA  && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(timecode_s[12]^txdata_flagctrl_tx_last[0]^txdata_flagctrl_tx_last[1]^txdata_flagctrl_tx_last[2]^txdata_flagctrl_tx_last[3]^ txdata_flagctrl_tx_last[4]^txdata_flagctrl_tx_last[5]^txdata_flagctrl_tx_last[6]^txdata_flagctrl_tx_last[7]);
                                tx_dout <= !(timecode_s[12]^txdata_flagctrl_tx_last[0]^txdata_flagctrl_tx_last[1]^txdata_flagctrl_tx_last[2]^txdata_flagctrl_tx_last[3]^ txdata_flagctrl_tx_last[4]^txdata_flagctrl_tx_last[5]^txdata_flagctrl_tx_last[6]^txdata_flagctrl_tx_last[7]);
                         end
                         end
                         else if( last_type == TIMEC && global_counter_transfer[3:0] == 4'd0)
                         else if( last_type == TIMEC && global_counter_transfer[3:0] == 4'd0)
                         begin
                         begin
                                tx_dout = !(timecode_s[12]^last_timein_control_flag_tx[7]^last_timein_control_flag_tx[6]^last_timein_control_flag_tx[5]^last_timein_control_flag_tx[4]^last_timein_control_flag_tx[3]^last_timein_control_flag_tx[2]^last_timein_control_flag_tx[1]^last_timein_control_flag_tx[0]);
                                tx_dout <= !(timecode_s[12]^last_timein_control_flag_tx[7]^last_timein_control_flag_tx[6]^last_timein_control_flag_tx[5]^last_timein_control_flag_tx[4]^last_timein_control_flag_tx[3]^last_timein_control_flag_tx[2]^last_timein_control_flag_tx[1]^last_timein_control_flag_tx[0]);
                         end
                         end
                         else if( global_counter_transfer[3:0] == 4'd1)
                         else if( global_counter_transfer[3:0] == 4'd1)
                         begin
                         begin
                                tx_dout = timecode_s[12];
                                tx_dout <= timecode_s[12];
                         end
                         end
                         else if( global_counter_transfer[3:0] == 4'd2)
                         else if( global_counter_transfer[3:0] == 4'd2)
                         begin
                         begin
                                tx_dout = timecode_s[11];
                                tx_dout <= timecode_s[11];
                         end
                         end
                         else if( global_counter_transfer[3:0] == 4'd3)
                         else if( global_counter_transfer[3:0] == 4'd3)
                         begin
                         begin
                                tx_dout = timecode_s[10];
                                tx_dout <= timecode_s[10];
                         end
                         end
                         else if( global_counter_transfer[3:0] == 4'd4)
                         else if( global_counter_transfer[3:0] == 4'd4)
                         begin
                         begin
                                tx_dout = timecode_s[9];
                                tx_dout <= timecode_s[9];
                         end
                         end
                         else if( global_counter_transfer[3:0] == 4'd5)
                         else if( global_counter_transfer[3:0] == 4'd5)
                         begin
                         begin
                                tx_dout = timecode_s[8];
                                tx_dout <= timecode_s[8];
                         end
                         end
                         else if( global_counter_transfer[3:0] == 4'd6)
                         else if( global_counter_transfer[3:0] == 4'd6)
                         begin
                         begin
                                tx_dout = timecode_s[0];
                                tx_dout <= timecode_s[0];
                         end
                         end
                         else if( global_counter_transfer[3:0] == 4'd7)
                         else if( global_counter_transfer[3:0] == 4'd7)
                         begin
                         begin
                                tx_dout = timecode_s[1];
                                tx_dout <= timecode_s[1];
                         end
                         end
                         else if( global_counter_transfer[3:0] == 4'd8)
                         else if( global_counter_transfer[3:0] == 4'd8)
                         begin
                         begin
                                tx_dout = timecode_s[2];
                                tx_dout <= timecode_s[2];
                         end
                         end
                         else if(global_counter_transfer[3:0] == 4'd9)
                         else if(global_counter_transfer[3:0] == 4'd9)
                         begin
                         begin
                                tx_dout = timecode_s[3];
                                tx_dout <= timecode_s[3];
                         end
                         end
                         else if(global_counter_transfer[3:0] == 4'd10)
                         else if(global_counter_transfer[3:0] == 4'd10)
                         begin
                         begin
                                tx_dout = timecode_s[4];
                                tx_dout <= timecode_s[4];
                         end
                         end
                         else if(global_counter_transfer[3:0] == 4'd11)
                         else if(global_counter_transfer[3:0] == 4'd11)
                         begin
                         begin
                                tx_dout = timecode_s[5];
                                tx_dout <= timecode_s[5];
                         end
                         end
                         else if( global_counter_transfer[3:0] == 4'd12)
                         else if( global_counter_transfer[3:0] == 4'd12)
                         begin
                         begin
                                tx_dout = timecode_s[6];
                                tx_dout <= timecode_s[6];
                         end
                         end
                         else if(global_counter_transfer[3:0] == 4'd13)
                         else if(global_counter_transfer[3:0] == 4'd13)
                         begin
                         begin
                                tx_dout = timecode_s[7];
                                tx_dout <= timecode_s[7];
                         end
                         end
                end
                end
                default:
                default:
                begin
                begin
                end
                end
                endcase
                endcase
end
end
 
end
 
 
//strobe
//strobe
always@(*)
always@(*)
begin
begin
 
 
Line 488... Line 638...
                else
                else
                        next_state_fct_send = 3'd0;
                        next_state_fct_send = 3'd0;
        end
        end
        3'd1:
        3'd1:
        begin
        begin
                if(global_counter_transfer > 4'd0 &&  global_counter_transfer < 4'd12)
 
                begin
 
                        next_state_fct_send = 3'd2;
                        next_state_fct_send = 3'd2;
                end
                end
                else
 
                begin
 
                        next_state_fct_send = 3'd1;
 
                end
 
        end
 
        3'd2:
        3'd2:
        begin
        begin
                if(send_fct_now)
                if(send_fct_now)
                begin
                begin
                        next_state_fct_send = 3'd2;
                        next_state_fct_send = 3'd2;
Line 510... Line 653...
                        next_state_fct_send = 3'd0;
                        next_state_fct_send = 3'd0;
                end
                end
        end
        end
        3'd3:
        3'd3:
        begin
        begin
                if(global_counter_transfer > 4'd0 &&  global_counter_transfer < 4'd12)
 
                begin
 
                        next_state_fct_send = 3'd4;
                        next_state_fct_send = 3'd4;
                end
                end
                else
 
                begin
 
                        next_state_fct_send = 3'd3;
 
                end
 
        end
 
        3'd4:
        3'd4:
        begin
        begin
                if(fct_sent)
                if(fct_sent)
                begin
                begin
                        next_state_fct_send = 3'd4;
                        next_state_fct_send = 3'd4;
Line 555... Line 691...
                begin
                begin
                        fct_flag <= fct_flag;
                        fct_flag <= fct_flag;
                end
                end
                3'd1:
                3'd1:
                begin
                begin
                        if(global_counter_transfer > 4'd0 &&  global_counter_transfer < 4'd12)
                        if(fct_flag < 3'd7)
                                fct_flag <= fct_flag + 3'd1;
                                fct_flag <= fct_flag + 3'd1;
                        else
                        else
                                fct_flag <= fct_flag;
                                fct_flag <= fct_flag;
                end
                end
                3'd2:
                3'd2:
                begin
                begin
                        fct_flag <= fct_flag;
                        fct_flag <= fct_flag;
                end
                end
                3'd3:
                3'd3:
                begin
                begin
                        if(global_counter_transfer > 4'd0 &&  global_counter_transfer < 4'd12)
                        if(fct_flag > 3'd0)
                                fct_flag <= fct_flag - 3'd1;
                                fct_flag <= fct_flag - 3'd1;
                        else
                        else
                                fct_flag <= fct_flag;
                                fct_flag <= fct_flag;
                end
                end
                3'd4:
                3'd4:
Line 604... Line 740...
                else
                else
                        next_state_fct_receive = 3'd0;
                        next_state_fct_receive = 3'd0;
        end
        end
        3'd1:
        3'd1:
        begin
        begin
                if(global_counter_transfer > 4'd0 &&  global_counter_transfer < 4'd12)
 
                begin
 
                        next_state_fct_receive = 3'd2;
                        next_state_fct_receive = 3'd2;
                end
                end
                else
 
                begin
 
                        next_state_fct_receive = 3'd1;
 
                end
 
        end
 
        3'd2:
        3'd2:
        begin
        begin
                if(gotfct_tx)
                if(gotfct_tx)
                begin
                begin
                        next_state_fct_receive = 3'd2;
                        next_state_fct_receive = 3'd2;
Line 626... Line 756...
                        next_state_fct_receive = 3'd0;
                        next_state_fct_receive = 3'd0;
                end
                end
        end
        end
        3'd3:
        3'd3:
        begin
        begin
                if(global_counter_transfer > 4'd0 &&  global_counter_transfer < 4'd12)
 
                begin
 
                        next_state_fct_receive = 3'd4;
                        next_state_fct_receive = 3'd4;
                end
                end
                else
 
                begin
 
                        next_state_fct_receive = 3'd3;
 
                end
 
        end
 
        3'd4:
        3'd4:
        begin
        begin
                if(char_sent)
                if(char_sent)
                begin
                begin
                        next_state_fct_receive = 3'd4;
                        next_state_fct_receive = 3'd4;
Line 673... Line 796...
                begin
                begin
                        fct_counter_receive <= fct_counter_receive;
                        fct_counter_receive <= fct_counter_receive;
                end
                end
                3'd1:
                3'd1:
                begin
                begin
                        if(global_counter_transfer > 4'd0 &&  global_counter_transfer < 4'd12)
 
                        begin
 
                                if(fct_counter_receive < 6'd48)
                                if(fct_counter_receive < 6'd48)
                                begin
                                begin
                                        fct_counter_receive <= fct_counter_receive + 6'd8;
                                        fct_counter_receive <= fct_counter_receive + 6'd8;
                                end
                                end
                                else
                                else
                                begin
                                begin
                                        fct_counter_receive <= fct_counter_receive + 6'd7;
                                        fct_counter_receive <= fct_counter_receive + 6'd7;
                                end
                                end
                        end
                        end
                        else
 
                                fct_counter_receive <= fct_counter_receive;
 
                end
 
                3'd2:
                3'd2:
                begin
                begin
                        fct_counter_receive <= fct_counter_receive;
                        fct_counter_receive <= fct_counter_receive;
                end
                end
                3'd3:
                3'd3:
                begin
                begin
                        if(global_counter_transfer > 4'd0 &&  global_counter_transfer < 4'd12)
 
                        begin
 
                                if(fct_counter_receive == 6'd0)
                                if(fct_counter_receive == 6'd0)
                                        fct_counter_receive <= fct_counter_receive;
                                        fct_counter_receive <= fct_counter_receive;
                                else
                                else
                                        fct_counter_receive <= fct_counter_receive - 6'd1;
                                        fct_counter_receive <= fct_counter_receive - 6'd1;
                        end
                        end
                        else
 
                                fct_counter_receive <= fct_counter_receive;
 
                end
 
                3'd4:
                3'd4:
                begin
                begin
                        fct_counter_receive <= fct_counter_receive;
                        fct_counter_receive <= fct_counter_receive;
                end
                end
                default:
                default:
Line 715... Line 828...
                end
                end
                endcase
                endcase
        end
        end
end
end
 
 
 
 
always@(*)
 
begin
 
        next_state_data_fifo = state_data_fifo;
 
 
 
        case(state_data_fifo)
 
        3'd0:
 
        begin
 
                if(!ready_tx_data && txwrite_tx)
 
                begin
 
                        next_state_data_fifo = 3'd1;
 
                end
 
                else
 
                        next_state_data_fifo = 3'd0;
 
        end
 
        3'd1:
 
        begin
 
                next_state_data_fifo = 3'd2;
 
        end
 
        3'd2:
 
        begin
 
 
 
                if(state_tx == tx_spw_null_c && global_counter_transfer > 4'd1 && global_counter_transfer < 4'd7)
 
                        next_state_data_fifo = 3'd3;
 
                else if(state_tx == tx_spw_data_c && global_counter_transfer > 4'd1 && global_counter_transfer < 4'd9)
 
                        next_state_data_fifo = 3'd3;
 
                else
 
                        next_state_data_fifo = 3'd2;
 
        end
 
        3'd3:
 
        begin
 
                if(!ready_tx_data && txwrite_tx)
 
                begin
 
                        next_state_data_fifo = 3'd3;
 
                end
 
                else
 
                begin
 
                        next_state_data_fifo = 3'd0;
 
                end
 
        end
 
        default:
 
        begin
 
                next_state_data_fifo = 3'd0;
 
        end
 
        endcase
 
end
 
 
 
always@(posedge pclk_tx or negedge enable_tx)
 
begin
 
        if(!enable_tx)
 
        begin
 
                data_ready_took <= 1'b0;
 
                state_data_fifo <= 3'd0;
 
                tx_data_took <= 9'd0;
 
        end
 
        else
 
        begin
 
 
 
                state_data_fifo <= next_state_data_fifo;
 
 
 
                case(state_data_fifo)
 
                3'd0:
 
                begin
 
                        //tx_data_took <= tx_data_took;
 
                end
 
                3'd1:
 
                begin
 
                        tx_data_took <= data_tx_i;
 
                end
 
                3'd2:
 
                begin
 
                        tx_data_took <= data_tx_i;
 
 
 
                        if(state_tx == tx_spw_null_c && global_counter_transfer > 4'd0 && global_counter_transfer < 4'd7)
 
                                data_ready_took <= 1'b1;
 
                        else if(state_tx == tx_spw_data_c && global_counter_transfer > 4'd0 && global_counter_transfer < 4'd9)
 
                                data_ready_took <= 1'b1;
 
                        else
 
                                data_ready_took <= 1'b0;
 
                end
 
                3'd3:
 
                begin
 
                        if(!ready_tx_data && txwrite_tx)
 
                        begin
 
                                data_ready_took <= 1'b1;
 
                        end
 
                        else
 
                        begin
 
                                data_ready_took <= 1'b0;
 
                        end
 
                end
 
                default:
 
                begin
 
                end
 
                endcase
 
        end
 
end
 
 
 
always@(*)
always@(*)
begin
begin
        next_state_tx = state_tx;
        next_state_tx = state_tx;
 
 
        case(state_tx)
        case(state_tx)
Line 873... Line 888...
                        end
                        end
                        else if(fct_flag > 3'd0 && !send_fct_now)
                        else if(fct_flag > 3'd0 && !send_fct_now)
                        begin
                        begin
                                next_state_tx = tx_spw_fct_c;
                                next_state_tx = tx_spw_fct_c;
                        end
                        end
                        else if(data_ready_took && !gotfct_tx && fct_counter_receive > 6'd0)
                        else if(process_data && !gotfct_tx && fct_counter_receive > 6'd0)
                        begin
                        begin
                                next_state_tx = tx_spw_data_c;
                                next_state_tx = tx_spw_data_c;
                        end
                        end
 
                        else if(process_data_0 && !gotfct_tx && fct_counter_receive > 6'd0)
 
                        begin
 
                                next_state_tx = tx_spw_data_c_0;
 
                        end
                        else
                        else
                        begin
                        begin
                                next_state_tx = tx_spw_null_c;
                                next_state_tx = tx_spw_null_c;
                        end
                        end
                end
                end
Line 920... Line 939...
                                end
                                end
                                else if(fct_flag > 3'd0 && !send_fct_now)
                                else if(fct_flag > 3'd0 && !send_fct_now)
                                begin
                                begin
                                        next_state_tx = tx_spw_fct_c;
                                        next_state_tx = tx_spw_fct_c;
                                end
                                end
                                else if(data_ready_took && !gotfct_tx && fct_counter_receive > 6'd0)
                                else if(process_data_0 && !gotfct_tx && fct_counter_receive > 6'd0)
                                begin
                                begin
                                        next_state_tx = tx_spw_data_c;
                                        next_state_tx = tx_spw_data_c_0;
                                end
                                end
                                else
                                else
                                begin
                                begin
                                        next_state_tx = tx_spw_null_c;
                                        next_state_tx = tx_spw_null_c;
                                end
                                end
Line 955... Line 974...
                                next_state_tx = tx_spw_data_c;
                                next_state_tx = tx_spw_data_c;
                end
                end
 
 
 
 
        end
        end
 
        tx_spw_data_c_0:
 
        begin
 
 
 
                if(!tx_data_in_0[8])
 
                begin
 
                        if(global_counter_transfer == 4'd9)
 
                        begin
 
                                if(tickin_tx && !ready_tx_timecode && tcode_rdy_trnsp)
 
                                begin
 
                                        next_state_tx = tx_spw_time_code_c;
 
                                end
 
                                else if(fct_flag > 3'd0 && !send_fct_now)
 
                                begin
 
                                        next_state_tx = tx_spw_fct_c;
 
                                end
 
                                else if(process_data && !gotfct_tx && fct_counter_receive > 6'd0)
 
                                begin
 
                                        next_state_tx = tx_spw_data_c;
 
                                end
 
                                else
 
                                begin
 
                                        next_state_tx = tx_spw_null_c;
 
                                end
 
                        end
 
                        else
 
                                next_state_tx = tx_spw_data_c_0;
 
                end
 
                else if(tx_data_in_0[8])
 
                begin
 
                        if(global_counter_transfer == 4'd3)
 
                        begin
 
                                if(tickin_tx && !ready_tx_timecode && tcode_rdy_trnsp)
 
                                begin
 
                                        next_state_tx = tx_spw_time_code_c;
 
                                end
 
                                else if(fct_flag > 3'd0 && !send_fct_now)
 
                                begin
 
                                        next_state_tx = tx_spw_fct_c;
 
                                end
 
                                else
 
                                begin
 
                                        next_state_tx = tx_spw_null_c;
 
                                end
 
                        end
 
                        else
 
                                next_state_tx = tx_spw_data_c_0;
 
                end
 
 
 
 
 
        end
        tx_spw_time_code_c:
        tx_spw_time_code_c:
        begin
        begin
                if(global_counter_transfer == 4'd13)
                if(global_counter_transfer == 4'd13)
                begin
                begin
                        if(fct_flag > 3'd0 && !send_fct_now)
                        if(fct_flag > 3'd0 && !send_fct_now)
                        begin
                        begin
                                next_state_tx = tx_spw_fct_c;
                                next_state_tx = tx_spw_fct_c;
                        end
                        end
                        else if(data_ready_took && !gotfct_tx && fct_counter_receive > 6'd0 )
                        else if(process_data && !gotfct_tx && fct_counter_receive > 6'd0 )
                        begin
                        begin
                                next_state_tx = tx_spw_data_c;
                                next_state_tx = tx_spw_data_c;
                        end
                        end
 
                        else if(process_data_0 && !gotfct_tx && fct_counter_receive > 6'd0)
 
                        begin
 
                                next_state_tx = tx_spw_data_c_0;
 
                        end
                        else
                        else
                        begin
                        begin
                                next_state_tx = tx_spw_null_c;
                                next_state_tx = tx_spw_null_c;
                        end
                        end
                end
                end
Line 1000... Line 1073...
                last_type  <= NULL;
                last_type  <= NULL;
 
 
                global_counter_transfer <= 4'd0;
                global_counter_transfer <= 4'd0;
                txdata_flagctrl_tx_last <= 9'd0;
                txdata_flagctrl_tx_last <= 9'd0;
                tx_data_in <= 9'd0;
                tx_data_in <= 9'd0;
 
                tx_data_in_0 <= 9'd0;
 
 
 
                process_data   <= 1'b0;
 
                process_data_0 <= 1'b0;
 
 
                last_timein_control_flag_tx <= 8'd0;
                last_timein_control_flag_tx <= 8'd0;
 
 
                char_sent<= 1'b0;
                char_sent<= 1'b0;
                fct_sent <= 1'b0;
                fct_sent <= 1'b0;
 
 
Line 1024... Line 1102...
                state_tx <= next_state_tx;
                state_tx <= next_state_tx;
 
 
                case(state_tx)
                case(state_tx)
                tx_spw_start:
                tx_spw_start:
                begin
                begin
 
 
 
                        if(send_null_tx && enable_tx)
 
                        begin
 
                                global_counter_transfer <= global_counter_transfer + 4'd1;
 
                        end
 
                        else
 
                        begin
                        global_counter_transfer <= 4'd0;
                        global_counter_transfer <= 4'd0;
                end
                end
 
 
 
                end
                tx_spw_null:
                tx_spw_null:
                begin
                begin
 
 
                        last_tx_dout <= tx_dout;
                        last_tx_dout <= tx_dout;
                        last_tx_sout <= tx_sout;
                        last_tx_sout <= tx_sout;
 
 
                        tx_dout_e <= last_tx_dout;
                        tx_dout_e <= tx_dout;
                        tx_sout_e <= last_tx_sout;
                        tx_sout_e <= tx_sout;
 
 
 
 
                        if(tickin_tx && global_counter_transfer == 4'd5)
                        if(tickin_tx && global_counter_transfer == 4'd5)
                        begin
                        begin
                                tx_tcode_in <= timecode_tx_i;
                                tx_tcode_in <= timecode_tx_i;
Line 1062... Line 1149...
                begin
                begin
 
 
                        last_tx_dout <= tx_dout;
                        last_tx_dout <= tx_dout;
                        last_tx_sout <= tx_sout;
                        last_tx_sout <= tx_sout;
 
 
                        tx_dout_e <= last_tx_dout;
                        tx_dout_e <= tx_dout;
                        tx_sout_e <= last_tx_sout;
                        tx_sout_e <= tx_sout;
 
 
                        if(global_counter_transfer == 4'd3)
                        if(global_counter_transfer == 4'd3)
                        begin
                        begin
                                last_type  <=FCT;
                                last_type  <=FCT;
                                global_counter_transfer <= 4'd0;
                                global_counter_transfer <= 4'd0;
Line 1087... Line 1174...
                begin
                begin
 
 
                        last_tx_dout <= tx_dout;
                        last_tx_dout <= tx_dout;
                        last_tx_sout <= tx_sout;
                        last_tx_sout <= tx_sout;
 
 
                        tx_dout_e <= last_tx_dout;
                        tx_dout_e <= tx_dout;
                        tx_sout_e <= last_tx_sout;
                        tx_sout_e <= tx_sout;
 
 
                        if(global_counter_transfer == 4'd7)
                        if(global_counter_transfer == 4'd7)
                        begin
                        begin
 
                                fct_sent <=  1'b0;
                                last_type  <= NULL;
                                last_type  <= NULL;
                                global_counter_transfer <= 4'd0;
                                global_counter_transfer <= 4'd0;
 
                        end
 
                        else
 
                        begin
 
 
                                if(data_ready_took)
                                if(process_data_0)
                                        tx_data_in <= tx_data_took;
                                begin
 
                                        process_data_0 <= process_data_0;
 
                                end
                                else
                                else
                                        tx_data_in <= tx_data_in;
                                begin
 
                                        if(txwrite_tx)
 
                                        begin
 
                                                tx_data_in     <= data_tx_i;
 
                                                process_data   <= 1'b1;
                        end
                        end
                        else
                        else
                        begin
                        begin
 
                                                tx_data_in     <= tx_data_in;
 
                                                process_data   <= 1'b0;
 
                                        end
 
                                        process_data_0 <= 1'b0;
 
                                end
 
 
                                char_sent <= 1'b0;
                                char_sent <= 1'b0;
                                fct_sent <=  1'b0;
                                fct_sent <=  1'b0;
                                ready_tx_timecode <= 1'b0;
                                ready_tx_timecode <= 1'b0;
                                last_type  <= last_type;
                                last_type  <= last_type;
                                global_counter_transfer <= global_counter_transfer + 4'd1;
                                global_counter_transfer <= global_counter_transfer + 4'd1;
Line 1115... Line 1218...
                begin
                begin
 
 
                        last_tx_dout <= tx_dout;
                        last_tx_dout <= tx_dout;
                        last_tx_sout <= tx_sout;
                        last_tx_sout <= tx_sout;
 
 
                        tx_dout_e <= last_tx_dout;
                        tx_dout_e <= tx_dout;
                        tx_sout_e <= last_tx_sout;
                        tx_sout_e <= tx_sout;
 
 
                        if(global_counter_transfer == 4'd3)
                        if(global_counter_transfer == 4'd3)
                        begin
                        begin
                                char_sent <= 1'b0;
                                char_sent <= 1'b0;
                                last_type  <=FCT;
                                last_type  <=FCT;
                                fct_sent <=  1'b0;
                                fct_sent <=  1'b0;
                                global_counter_transfer <= 4'd0;
                                global_counter_transfer <= 4'd0;
                        end
                        end
                        else
                        else
                        begin
                        begin
                                if(fct_flag > 3'd0)
                                char_sent <= 1'b0;
 
                                process_data   <= process_data;
 
                                process_data_0 <= process_data_0;
 
 
                                        fct_sent <=  1'b1;
                                        fct_sent <=  1'b1;
                                else
 
                                        fct_sent <= fct_sent;
 
 
 
                                global_counter_transfer <= global_counter_transfer + 4'd1;
                                global_counter_transfer <= global_counter_transfer + 4'd1;
                        end
                        end
                end
                end
                tx_spw_data_c:
                tx_spw_data_c:
                begin
                begin
 
 
                        last_tx_dout <= tx_dout;
                        last_tx_dout <= tx_dout;
                        last_tx_sout <= tx_sout;
                        last_tx_sout <= tx_sout;
 
 
                        tx_dout_e <= last_tx_dout;
                        tx_dout_e <= tx_dout;
                        tx_sout_e <= last_tx_sout;
                        tx_sout_e <= tx_sout;
 
 
                        fct_sent <=  1'b0;
 
 
 
                        if(!tx_data_in[8])
                        if(!tx_data_in[8])
                        begin
                        begin
 
 
                                if(global_counter_transfer == 4'd9)
                                if(global_counter_transfer == 4'd9)
                                begin
                                begin
 
                                        fct_sent <=  1'b0;
                                        char_sent <= 1'b1;
                                        char_sent <= 1'b1;
                                        last_type  <= DATA;
                                        last_type  <= DATA;
                                        global_counter_transfer <= 4'd0;
                                        global_counter_transfer <= 4'd0;
 
                                end
                                        if(data_ready_took)
 
                                                tx_data_in <= tx_data_took;
 
                                        else
                                        else
                                                tx_data_in <= tx_data_in;
                                begin
 
 
 
                                        if(global_counter_transfer < 4'd3)
 
                                        begin
 
                                                ready_tx_data <= 1'b1;
                                end
                                end
                                else
                                else
                                begin
                                begin
 
                                                fct_sent <=  1'b0;
 
                                                ready_tx_data <= 1'b0;
 
 
                                        if(global_counter_transfer == 4'd1)
                                                if(global_counter_transfer == 4'd3)
                                        begin
                                        begin
                                                txdata_flagctrl_tx_last <= tx_data_in;
                                                txdata_flagctrl_tx_last <= tx_data_in;
                                        end
                                        end
                                        else
                                        else
                                                txdata_flagctrl_tx_last <= txdata_flagctrl_tx_last;
                                                txdata_flagctrl_tx_last <= txdata_flagctrl_tx_last;
 
 
 
                                                if(txwrite_tx)
                                        if(global_counter_transfer >= 4'd2 && global_counter_transfer < 4'd5)
 
                                        begin
                                        begin
                                                ready_tx_data <= 1'b1;
                                                        tx_data_in_0 <= data_tx_i;
 
                                                        process_data_0 <= 1'b1;
                                        end
                                        end
                                        else
                                        else
                                                ready_tx_data <= 1'b0;
                                                begin
 
                                                        tx_data_in_0 <= tx_data_in_0;
 
                                                        process_data_0 <= 1'b0;
 
                                                end
 
                                        end
 
 
 
                                        process_data <= 1'b0;
                                        char_sent <= 1'b0;
                                        char_sent <= 1'b0;
                                        ready_tx_timecode <= 1'b0;
                                        ready_tx_timecode <= 1'b0;
                                        global_counter_transfer <= global_counter_transfer + 4'd1;
                                        global_counter_transfer <= global_counter_transfer + 4'd1;
 
 
                                 end
                                 end
Line 1191... Line 1303...
                        begin
                        begin
 
 
                                if(global_counter_transfer == 4'd3)
                                if(global_counter_transfer == 4'd3)
                                begin
                                begin
                                        char_sent <= 1'b1;
                                        char_sent <= 1'b1;
 
                                        fct_sent <=  1'b0;
                                        if(tx_data_in[1:0] == 2'b00)
                                        if(tx_data_in[1:0] == 2'b00)
                                        begin
                                        begin
                                                last_type  <=EOP;
                                                last_type  <=EOP;
                                        end
                                        end
                                        else if(tx_data_in[1:0] == 2'b01)
                                        else if(tx_data_in[1:0] == 2'b01)
Line 1206... Line 1318...
                                        ready_tx_data <= 1'b0;
                                        ready_tx_data <= 1'b0;
                                        global_counter_transfer <= 4'd0;
                                        global_counter_transfer <= 4'd0;
                                end
                                end
                                else
                                else
                                begin
                                begin
 
                                        fct_sent <=  1'b0;
 
                                        char_sent <= 1'b0;
 
                                        process_data   <= 1'b0;
 
                                        process_data_0 <= 1'b0;
                                        txdata_flagctrl_tx_last <= txdata_flagctrl_tx_last;
                                        txdata_flagctrl_tx_last <= txdata_flagctrl_tx_last;
                                        ready_tx_data <= 1'b1;
                                        ready_tx_data <= 1'b1;
                                        ready_tx_timecode <= 1'b0;
                                        ready_tx_timecode <= 1'b0;
                                        global_counter_transfer <= global_counter_transfer + 4'd1;
                                        global_counter_transfer <= global_counter_transfer + 4'd1;
                                end
                                end
                        end
                        end
 
 
                end
                end
                tx_spw_time_code_c:
                tx_spw_data_c_0:
 
                begin
 
 
 
                        last_tx_dout <= tx_dout;
 
                        last_tx_sout <= tx_sout;
 
 
 
                        tx_dout_e <= tx_dout;
 
                        tx_sout_e <= tx_sout;
 
 
 
                        if(!tx_data_in_0[8])
 
                        begin
 
 
 
                                if(global_counter_transfer == 4'd9)
 
                                begin
 
                                        fct_sent <=  1'b0;
 
                                        char_sent <= 1'b1;
 
                                        last_type  <= DATA;
 
                                        global_counter_transfer <= 4'd0;
 
                                end
 
                                else
 
                                begin
 
 
 
                                        if(global_counter_transfer < 4'd3)
 
                                        begin
 
                                                ready_tx_data <= 1'b1;
 
                                        end
 
                                        else
                begin
                begin
 
                                                ready_tx_data <= 1'b0;
 
 
 
                                                if(global_counter_transfer == 4'd3)
 
                                                begin
 
                                                        txdata_flagctrl_tx_last <= tx_data_in_0;
 
                                                end
 
                                                else
 
                                                        txdata_flagctrl_tx_last <= txdata_flagctrl_tx_last;
 
 
 
                                                if(txwrite_tx)
 
                                                begin
 
                                                        tx_data_in     <= data_tx_i;
 
                                                        process_data   <= 1'b1;
 
                                                end
 
                                                else
 
                                                begin
 
                                                        tx_data_in     <= tx_data_in;
 
                                                        process_data   <= 1'b0;
 
                                                end
 
                                        end
 
 
                        fct_sent <=  1'b0;
                        fct_sent <=  1'b0;
 
                                        process_data_0 <= 1'b0;
 
                                        char_sent <= 1'b0;
 
                                        ready_tx_timecode <= 1'b0;
 
                                        global_counter_transfer <= global_counter_transfer + 4'd1;
 
 
 
                                 end
 
 
 
                        end
 
                        else if(tx_data_in_0[8])
 
                        begin
 
 
 
                                if(global_counter_transfer == 4'd3)
 
                                begin
 
                                        fct_sent <=  1'b0;
 
                                        char_sent <= 1'b1;
 
 
 
                                        if(tx_data_in_0[1:0] == 2'b00)
 
                                        begin
 
                                                last_type  <=EOP;
 
                                        end
 
                                        else if(tx_data_in_0[1:0] == 2'b01)
 
                                        begin
 
                                                last_type  <=EEP;
 
                                        end
 
 
 
                                        ready_tx_data <= 1'b0;
 
                                        global_counter_transfer <= 4'd0;
 
                                end
 
                                else
 
                                begin
 
                                        fct_sent <=  1'b0;
 
                                        process_data   <= 1'b0;
 
                                        process_data_0 <= 1'b0;
 
                                        txdata_flagctrl_tx_last <= txdata_flagctrl_tx_last;
 
                                        ready_tx_data <= 1'b1;
 
                                        ready_tx_timecode <= 1'b0;
 
                                        char_sent <= 1'b0;
 
                                        global_counter_transfer <= global_counter_transfer + 4'd1;
 
                                end
 
                        end
 
 
 
                end
 
                tx_spw_time_code_c:
 
                begin
 
 
                        last_tx_dout <= tx_dout;
                        last_tx_dout <= tx_dout;
                        last_tx_sout <= tx_sout;
                        last_tx_sout <= tx_sout;
 
 
                        tx_dout_e <= last_tx_dout;
                        tx_dout_e <= tx_dout;
                        tx_sout_e <= last_tx_sout;
                        tx_sout_e <= tx_sout;
 
 
 
 
                        if(global_counter_transfer == 4'd13)
                        if(global_counter_transfer == 4'd13)
                        begin
                        begin
 
                                fct_sent <=  1'b0;
                                ready_tx_timecode <= 1'b1;
                                ready_tx_timecode <= 1'b1;
                                global_counter_transfer <= 4'd0;
                                global_counter_transfer <= 4'd0;
                        end
                        end
                        else
                        else
                        begin
                        begin
 
                                if(process_data_0)
 
                                begin
 
 
 
                                        process_data_0 <= process_data_0;
 
                                end
 
                                else
 
                                begin
 
                                        if(txwrite_tx)
 
                                        begin
 
                                                tx_data_in     <= data_tx_i;
 
                                                process_data   <= 1'b1;
 
                                        end
 
                                        else
 
                                        begin
 
                                                tx_data_in     <= tx_data_in;
 
                                                process_data   <= 1'b0;
 
                                        end
 
                                        process_data_0 <= 1'b0;
 
                                end
 
                                fct_sent <=  1'b0;
 
                                char_sent <= 1'b0;
                                ready_tx_timecode <= 1'b0;
                                ready_tx_timecode <= 1'b0;
                                global_counter_transfer <= global_counter_transfer + 4'd1;
                                global_counter_transfer <= global_counter_transfer + 4'd1;
                        end
                        end
 
 
 
 
Line 1251... Line 1480...
                        end
                        end
 
 
                end
                end
                default:
                default:
                begin
                begin
 
                        fct_sent <=  1'b0;
 
                        char_sent <= 1'b0;
                        last_type               <= last_type;
                        last_type               <= last_type;
                        global_counter_transfer <= global_counter_transfer;
                        global_counter_transfer <= global_counter_transfer;
                        tx_dout_e               <= tx_dout_e;
                        tx_dout_e               <= tx_dout_e;
                        tx_sout_e               <= tx_sout_e;
                        tx_sout_e               <= tx_sout_e;
                end
                end

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.