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

Subversion Repositories spacewiresystemc

[/] [spacewiresystemc/] [trunk/] [rtl/] [RTL_VB/] [tx_spw.v] - Diff between revs 5 and 6

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

Rev 5 Rev 6
Line 89... Line 89...
        reg enable_fct;
        reg enable_fct;
        reg enable_n_char;
        reg enable_n_char;
        reg enable_time_code;
        reg enable_time_code;
 
 
        reg [2:0] fct_send;
        reg [2:0] fct_send;
 
        reg [2:0] fct_send_last;
        reg [2:0] fct_flag;
        reg [2:0] fct_flag;
 
 
        reg [5:0] fct_counter;
        reg [5:0] fct_counter;
 
        reg [5:0] fct_counter_last;
 
        reg [5:0] fct_counter_receive;
 
 
        reg last_tx_dout;
        reg last_tx_dout;
        reg last_tx_sout;
        reg last_tx_sout;
        //reg first_counter_ctr;
 
 
 
        reg [3:0] global_counter_transfer;
        reg [3:0] global_counter_transfer;
 
 
assign ready_tx_timecode = (enable_time_code & global_counter_transfer == 14)?1'b1:1'b0;
assign ready_tx_timecode = (enable_time_code & global_counter_transfer == 14)?1'b1:1'b0;
 
 
Line 384... Line 388...
                tx_sout = last_tx_sout;
                tx_sout = last_tx_sout;
        end
        end
end
end
 
 
//slots open in another side
//slots open in another side
always@(posedge send_fct_tx or negedge enable_tx)
always@(posedge gotfct_tx or negedge enable_tx)
begin
begin
 
 
        if(!enable_tx)
        if(!enable_tx)
        begin
        begin
                fct_counter <= {6{1'b0}};
                fct_counter <= {6{1'b0}};
        end
        end
        else if(gotfct_tx)
        else
        begin
        begin
 
                if(fct_counter == 6'd56)
 
                        fct_counter <= 6'd8;
 
                else
                fct_counter <= fct_counter + 6'd8;
                fct_counter <= fct_counter + 6'd8;
        end
        end
        else if(enable_n_char)
 
        begin
 
                fct_counter <= fct_counter - 6'd1;
 
        end
 
 
 
end
end
 
 
 
 
//slots open in our side
//slots open in our side
always@(posedge send_fct_now or negedge enable_tx)
always@(posedge send_fct_now or negedge enable_tx)
Line 413... Line 415...
        begin
        begin
                fct_send <= {3{1'b1}};
                fct_send <= {3{1'b1}};
        end
        end
        else
        else
        begin
        begin
                fct_send <= fct_send + 6'd1;
 
 
                if(fct_send == 3'd7)
 
                begin
 
                        fct_send <= 3'd1;
 
                end
 
                else
 
                begin
 
                        fct_send <= fct_send + 3'd1;
 
                end
        end
        end
 
 
end
end
 
 
 
 
Line 463... Line 473...
        begin
        begin
 
 
                enable_null   = 1'b1;
                enable_null   = 1'b1;
                next_state_tx = tx_spw_null_fct;
                next_state_tx = tx_spw_null_fct;
 
 
                if(send_fct_tx && fct_flag != 3'd7)
                if(send_fct_tx && fct_flag > 0)
                begin
                begin
                        enable_null = 1'b0;
                        enable_null = 1'b0;
                        enable_fct = 1'b1;
                        enable_fct = 1'b1;
                end
                end
                else
                else
Line 485... Line 495...
        tx_spw_full:
        tx_spw_full:
        begin
        begin
 
 
                enable_null = 1'b1;
                enable_null = 1'b1;
 
 
                if(tickin_tx)
                if(tickin_tx & (global_counter_transfer == 4'd7 || global_counter_transfer == 4'd9 || global_counter_transfer == 4'd13 || global_counter_transfer == 4'd3))
                begin
                begin
                        if(global_counter_transfer == 4'd7 || global_counter_transfer == 4'd9 || global_counter_transfer == 4'd13 || global_counter_transfer == 4'd3)
 
                                enable_time_code = 1'b1;
                                enable_time_code = 1'b1;
 
 
                        enable_null = 1'b0;
                        enable_null = 1'b0;
                end
                end
                else if(fct_send > 3'd0)
                else if(fct_flag > 3'd0 & (global_counter_transfer == 4'd7 || global_counter_transfer == 4'd9 || global_counter_transfer == 4'd13 || global_counter_transfer == 4'd3))
                begin
                begin
                        if(global_counter_transfer == 4'd7 || global_counter_transfer == 4'd9 || global_counter_transfer == 4'd13 || global_counter_transfer == 4'd3)
 
                                enable_fct  = 1'b1;
                                enable_fct  = 1'b1;
 
 
                        enable_null = 1'b0;
                        enable_null = 1'b0;
                end
                end
                else if(txwrite_tx && fct_counter > 6'd0)
                else if(txwrite_tx && fct_counter_receive > 6'd0 & (global_counter_transfer == 4'd7 || global_counter_transfer == 4'd9 || global_counter_transfer == 4'd13 || global_counter_transfer == 4'd3))
                begin
                begin
                        if(global_counter_transfer == 4'd7 || global_counter_transfer == 4'd9 || global_counter_transfer == 4'd13 || global_counter_transfer == 4'd3)
 
                                enable_n_char = 1'b1;
                                enable_n_char = 1'b1;
 
 
                        enable_null = 1'b0;
                        enable_null = 1'b0;
                end
                end
 
 
        end
        end
        endcase
        endcase
Line 523... Line 527...
                eop_s  <= 4'h5;
                eop_s  <= 4'h5;
                eep_s  <= 4'h6;
                eep_s  <= 4'h6;
                timecode_s <= 14'h1e00;
                timecode_s <= 14'h1e00;
 
 
                fct_flag <= 3'd0;
                fct_flag <= 3'd0;
 
                fct_send_last <= 3'd0;
 
 
                first_time <= 1'b1;
                first_time <= 1'b1;
                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;
                last_timein_control_flag_tx <= 8'd0;
                last_timein_control_flag_tx <= 8'd0;
 
 
 
                fct_counter_receive <= 6'd0;
 
                fct_counter_last <= 6'd0;
 
 
                last_tx_dout      <= 1'b0;
                last_tx_dout      <= 1'b0;
                last_tx_sout      <= 1'b0;
                last_tx_sout      <= 1'b0;
                state_tx <= tx_spw_start;
                state_tx <= tx_spw_start;
        end
        end
        else
        else
Line 542... Line 552...
                last_tx_dout <= tx_dout;
                last_tx_dout <= tx_dout;
                last_tx_sout <= tx_sout;
                last_tx_sout <= tx_sout;
 
 
                if(enable_null)
                if(enable_null)
                begin
                begin
                        fct_flag<= fct_flag;
 
 
                        //
 
                        if(fct_send_last != fct_send)
 
                        begin
 
                                if(fct_send == 3'd1 && fct_send_last == 3'd7)
 
                                begin
 
                                        fct_flag <= fct_flag + 3'd1;
 
                                end
 
                                else
 
                                begin
 
                                        fct_flag <= fct_flag + (fct_send - fct_send_last);
 
                                end
 
 
 
                                fct_send_last <= fct_send;
 
                        end
 
 
 
                        //
 
                        if(fct_counter_last != fct_counter)
 
                        begin
 
                                if(fct_counter == 6'd8 && fct_counter_last == 6'd56)
 
                                begin
 
                                        fct_counter_receive <= fct_counter_receive + 6'd8;
 
                                end
 
                                else
 
                                begin
 
                                        fct_counter_receive <= fct_counter_receive + (fct_counter - fct_counter_last);
 
                                end
 
 
 
                                fct_counter_last <= fct_counter;
 
                        end
 
 
                        if(first_time)
                        if(first_time)
                        begin
                        begin
                                first_time <= 1'b0;
                                first_time <= 1'b0;
 
 
                                global_counter_transfer <= global_counter_transfer + 4'd1;
                                global_counter_transfer <= global_counter_transfer + 4'd1;
Line 560... Line 600...
                                global_counter_transfer <= 4'd0;
                                global_counter_transfer <= 4'd0;
                        end
                        end
                end
                end
                else if(enable_fct)
                else if(enable_fct)
                begin
                begin
 
                        //
 
                        if(fct_counter_last != fct_counter)
 
                        begin
 
                                if(fct_counter == 6'd8 && fct_counter_last == 6'd56)
 
                                begin
 
                                        fct_counter_receive <= fct_counter_receive + 6'd8;
 
                                end
 
                                else
 
                                begin
 
                                        fct_counter_receive <= fct_counter_receive + (fct_counter - fct_counter_last);
 
                                end
 
 
 
                                fct_counter_last <= fct_counter;
 
                        end
 
 
                        if(global_counter_transfer != 4'd3)
                        if(global_counter_transfer != 4'd3)
                        begin
                        begin
                                global_counter_transfer <= global_counter_transfer + 4'd1;
                                global_counter_transfer <= global_counter_transfer + 4'd1;
                        end
                        end
                        else
                        else
                        begin
                        begin
                                global_counter_transfer <= 4'd0;
                                global_counter_transfer <= 4'd0;
                                fct_flag <= fct_flag + 3'd1;
                                fct_flag <= fct_flag - 3'd1;
                        end
                        end
                end
                end
                else if(enable_time_code)
                else if(enable_time_code)
                begin
                begin
                        fct_flag<= fct_flag;
                        //
 
                        if(fct_counter_last != fct_counter)
 
                        begin
 
                                if(fct_counter == 6'd8 && fct_counter_last == 6'd56)
 
                                begin
 
                                        fct_counter_receive <= fct_counter_receive + 6'd8;
 
                                end
 
                                else
 
                                begin
 
                                        fct_counter_receive <= fct_counter_receive + (fct_counter - fct_counter_last);
 
                                end
 
 
 
                                fct_counter_last <= fct_counter;
 
                        end
 
 
 
                        //
 
                        if(fct_send_last != fct_send)
 
                        begin
 
                                if(fct_send == 3'd1 && fct_send_last == 3'd7)
 
                                begin
 
                                        fct_flag <= fct_flag + 3'd1;
 
                                end
 
                                else
 
                                begin
 
                                        fct_flag <= fct_flag + (fct_send - fct_send_last);
 
                                end
 
 
 
                                fct_send_last <= fct_send;
 
                        end
 
 
                        if(global_counter_transfer < 4'd13)
                        if(global_counter_transfer < 4'd13)
                        begin
                        begin
                                global_counter_transfer <= global_counter_transfer + 4'd1;
                                global_counter_transfer <= global_counter_transfer + 4'd1;
                                last_timein_control_flag_tx <= timecode_tx_i;
                                last_timein_control_flag_tx <= timecode_tx_i;
                        end
                        end
Line 585... Line 669...
                                global_counter_transfer <= 4'd0;
                                global_counter_transfer <= 4'd0;
                        end
                        end
                end
                end
                else if(enable_n_char)
                else if(enable_n_char)
                begin
                begin
                        fct_flag<= fct_flag;
                        //
 
                        if(fct_send_last != fct_send)
 
                        begin
 
                                if(fct_send == 3'd1 && fct_send_last == 3'd7)
 
                                begin
 
                                        fct_flag <= fct_flag + 3'd1;
 
                                end
 
                                else
 
                                begin
 
                                        fct_flag <= fct_flag + (fct_send - fct_send_last);
 
                                end
 
 
 
                                fct_send_last <= fct_send;
 
                        end
 
 
                        if(global_counter_transfer < 4'd9 && !data_tx_i[8])
                        if(global_counter_transfer < 4'd9 && !data_tx_i[8])
                        begin
                        begin
                                global_counter_transfer <= global_counter_transfer + 4'd1;
                                global_counter_transfer <= global_counter_transfer + 4'd1;
                                txdata_flagctrl_tx_last <= data_tx_i;
                                txdata_flagctrl_tx_last <= data_tx_i;
                        end
                        end
Line 599... Line 697...
                                txdata_flagctrl_tx_last <= data_tx_i;
                                txdata_flagctrl_tx_last <= data_tx_i;
                        end
                        end
                        else
                        else
                        begin
                        begin
                                global_counter_transfer <= 4'd0;
                                global_counter_transfer <= 4'd0;
 
                                fct_counter_receive <= fct_counter_receive - 6'd1;
                        end
                        end
                end
                end
 
 
        end
        end
end
end

powered by: WebSVN 2.1.0

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